SVD algorithm benchmark

least squareslinear algebranumerical linear algebrasvd

I Implemented a simple one sided Jacobi SVD algorithm for linear system solving that I would like to test.

Are there any complicated (not necessary big) or particular matrices to test that the algorithm works well?

With this SVD I would like to solve any kind of system including least-squares, undetermined of rank deficient by computing the Pseudo-Inverse.

Best Answer

Yes. Choose orthogonal matrices $U$ and $V$ a diagonal matrix $\Sigma$ with positive and distinct diagonal entries. Explicitly form the product $A = U \Sigma V^T$ and run this matrix through your solve. Note that your matrices need not be square as long as the product is defined. Verify that you recover the singular values and the direction of the singular vectors. Repeat with a different choice of $U$, $V$ and $\Sigma$. By changing the diagonal entries of $\Sigma$ you can generate matrices which are either well-conditioned or ill-conditioned. The choice of singular values which are not distinct is a subject which can wait until another day.