On Thu, 27 Jul 2017, Sven Schreiber wrote:
Hi,
I'm using the psdroot() (generalized Choleski) for the first time
"seriously"
and have some questions.
- In one case there is an eigenvalue -1.2906e-006 in the input matrix, but
psdroot still goes to work. So I guess there is no check on whether the
matrix is actually PSD?
We had a (simple-minded) check for PSD-ness but it was in the wrong
place in the code. That's now fixed in git and snapshots, so psdroot
should now fail instead of producing garbage ("factors" containing
NaNs). And it will produce a valid factor in at least some cases where
cholesky fails. Example:
<hansl>
set verbose off
set seed 321457
# n = dimension of matrix, r = rank
n = 8
r = 6
# with the above psdroot works, cholesky does not
matrix A = zeros(n, n)
loop i=1..r -q
x = muniform(n, 1)
A += x*x'
endloop
# take a peek at eigenvalues
eval eigensym(A)
print "psdroot"
catch L = psdroot(A)
if $error == 0
print L
eval A - L*L'
else
print "psdroot failed"
endif
print "cholesky"
catch L = cholesky(A)
if $error == 0
print L
eval A - L*L'
else
print "cholesky failed"
endif
</hansl>
However, it's now clear to me that psdroot() doesn't really do what it
advertises. There's new lapack-based code in place in libgretl that
should do a proper job on rank-deficient matrices but it needs more
refinement and testing before I replace the original.
Allin