I am opening C ++ and I would like to create a librairy mini math matrix using templates.
Here I want to overload the * operator.
If I describe such a matrix: M(y, x) with M name of the matrix, y and x height and width, the matrix multiplication should look like this:
M(a, b) * N(b, c) = R(a, c)
I currently have this code:
template<unsigned int y, unsigned int x> class Matrix { public: Matrix() { } ~Matrix() { } Matrix<y, x2>& operator*(const Matrix<y2, x2>& right) {
So, I would like to be able to multiply two different matrices:
Matrix<3, 4> m; Matrix<4, 2> n; // fill the matrix with values Matrix<3, 2> o = m * n;
I searched, but I did not find the answer to this question (perhaps because I really do not know what I should look for exactly).
Thank you for your help:)
source share