Closed BoxWizard000000 closed 5 years ago
Hey @BoxWizard000000
Thanks for your interest in this library!
The problem here is that Matrix
expects its third template parameter to be a class of a MemoryDelegate
(i.e something that allocates some memory and returns elements of it when asked for them). The default memory delegate is an Array so to declare a Matrix
of doubles you just need to use:
Matrix<2, 2, Array<2,2,double>> B = {1, 0, 0, 1};
Matrix<2, 2, Array<2,2,double>> A = {1, 0, 0, 2.3};
Then you should be able to multiply them as usual:
Serial << (A * B) << '\n';
Admittedly this MemoryDelegate
thing is probably a bit confusing, especially if you're used to using Eigen so if you prefer you can also just use the template alias ArrayMatrix
like so:
ArrayMatrix<2, 2, double> C = {1, 0, 0, 1};
That'll expand to the exact same type as above.
Hope that helps!
Ahh now I get what those are. Thank you very much.
When I try to multiply two matrices like so...
I get a compiler error telling me that "* is an invalid binary expression" for the types; however, even stranger, if the left matrix has double elements and the right matrix doesn't, the compiler error goes away.
The multiplication of normal matrices works as desired.