+template<typename T, unsigned S>
+inline SquareMatrix<T, S> SquareMatrix<T, S>::identity()
+{
+ SquareMatrix<T, S> m;
+ for(unsigned i=0; i<S; ++i)
+ m(i, i) = T(1);
+ return m;
+}
+
+template<typename T, unsigned S>
+SquareMatrix<T, S> &SquareMatrix<T, S>::operator*=(const SquareMatrix<T, S> &m)
+{
+ return *this = *this*m;
+}
+
+template<typename T, unsigned S>
+SquareMatrix<T, S> &SquareMatrix<T, S>::invert()
+{
+ SquareMatrix<T, S> r = identity();
+ 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> temp = m;
+ SquareMatrix<T, S> r = SquareMatrix<T, S>::identity();
+ return gauss_jordan(temp, r);
+}
+