+template<typename T, unsigned M, unsigned N>
+inline Matrix<T, M, N>& Matrix<T, M, N>::invert()
+{
+ static_assert(M==N, "Inversion is only possible on square matrices");
+ Matrix<T, M, N> r = identity();
+ gauss_jordan(*this, r);
+ return *this = r;
+}
+
+template<typename T, unsigned S>
+inline Matrix<T, S, S> invert(const Matrix<T, S, S> &m)
+{
+ Matrix<T, S, S> temp = m;
+ Matrix<T, S, S> r = Matrix<T, S, S>::identity();
+ return gauss_jordan(temp, r);
+}
+