SVD - near-zero singular value

751 Views Asked by At

I have difficulties to handle singular values close to zero. My SVD implementation $A = U \Sigma V {}^{T}$ performs first an Eigen decomposition of the matrix $A {}^{T} A$. That is done with the QR-Algorithm, where the QR decomposition is computed with Householder reflections.

From the resulting Eigenvalues $\lambda_i$ and Eigenvectors $v_i$, I compute the singular values $$ \Sigma {}{_{i,i}} = \sigma {}_i= \sqrt{\lambda_i} $$ the right singular vectors $$ V_i = v_i $$ and finally the left singular vectors $$ U_i = \frac{Av_i}{\sigma {}_i}. $$

In case $\sigma_i = 0$, the corresponding left singular vector is determined as discussed here. As I work with double-percision, I do get small numbers instead of zero, which lead to an incorrect $U_i$. The situation is actually worse, as the QR algorithm sometimes computes even very small negative Eigenvalues.

So far, I use a static thresholds to decide what is zero and also checks, such as testing in the end if $U$ is orthogonal. This appeared to be a lousy approach, because I have to adapt it regularly.

Does there exists a good concept or strategy to overcome these issues? Should the problem be tackled in the Eigen decomposition?

If it of interest: The whole code is here and the latest SVD problem arose when implementing this paper.