I've tried to make the package that Jiahao mentioned usable. I think it works, but it probably still has some rough edges. You can find it here
https://github.com/andreasnoack/TSVD.jl and there is a help entry for tsvd that explains the arguments. For a 2000x2000 dense non-symmetric complex matrix my tsvd runs in julia> @time tsvd(A); elapsed time: 0.354467696 seconds (16 MB allocated, 0.64% gc time in 1 pauses with 0 full sweep) The svds in base runs a bit slower julia> @time svds(A); elapsed time: 2.034591908 seconds (134 MB allocated, 0.25% gc time in 6 pauses with 0 full sweep) 2015-03-16 0:10 GMT-04:00 Jiahao Chen <[email protected]>: > > I've looked for other packages that could be wrapped, but couldn't find > any that offers this feature. The only thing I found is a description of > the "svds" Matlab routine, which is apparently based on "eigs". > > If you want a canned routine, you're best off with svds(A) in base Julia > (wraps ARPACK) or tsvd(A) in https://github.com/andreasnoack/PROPACK.jl > (work in progress to wrap PROPACK). The other package I'm aware of is > SLEPc, but it requires the entire PETSc stack. > > Note that the singular values of A are essentially the square root of the > magnitude of the eigenvalues of AA', or A'A, or [0 A; A' 0], so eigenvalue > routines can be used to solve the singular value problem. > > If you only need the largest singular value and its left singular vector, > a simple quick and dirty DIY scheme is to do power iteration on AA': > > A = randn(m, n) > u = randn(n) #some guess > for i=1:10 #some number of iterations > u = A*(A'u) > scale!(u, 1/norm(u)) > end > σ = norm(A'u) #σ, u are the largest singular value and its left singular > vector > > There is a simple generalization to the largest k singular values and > their left singular vectors. >
