SyntaxFix
Write A Post
Hire A Developer
Questions
Another way to do this is to use the numpy matrix class (rather than a numpy array) and the I attribute. For example:
matrix
I
>>> m = np.matrix([[2,3],[4,5]]) >>> m.I matrix([[-2.5, 1.5], [ 2. , -1. ]])