I have a few matrices defined as:
array <array <float, 3>, 23> mat1;
array <array <float, 23>, 3> mat2;
array <array <float, 2>, 23> mat3;
array <array <float, 23>, 2> mat4;
I have a matrix multiplication function defined as shown below:
void mat_mult(array <array <float, 3>, 23>& a, array <array <float, 23>, 3>& b, array <array <float, 3>, 3>& c);
The function call is such that matrix mat1
will be a
, mat2
will be b
and matrix c
will store the result of a * b
.
My understanding is that I will need to create a separate function to multiply mat3
and mat4
. Is there any way to avoid it and create a single function for all multiplication operations, with matrices made of std::array
object? Or in other words is it possible to pass 2d arrays without specifying any dimension and then pass dimensions separately?