147 std::cerr <<
"This matrix has a null determinant and cannot be inverted. Returning zero matrix." << std::endl;
148 for (
int row = 0; row < _range; row++ )
149 for (
int col = 0; col < _range; col++ )
150 (*inv)( row, col ) = 0.;
154 T determinant = det();
156 for (
int row = 0; row < _range; row++ )
157 for (
int col = 0; col < _range; col++ )
160 inv->_mat[col][row] = std::pow( -1., row + col ) * minor->
det() / determinant;
172 if ( left._range != right._range )
174 std::cerr <<
"These matrices cannot be multiplied." << std::endl;
182 for (
int row = 0; row < left._range; row++ )
183 for (
int col = 0; col < right._range; col++ )
184 (*mat)[ row ][ col ] = 0;
186 for (
int row = 0; row < left._range; row++ )
187 for (
int col = 0; col < right._range; col++ )
188 for (
int line = 0; line < right._range; line++ )
189 (*mat)[ row ][ col ] += left._mat[ row ][ line ] * right._mat[ line ][ col ];