[SciPy-dev] logarithmic determinant in an absolute value sense
Nils Wagner
nwagner at mecha.uni-stuttgart.de
Mon Mar 20 07:39:46 EST 2006
Hi all,
I hope this function will be of interest.
Any comment would be appreciated.
Nils
from scipy import *
n = 200
A_1 = 1.e-2*(rand(n,n)+rand(n,n)*1j)
A_2 = 1.e-3*(rand(n,n)+rand(n,n)*1j)
def logabsdet(A):
"Return the logarithmic determinant in an absolute value sense"
p,l,u = linalg.lu(A)
return sum(log(abs(diag(u))))
res_1 = logabsdet(A_1)
res_2 = logabsdet(A_2)
print res_1, log(abs(linalg.det(A_1)))
print res_2, log(abs(linalg.det(A_2)))
More information about the SciPy-Dev
mailing list