Some refactoring to remove the 2x2 and 3x3 specific versions of inverse().
Also correct the definition of determinant for 1x1 matrices.