Are you sure this is a good idea? inverting matrices usually can *and should* be avoided. Rather precompute a decomposition (QR, Cholesky, SVD) and then solve system with those. Much more stable and also faster