SquareMatrix<T, S> &SquareMatrix<T, S>::invert()
{
SquareMatrix<T, S> r = identity();
- return invert_matrix(*this, r);
+ gauss_jordan(*this, r);
+ return *this = r;
}
template<typename T, unsigned S>
inline SquareMatrix<T, S> invert(const SquareMatrix<T, S> &m)
{
- SquareMatrix<T, S> r = m;
- return r.invert();
+ SquareMatrix<T, S> temp = m;
+ SquareMatrix<T, S> r = SquareMatrix<T, S>::identity();
+ return gauss_jordan(temp, r);
}
} // namespace LinAl