The singular value decomposition [3] can be used to perform linear least squares minimization, principle component analysis, quantum Schmidt decomposition [4], etc. This version was developed for use in the qce++ quantum computing simulator.
See nash.txt for derivations, nash.m and tnash.m for octave/matlab code testing the basic plane rotation formulas, and diary for an example. typescript shows some full decomposition tests using main.cc and check.m.
The convergence criteria used in svd.h differ from the original Nash algorithm due to issues observed with some examples when testing (see NOTES for an example). Nash only tested for convergence if the columns were in order of decreasing norm. It seems to work better to check for convergence regardless of the order. Also, a common formula for the rotation cosine and sine is used, with an implicit swap done if necessary to correct the ordering.
References
[1] A one-sided transformation method for the singular value decomposition and algebraic eigenproblem, J. C. Nash, The Computer Journal, Volume 18, Issue 1, 1975, Pages 74-76, https://doi.org/10.1093/comjnl/18.1.74.
[2] Compact Numerical Methods for Computers, second edition, J. C. Nash, Adam Hilger publishing, 1990, ISBN 0-85274-318-1. Code: http://netlib.org/pascal/cnm.tgz. Local copies: excerpt, alg01.pas
[3] Singular value decomposition, Wikipedia, https://en.wikipedia.org/wiki/Singular_value_decomposition
[4] Quantum Singular Value Decomposer, Carlos Bravo-Prieto, Diego Garcia-Martin, Jose I. Latorre, Phys. Rev. A 101, 062310 (2020), https://arxiv.org/abs/1905.01353