2020年12月21日星期一

Python error about "malformed node or string" in matrix

I am using a matrix:

D = np.matrix('-1j 0 0 0; 0 1j 0 0; 0 0 (1-1j)/np.sqrt(2) 0;0 0 0 (1+1j)/np.sqrt(2)')  

However, Python says that

ValueError: malformed node or string: <_ast.BinOp object at 0x0000015B0FC279A0>

However, the following can work

(1+1j)/np.sqrt(2)  

Can anyone please let me know how to fix it? thanks!

https://stackoverflow.com/questions/65402597/python-error-about-malformed-node-or-string-in-matrix December 22, 2020 at 10:39AM

没有评论:

发表评论