Search code examples
numpymatrixlinear-algebracomplex-numbersinverse

Can numpy.linalg.inv compute the inverse of a complex-valued matrix?


Can numpy.linalg.inv compute the inverse of a complex-valued matrix? There seems very little information about this question with google.


Solution

  • Do you mean like this?

    In [190]: np.array([[1.2+3j,0],[0,2+3j]])
    Out[190]: 
    array([[1.2+3.j, 0. +0.j],
           [0. +0.j, 2. +3.j]])
    In [191]: np.linalg.inv(_)
    Out[191]: 
    array([[0.11494253-0.28735632j, 0.        +0.j        ],
           [0.        +0.j        , 0.15384615-0.23076923j]])