Calculate the matrix determinant and inverse faster