Re: LSA (latent sematic analysis) in Lisp, or at least SVD




"Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx> writes:

(message (Hello 'rif)
(you :wrote :on '(07 Nov 2006 16:56:17 -0500))
(

r> Why would you want a CL implementation of SVD?

i'm now using Armed Bear Common Lisp that can easily FFI only Java.
so far i'm only experimenting, so i'd rather make implementation fast, then
make fast implementation. i can use optimized implementation afterwards.
cl-mathstats' implementation in ABCL solves 100x100 SVD in 7 seconds, i
think it's 100 times slower than native one, but it's quite satisfying for
experiments.

There's an automatically generated (f2j) version of LAPACK available
for java. Haven't used it, but it might help you. This and other
java linear algebra packages (including somet that do SVD) are linked from:

http://math.nist.gov/javanumerics/


r> An SVD is pretty hard to get right,

cl-mathstats just copies "numerical recipes" C code, i hope it's a correct
one.

I cannot speak for SVD in particular, but "numerical recipes" is
pretty notorious for not getting right. If your matrices are
well-conditioned, it's probably not a problem. If your matrices are
troublesome, it's quite possible the numerical recipes algorithms will
break down sooner than the LAPACK ones. Of course, with matrix
factorizations, you can at least multiply the matrices back together,
check residuals, etc. to see how well you're doing.

Personally, I am always happier getting my matrix factorizations from
someone who really knew what they were doing and took the time to do
it right.

rif

.



Relevant Pages

  • Re: SVD Algorithm
    ... > Don't use svd; ... I would like to have the source code (in C or C++ or Java). ... Xhihat = U* W* V transpose. ...
    (sci.stat.math)
  • Re: pseudoinverse
    ... the numerical recipes code scale S differently? ... but not scilab and numerical receipe's ... > What u write is correct but i've tried to compute the SVD ... >> denotes the hermitian of V (complex cojugate transpose). ...
    (comp.lang.fortran)
  • Re: linalg[leastsqrs] in Maple V R4
    ... For some reason I thought that linalgwould've used an SVD ... Numerical Recipes sec. 5.13 prescribe an SVD approach for the very kind ... I thought that the LinearAlgebra routine LeastSquares was more ...
    (sci.math.symbolic)
  • Re: pseudoinverse
    ... What u write is correct but i've tried to compute the SVD ... with scilab and with the code provided by numerical recipes ... In both the cases A=U S transposebut the calculation of the pinv is different in my code and in scilab (correct) ... the SVD single value decomposition which i have already computed. ...
    (comp.lang.fortran)