I make the following imports:
from sympy.matrices import Matrix as sy_matrix
import sympy.mpmath as sy_mp
Create my matrices like this:
sysMat = sy_matrix([[0.0]*sz1]*sz2)
resVec = sy_matrix([[0.0]]*sz2)
.Populate then with python complex numbers (eg 1.0+1.0j) and then call:
coeffVec = sy_mp.qr_solve(sysMat, resVec)
However I get the following exception:
File "..\RatSMat.py", line 69, in solve
self.coeffVec = sy_mp.qr_solve(self.sysMat, self.resVec)
File "C:\Python27\lib\site-packages\sympy\mpmath\matrices\linalg.py", line 406, in qr_solve
A, b = ctx.matrix(A, **kwargs).copy(), ctx.matrix(b, **kwargs).copy()
File "C:\Python27\lib\site-packages\sympy\mpmath\matrices\matrices.py", line 328, in __init__
A = self.ctx.matrix(args[0].tolist())
File "C:\Python27\lib\site-packages\sympy\mpmath\matrices\matrices.py", line 301, in __init__
self[i, j] = convert(a)
File "C:\Python27\lib\site-packages\sympy\mpmath\ctx_mp_python.py", line 662, in convert
return ctx._convert_fallback(x, strings)
File "C:\Python27\lib\site-packages\sympy\mpmath\ctx_mp.py", line 614, in _convert_fallback
raise TypeError("cannot create mpf from " + repr(x))
TypeError: cannot create mpf from -2.27448396079674e-13*I
It seems to occur when sympy is setting up the matrices before input, which seems odd to me since the I indicate a sympy complex type. Thinking I'm perhaps using the wrong matrices or input type somewhere.