[SciPy-user] linalg.lu is

Nils Wagner nwagner at mecha.uni-stuttgart.de
Fri Feb 20 14:56:30 CST 2004


Hi all,

linalg.lu cannot handle complex equations, where the rhs is complex.

Nils

from scipy import *
from RandomArray import *
n = 2
A = rand(n,n)+rand(n,n)*1j
X = zeros((n,n),Complex)
Ainv = linalg.inv(A)
print linalg.norm(dot(Ainv,A))
I = identity(n)+0j*identity(n)
#
# linalg.solve cannot handle complex rhs !!
#
#I = I.real
#
for i in arange(0,n):
   X[:,i] = linalg.solve(A,I[:,i])
#
# Should be the inverse of A as well !!!!
#
print X
#
# Inverse of A
#
print Ainv



More information about the SciPy-user mailing list