I am trying to get the real values of a complex valued matrix.
import mpmath as mp
A = mp.matrix([[1+1j, 2+2j],[3+2j, 4+2j]])
I've tried both:
mp.re(A)
np.real(A)
but neither work.
I've also tried looking for information here but haven't found anything http://docs.sympy.org/0.6.7/modules/mpmath/basics.html
The first gives an error message: cannot create mpf from matrix ...
The second gives: insufficient indices for matrix
any help appreciated
mp.re(A[0,0])
, mp.re(A[0,1])
,mp.re(A[1,0])
, and mp.re(A[1,1])
all work, but you are right that mp.re(A)
doesn't work. For the time being you can loop through the matrix until you find a vectorized solution.