Code:
template <class Tm, int M, int N>
class Matrix{
...
template <int Mm, int Nm>
Matrix<Tm, M, Nm> operator *(Matrix<Tm, Mm, Nm>& m);
template <int Mm, int Nm>
Matrix<Tm, M, Nm> multiply(Matrix<Tm, Mm, Nm>& m);
...
};
USAGE:
Matrix<int, 3,1> m1;
Matrix<int, 1,3> m2;
Matrix<int, 3,3> m3 = m1.operator* <1,3>( m2 );
OR
Matrix<int, 3,3> m4 = m1.multiply <1,3>( m2 );
Granted, it's not very cute from a mathematical point of view, but it should work.
And it's the best way I can think of if you want templated Matrices... =/
Edit:
I haven't tried the code myself, but the following might also work.
Code:
Matrix<int, 3,3> m5 = m1 * m2;