The singular value decomposition, pt.1 - Golub-Kahan-Lanczos bidiagonalization

February 7, 2017

Many reference implementations of the singular value decomposition (SVD) use bidiagonalization as a fundamental preprocessing step. Like the Arnoldi algorithm, it is very closely related to the Gram-Schmidt orthogonalization process, since it multiplies the operand matrix with a series of projection matrices that zero out one or more of its components at each application.

In this blog post I will explain the Golub-Kahan-Lanczos bidiagonalization, which applies two projections, P ∈ ℝm × n and Q ∈ ℝn × n, to the operand matrix A ∈ ℝm × n to produce a matrix B ∈ ℝn × n that is non-zero only on its main diagonal and first super-diagonal.

$$ P^\dagger A Q = B =: \left[ \begin{array}{c c c c c} \alpha_1 & \beta_1 & & & \\ & \alpha_2 & \beta_2 & & \\ & & \ddots & \ddots & \\ & & & \alpha_{n-1} & \beta_{n-1} \\ & & & & \alpha_n \\ \end{array} \right] \label{eqn1} $$

The equation above requires us to find two sets of orthonormal vectors in order be fulfilled, i.e. the columns of P and Q. This means that there are effectively two sets of equations which we must solve iteratively to retrieve the factorization; these are obtained by applying P to Eq.1 and respectively transposing it and applying Q (and using the fact that (UV) = VU):

$$ \begin{cases} A Q = P B \\ A^\dagger P = Q B^\dagger \end{cases} $$

The algorithm directly follows by inspecting the two systems of equations written above in terms of their columns.

As first step we must choose an arbitrary vector of unit norm and appropriate dimensions, q1, which is used to obtain p1 and α1:

Aq1 = α1p1

whereas p2, q2 and β1 are obtained from the second system of equations:

Ap1 = α1q1 + β1q2

(NB: the α and β coefficients are obtained in turn by prescribing the p and q vectors to have unit norm).

Subsequent steps are only minimally different; at step j ∈ 2..n − 1 :

$$

$$

Note : of course also the coefficients αi are “outputs” to the iteration, but of the elements of B only βi is required to compute the results of iteration i + 1.

The final step will be slightly different, again due to the structure of B:

$$ \begin{array}{l l} A \mathbf{q}_n &= \alpha_n \mathbf{p}_n + \beta_{n-1} \mathbf{p}_{n-1} \\ A^\dagger \mathbf{p}_n &= \alpha_n \mathbf{q}_n \end{array} $$

After this, the α and β coefficients and the pi and qi vectors can be packed into matrices and used in subsequent computations.

In sparse-linear-algebra I implemented this control flow using the State monad, which makes the partial datastructures produced during iteration invisible to the rest of the program, by construction.

As a functional programmer, I found this explanation of the Golub-Kahan-Lanczos algorithm to be easier to follow and implement than that found in Golub and Van Loan’s textbook, which employs in-place mutation (i.e. matrices are overwritten at each iteration).

Stay tuned for part 2, in which we will complete the explanation of the singular value decomposition algorithm.

References

Dongarra, Jack, et al. (eds.), Templates for the Solution of Algebraic Eigenvalue Problems: a Practical Guide

Golub, Gene H.; Van Loan, Charles F. (1996), Matrix Computations (3rd ed.), Johns Hopkins