![]() ![]() Singular value decompositions proceed in two stages. Janneb is correct that is a wrapper around xGESDD in LAPACK. SVD can also be used to solve linear systems, but it will be more expensive than QR factorization. For rectangular systems, QR factorization is a better choice because it will yield least-squares solutions to overdetermined linear systems. However, it requires more floating-point operations than LU factorization by a factor of 2 for square matrices (I believe JackPoulson may correct me on that). QR factorization is a more stable numerical algorithm for solving linear systems, which is probably why it gives you such precise results. There are some pathological cases for which LU factorization with partial pivoting is unstable (see Lecture 22 in Numerical Linear Algebra by Trefethen and Bau for details). However, for solving a linear system, LU factorization (with partial pivoting, which is the standard implementation in LAPACK) is extremely reliable in practice. The SVD is a more accurate, reliable algorithm for the determination of numerical rank, but it requires more floating-point operations. ![]() Instead, use a rank-revealing QR decomposition (such as xGEQPX or xGEPQY in LAPACK, where x is C, D, S, or Z, though those routines are difficult to track down see JedBrown's answer on a related question), or use an SVD (singular value decomposition, such as xGESDD or xGESVD, where x is again C, D, S, or Z). LU factorization is unreliable for this purpose in floating-point arithmetic. K = 200 -> Elapsed time is 216.596219 seconds.There are a number of issues in your question.ĭo not use Gaussian Elimination (LU factorization) to calculate the numerical rank of a matrix. For this, we turn to the PROPACK software. K = 200 -> Elapsed time is 335.170137 seconds.įinally, there is a customized routine that does what Matlab’s svds routine does, but using the Golub-Kahan bidiagonalization procedure that implicitly is doing the Lanczos procedure on but without forming that matrix or storing extra work. What happens here is that we’d need a bit more post-processing to get the matrix U, and the elements of D are the squares of the singular values. Again, this routine uses the ARPACK code via the function “eigs” now f = A*(A'*x) m = size(A,1) So we don’t need to actually FORM the matrix. My adviser called this the “dreaded normal equations.” To do this, we use the Matlab eigs routine with a function We can alternatively compute the largest eigenvalues and vectors of the matrix, which squares the condition number and is usually a no-no in numerical analysis, but if we are solely interested in performance, this could be better. There are a few steps in this that exploit parallel computations. What Matlab’s svds routine does internally is compute the extremal eigenvectors of the matrix using the ARPACK software. Then we get the results: k = 10 -> Elapsed time is 95.075653 seconds. If we just use Matlab’s svds = svds(A,k) (See Part 2 for info on using ipython and numpy and scipy) ![]() Given the way the algorithms work, there is usually a bit of overallocation, so let’s say 3GB of memory is reasonable. Computing a rank 200 SVD takes about 2.34GB of memory (~760 MB for vectors, ~1.5GB for matrix). I’m using Matlab R2011a on a dual Intel Xeon e5-2670 computer with 256GB of RAM. (It’s unfortunate that these two, very different, problems are often confused.) We are also considering the sparse SVD that treats the missing entries as 0, not the matrix-completion SVD that treats the missing ratings as missing. Here, we consider three implementations of computing the SVD of the netflix matrix. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |