svd
, which uses random preconditioning to restart when svd fails to convergeIn order to generate the SVD of the matrix x
, qrSVD
calls genQ
to generate a random orthonormal matrix, and uses this random matrix to precondition x
. The svd of the preconditioned matrix is calculated, and adjusted to account for the preconditioning process in order to find svd(x)
.
qrSVD(x, lim_attempts = 50, warning_type = "silent",
warning_file = "qrSVD_warnings.txt", ...)
a matrix to calculate the svd for
the number of tries to randomly precondition x. We generally find that one preconditioning attempt is sufficient.
controls whether the user should be told if an orthogonal preconditioning matrix is required, or if svd
gives warnings. 'silent' ignores these warnings, 'print' prints the warning to the console, and 'file' saves the warnings in a text file.
gives the location of a file to print warnings to, if warning_type
is set to 'file'.
parameters passed to svd
, such as nv
and nu
.
Solves \(svd(x)=UDV'\), where \(U\) is an matrix containing the left singular vectors of \(x\), \(D\) is a diagonal matrix containing the singular values of \(x\); and \(V\) is a matrix containing the right singular vectors of \(x\) (output follows the same notation convention as the svd
function).
qrSVD
will attempt the standard svd
function before preconditioning the matrix \(x\).
# NOT RUN {
x <-matrix(rnorm(3*5),nrow=3,ncol=5)
svdx <- qrSVD(x)
svdx
# }
Run the code above in your browser using DataLab