MINRES-QLP: a Krylov subspace method for indefinite or singular symmetric systems
Sou-Cheng T. Choi, Christopher C. Paige, Michael A. Saunders
Introduction
We are concerned with iterative methods for solving a symmetric linear system or the related least-squares (LS) problem
The solution of (1), called the minimum-length or pseudoinverse solution , is formally given by , where denotes the pseudoinverse of . The pseudoinverse is continuous under perturbations for which , and is continuous under the same condition. Problem (1) is then well-posed .
Let be an eigenvalue decomposition of , with orthogonal and . We define the condition number of to be , and we say that is ill-conditioned if . Hence a singular matrix could be well-conditioned or ill-conditioned.
SYMMLQ and MINRES are Krylov subspace methods for solving symmetric indefinite systems . SYMMLQ is reliable on compatible systems even if is ill-conditioned or singular, while on (singular) incompatible problems its iterates diverge to a multiple of a nullvector of [10, Proposition 2.15] and [10, Lemma 2.17]. MINRES seems more desirable to users because its residual norms are monotonically decreasing. On singular compatible systems, MINRES returns (see Theorem 1). On singular incompatible systems, MINRES is reliable if terminated with a suitable stopping rule involving (see Lemma 3), but the solution will not be .
Here we develop a new solver of this type named MINRES-QLP . The aim is to deal reliably with compatible or incompatible systems and to return the unique solution of (1). We give theoretical reasons why MINRES-QLP improves the accuracy of MINRES on ill-conditioned systems, and illustrate with numerical examples.
Incompatible symmetric systems could arise from discretized semidefinite Neumann boundary value problems [27, section 4], and from any other singular systems involving measurement errors in . Another potential application is large symmetric indefinite low-rank Toeplitz LS problems as described in [16, section 4.1].
2 Overview
In sections 2–4 we briefly review the Lanczos process, MINRES, and QLP decomposition before introducing MINRES-QLP in section 5. We derive norm estimates in section 6 and preconditioned MINRES-QLP in section 7. Numerical experiments are described in section 8.
The Lanczos process
Given and , the Lanczos process computes vectors and tridiagonal matrices according to , , and thenNumerically, , , is slightly better .
The th Krylov subspace generated by and is defined to be . The following properties should be kept in mind:
If is changed to for some scalar shift , becomes and is unaltered, showing that singular systems are commonplace. Shifted problems appear in inverse iteration or Rayleigh quotient iteration.
MINRES
To make small, it is clear that should be small. At this iteration , MINRES minimizes the residual subject to by choosing
This subproblem is processed by the expanding QR factorization: and
where and form the Householder reflector that annihilates in to give upper-tridiagonal , with and being unaltered in later iterations.
Also, and . Hence from (3)–(5),
which is nonincreasing and tending to zero if is compatible.
2 Compatible systems
The following theorem assures us that MINRES is a useful solver for compatible linear systems even if is singular.
3 Incompatible systems
For a singular LS problem , the optimal residual vector is unique, but infinitely many solutions give that residual. In the following example, MINRES finds a least-squares solution (with optimal residual) but not the minimum-length solution.
Let and . The minimum-length solution to is with residual and . MINRES returns the solution (with residual and ).
4 Norm estimates in MINRES
For incompatible systems, (3) will never be zero. However, all LS solutions satisfy , so that . We therefore need a new stopping condition based on the size of . In applications requiring nullvectors, is also useful. We present efficient recurrence relations for and in the following Lemma, which was not considered in the framework of MINRES when it was originally designed for nonsingular systems .
For the recurrence relations of and its norm, we have
Note that even using finite precision the expression for is extremely accurate for the versions of the Lanczos algorithm given in section 2, since (taking with negligible error), , where from (9) , while from [38, (18)] , and with , see [38, (19)], we see that .
Typically is not monotonic, while clearly and are monotonic. In the eigensystem , let , where the eigenvectors correspond to nonzero eigenvalues. Then and are orthogonal projectors onto the range and nullspace of . For general linear LS problems, Chang et al. characterize the dynamics of and in three phases defined in terms of the ratios among , , and , and propose two new stopping criteria for iterative solvers. The expositions show that these estimates are cheaply computable in CGLS and LSQR .
5 Effects of rounding errors in MINRES
Sleijpen, Van der Vorst, and Modersitzki analyzed the effects of rounding errors in MINRES and reported examples of apparent failure with a matrix of the form , where is an ill-conditioned diagonal matrix and involves a single plane rotation. We were unable to reproduce MINRES’s performance on the two examples defined in Figure 4 of their paper, but we modified the examples by using an Householder transformation for , and then observed similar difficulties with MINRES—see Figure 5. The recurred residual norm is a good approximation to the directly computed until the last few iterations. The recurred norms then keep decreasing but the directly computed norms become stagnant or even increase (see the lower subplots in Figure 5).
Note that we do want to keep decreasing on compatible systems, so that the test with will eventually be satisfied even if the computed is no longer as small as .
The analysis in focuses on the rounding errors involved in the lower triangular solves (one solve for each row of ), compared to the single upper triangular solve (followed by ) that would be possible at the final if all of were stored as in GMRES . We shall see that a key feature of MINRES-QLP is that a single lower triangular solve suffices with no need to store , much the same as in SYMMLQ.
Orthogonal decompositions for singular matrices
In 1999 Stewart proposed the pivoted QLP decomposition , which is equivalent to two consecutive QR factorizations with column interchanges, first on , then on :
giving nonnegative diagonal elements, where and are permutations chosen to maximize the next diagonal element of and at each stage. This gives , where
with and orthogonal. Stewart demonstrated that the diagonals of (the -values) give better singular-value estimates than the diagonals of (the -values), and the accuracy is particularly good for the extreme singular values and :
The first permutation in pivoted QLP is important. The main purpose of the second permutation is to ensure that the -values present themselves in decreasing order, which is not always necessary. If , it is simply called the QLP decomposition.
MINRES-QLP
and (4) is solved by and . The MINRES-QLP estimate of is therefore with theoretically orthonormal .
We will see that only the last three columns of are needed to update .
The QLP decomposition of each must be without permutations in order to ensure inexpensive updating of the factors as increases. Our experience is that the desired rank-revealing properties (16) tend to be retained, perhaps because of the tridiagonal structure of and the convergence properties of the underlying Lanczos process.
For MINRES-QLP to be efficient, in the th iteration () the application of the left reflector is followed immediately by the right reflectors , so that only the last principal submatrix of the transformed will be changed in future iterations. These ideas can be understood more easily from Figure 1 and the following compact form, which represents the actions of right reflectors on (additional to (9)):
Figure 2 shows the relation between the singular values of and the diagonal elements of and with . This illustrates (16) for matrix ID 1177 from with .
3 Solving the subproblem
With , subproblem (4) becomes
where and are as in (5) and (8). At the start of iteration , the first elements of , denoted by for , are known from previous iterations; see the 10th matrix in Figure 1. The remainder depend on the rank of .
The corresponding solution estimate is , where
and we update and compute by short-recurrence orthogonal steps:
4 Termination
5 Transfer from MINRES to MINRES-QLP
On well-conditioned systems, MINRES and MINRES-QLP behave very similarly. However, MINRES-QLP requires one more vector of storage, and each iteration needs 4 more axpy’s () and 3 more vector scalings (). Thus it would be a desirable feature to invoke MINRES-QLP from MINRES only if is ill-conditioned or singular. The key idea is to transfer to MINRES-QLP at an iteration where is not yet too ill-conditioned. The MINRES and MINRES-QLP solution estimates are the same, so from (6), (25), and (19): . Now from (12), (17), and (22),
and the last three columns of can be obtained from the last three columns of and . (Thus, we transfer the three MINRES basis vectors to .) In addition, we need to generate using (24):
It is clear from (26) that we still need to do the right transformation in the MINRES phase and keep the last principal submatrix of for each so that we are ready to transfer to MINRES-QLP when necessary. We then obtain a short recurrence for (see section 6.5) and for this computation we save flops relative to the original MINRES algorithm, where is computed directly.
In the implementation, the MINRES iterates transfer to MINRES-QLP iterates when an estimate of the condition number of (see (29)) exceeds an input parameter . Thus, leads to MINRES iterates throughout, while generates MINRES-QLP iterates from the start.
6 Comparison of Lanczos-based solvers
We compare MINRES-QLP with CG, SYMMLQ, and MINRES in Tables 1–2 in terms of subproblem definitions, basis, solution estimates, flops and memory. A careful implementation of SYMMLQ provides a point in as shown. All solvers need storage for , , , and a product each iteration. Some additional work-vectors are needed for each method (e.g., and for MINRES, giving 7 work-vectors in total).
Stopping conditions and norm estimates
This section derives several norm estimates that are computed in MINRES-QLP. As before, we assume exact arithmetic throughout, so that and are orthonormal. Table 3 summarizes how the norm estimates are used to formulate three groups of stopping conditions. The second NRBE test is from Stewart with symmetric .
First we derive recurrence relations for and its norm .
Next we derive recurrence relations for and its norm , and we show that is orthogonal to .
For the first case, the proof is essentially the same as the proof of Lemma 3. For the other two cases, the results follow directly from Lemma 5. ∎
3 Matrix norms
For Lanczos-based algorithms, . Define
Then . Clearly, is monotonically increasing and is thus an improving estimate for as increases. By the property of QLP decomposition in (16) and (5.1), we could easily extend (27) to include the largest diagonal of :
Some other schemes inspired by Larsen [31, section A.6.1], Higham , and Chen and Demmel follow. For the latter scheme, we use an implementation by Kaustuv for estimating the norms of the rows of .
for small or
Matlab function NORMEST, which is based on the power method
Figure 3 plots estimates of for 12 matrices from the Florida sparse matrix collection whose sizes vary from 25 to 3002. In particular, scheme 3 above with gives significantly more accurate estimates than other schemes for the 12 matrices we tried. However, the choice of is not always clear and the scheme adds a little to the cost of MINRES-QLP. Hence we propose incorporating it into MINRES-QLP (or other Lanzcos-based iterative methods) if very accurate is needed. Otherwise (28) uses quantities readily available from MINRES-QLP and gives us satisfactory estimates for the order of .
4 Matrix condition numbers
We again apply the property of the QLP decomposition in (16) and (5.1) to estimate , which is a lower bound for :
5 Solution norms
We derive a recurrence relation for whose cost is as low as computing the norm of a - or - vector.
Since , we can estimate by computing . However, the last two elements of change in (and a new element is added). We therefore maintain by updating it and then using it according to
Thus increases monotonically but we cannot guarantee that and its recurred estimate are increasing, and indeed they are not in some examples (see Figure 4).
6 Projection norms
Sometimes the projection of the right-hand side vector onto is required (for example, see ). A simple recurrence relation is and we can derive it in the same way as shown in Lemma 3. With we have .
Preconditioned MINRES and MINRES-QLP
It is often asked: How can we construct a preconditioner for a linear system solver so that the same problem is solved with fewer iterations? Previous work on preconditioning the symmetric solvers CG, SYMMLQ, or MINRES includes .
We have the same question for singular symmetric systems . Two-sided preconditioning is needed to preserve symmetry. We can still solve compatible systems, but we will no longer obtain the minimum-length solution. For incompatible systems, preconditioning alters the “least squares” norm. To avoid this difficulty we must work with larger equivalent systems that are compatible. We consider each case in turn, using a positive-definite preconditioner with MINRES and MINRES-QLP to solve symmetric compatible systems . Implicitly, we are solving equivalent symmetric systems , where . As usual, it is possible to work with itself, so without loss of generality we can assume .
We derive preconditioned MINRES for compatible by applying MINRES to the equivalent problem , where , , and .
Let denote the Lanczos vectors of . With and , for we define
Then where the square root is well defined because is positive definite, and the Lanczos iteration is
Multiplying the last equation by we get
The last expression involving consecutive ’s replaces the three-term recurrence in ’s. In addition, we need to solve a linear system (30) each iteration.
1.2 Preconditioned MINRES
From (6) and (12) we have the following recurrence for the th column of and :
Multiplying the above two equations by on the left and defining , we can update the solution of our original problem by
We list the algorithm in [10, Table 3.4].
1.3 Preconditioned MINRES-QLP
A preconditioned MINRES-QLP can be derived very similarly. The additional work is to apply right reflectors to , and the new subproblem bases are , with . Multiplying the new basis and solution estimate by on the left, we obtain
Algorithm 1 lists all steps. Note that is written as for all relevant . Also, the output solves but the other outputs are associated with .
The requirement of positive-definite preconditioners in MINRES and MINRES-QLP may seem unnatural for a problem with indefinite because we cannot achieve . However, as shown in , we can achieve using an approximate block-LDL factorization to get , where is indefinite with blocks of order 1 and 2, and has the same eigensystem as except negative eigenvalues are changed in sign.
SQMR without preconditioning is analytically equivalent to MINRES. Unlike MINRES, SQMR can work directly with an indefinite preconditioner (such as block-LDL). However, in finite precision, SQMR needs “look-ahead” to prevent numerical breakdown.
2 Preconditioning singular Ax=b𝐴𝑥𝑏Ax=b
For singular compatible systems, MINRES and MINRES-QLP find the minimum-length solution (see Theorems 1 and 4). If is nonsingular, the preconditioned system is also compatible and the solvers return its minimum-length solution. The unpreconditioned solution solves , but is not necessarily a minimum-length solution.
Let and Then and is a singular compatible system. The minimum-length solution is . By binormalization we construct the matrix . The minimum-length solution of the diagonally preconditioned problem is . Then is a solution of , but .
3 Preconditioning singular Ax≈b𝐴𝑥𝑏Ax\approx b
We propose the following techniques for obtaining minimum-residual solutions of singular incompatible problems. In each case we use an equivalent but larger compatible system to which MINRES may be applied. Even if the larger system is singular, Theorem 1 shows that the minimum-length solution of the larger system will be obtained. The required will be part of this solution. Preconditioning still gives a minimum-residual solution of , and in some cases will be . If the systems are ill-conditioned, it will be safer and more efficient to apply MINRES-QLP to the original incompatible system. However, preconditioning will give an that is “minimum length” in a different norm.
When is singular, so is the augmented system
but it is always compatible. Preconditioning with symmetric positive-definite gives us a solution in which is unique, but may not be .
3.2 A giant KKT system
Problem (1) is equivalent to subject to (31), which is an equality-contrained convex quadratic program. The corresponding KKT system [36, section 16.1] is both symmetric and compatible:
Although this is still a singular system, the upper-left block-submatrix is nonsingular and therefore , , and are unique and a preconditioner applied to the KKT system would give as the minimum-length solution of our original problem.
3.3 Regularization
If the rank of a given matrix is ill-determined, we may want to solve the regularized problem with parameter :
The matrix has full rank and is always better conditioned than . LSQR may be applied, and its iterates will reduce monotonically. Alternatively, we could transform (33) into the following symmetric compatible systems and apply MINRES or MINRES-QLP. They tend to reduce monotonically.
we obtain (34). Thus is also a solution of our regularized problem (33). This is equivalent to the two-layered formulation (4.3) in Bobrovnikova and Vavasis (with , , , , , ). A key property is that as .
If we define and , then we can show (by eliminating and from the following system) that in
is also a solution of (35) and thus of (33). The upper-left block-submatrix of (36) is nonsingular, and the correct limiting behavior occurs: as . In fact, (36) reduces to (32).
4 General preconditioners
The construction of preconditioners is usually problem-dependent. If not much is known about the structure of , we can only consider general methods such as diagonal preconditioning and incomplete Cholesky factorization. These methods require access to the nonzero elements of . (They are not applicable if exists only as an operator for returning the product .)
For a comprehensive survey of preconditioning techniques, see Benzi . We discuss a few methods for symmetric that also require access to the nonzero .
If has entries that are very different in magnitude, diagonal scaling might improve its condition. When is diagonally dominant and nonsingular, we can define with . Instead of solving , we solve , where is still diagonally dominant and nonsingular with all entries in magnitude, and .
More generally, if is not diagonally dominant and possibly singular, we can safeguard division-by-zero errors by choosing a parameter and defining
If , then . Let , in (37). Then and .
contains mostly very small entries, and . Let and . Then and . (The choice of makes a critical difference in this case: with , we have .)
4.2 Binormalization (BIN)
Livne and Golub scale a symmetric matrix by a series of diagonal matrices on both sides until all rows and columns of the scaled matrix have unit -norm: . See also Bradley .
If , then . With just one sweep of BIN, we obtain , and even though the rows and columns have not converged to one in the two-norm. In contrast, diagonal scaling (37) defined by and reduces the condition number to approximately .
4.3 Incomplete Cholesky factorization
For a sparse symmetric positive definite matrix , we could compute a preconditioner by the incomplete Cholesky factorization that preserves the sparsity pattern of . This is known as IC0 in the literature. Often there exists a permutation such that the IC0 factor of is more sparse than that of .
When is semidefinite or indefinite, IC0 may not exist, but a simple variant that may work is the incomplete Cholesky-infinity factorization [55, section 5].
Numerical experiments
We compare the computed results of MINRES-QLP and various other Krylov subspace methods to solutions computed directly by the eigenvalue decomposition (EVD) and the truncated eigenvalue decompositions (TEVD) of . For TEVD we have
with parameter . Often is set to , and sometimes to a moderate number such as or ; it defines a cut-off point relative to the largest eigenvalue of . For example, if most eigenvalues are of order 1 in magnitude and the rest are of order , we expect TEVD to work better when the small eigenvalues are excluded, while EVD (with ) could return an exploding solution.
In the tables of results, Matlab MINRES and Matlab SYMMLQ are Matlab’s implementation of MINRES and SYMMLQ respectively. They incorporate local reorthogonalization of the Lanczos vector , which could enhance the accuracy of the computations if is close to an eigenvector of :
Lacking the correct stopping condition for singular problems, Matlab SYMMLQ works more than necessary and then selects the smallest residual norm from all computed iterates; it would sometimes report that the method did not converge although the selected estimate appeared to be reasonably accurate.
MINRES SOL and SYMMLQ SOL are implementations based on . MINRES+ and SYMMLQ+ are the same but with additional stopping conditions for singular incompatible systems (see Lemma 3 and [10, Proposition 2.12]).
The computations in this section were performed on a Windows XP machine with a 3.2GHz Intel Pentium D Processor 940 and 3GB RAM () . Tests were performed with each solver on five types of problem:
mildly incompatible symmetric (and singular) systems (meaning is rather small with respect to )
We present a few examples that illustrate the key features of MINRES-QLP. For a larger set of tests and results, such as applying MINRES-QLP and other Krylov methods to Hermitian systems with preconditioning, we refer to [10, Chapter 4].
For a compatible system, we generate a random vector that is in the range of the test matrix (, , i.e., are independent and identically distributed random variables, whose values are drawn from the standard uniform distribution with support $bb_{i}\sim i.i.d.\ U(0,1)$ often suffices).
If is Hermitian, then is real for all complex vectors . Numerically (in double precision), is likely to have small imaginary parts in the first few Lanczos iterations and snowball to have large imaginary parts in later iterations. This would result in a poor estimation of or , and unnecessary errors in the Lanczos vectors. Thus we made sure to typecast in MINRES-QLP and MINRES SOL.
We could say from the results that the Lanczos-based methods have built-in regularization features , often matching the TEVD solutions very well.
Our first example involves a singular indefinite Laplacian matrix of order . It is block-tridiagonal with each block being a tridiagonal matrix of order with all nonzeros equal to 1:
Matlab’s eig() reports the following data: positive eigenvalues in the interval , almost-zero eigenvalues in , negative eigenvalues in , numerical rank .
We used a right-hand side with a small incompatible component: with and . Results are summarized in Table 4. In the column labeled “C?”, the value “Y” denotes that the associated algorithm in the row has converged to the desired NRBE tolerances within iterations (cf. Table 3); otherwise, we have values “N” and “N?”, where “N?” indicates that the algorithm could have converged if more relaxed stopping conditions were used. The column “” shows the total number of matrix-vector products, and column “” lists the first element of the final solution estimate for each algorithm. For GMRES, the integer in parentheses is the value of the restart parameter.
MINRES SOL gives a larger solution than MINRES-QLP. This example has a residual norm of about , so it is not clear whether to classify it as a linear system or an LS problem. To the credit of Matlab SYMMLQ, it thinks the system is linear and returns a good solution. For MINRES-QLP, the first 410 iterations are in standard “MINRES mode”, with a transfer to “MINRES-QLP mode” for the last 202 iterations. LSQR converges to the minimum-length solution but with more than twice the number of iterations of MINRES-QLP. The other solvers fall short in some way.
2 A Laplacian LS problem min‖Ax−b‖norm𝐴𝑥𝑏\min\|Ax-b\|
This example uses the same Laplacian matrix (38) but with a clearly incompatible , i.e., . The residual norm is about . Results are summarized in Table 5. MINRES gives an LS solution, while MINRES-QLP is the only solver that matches the solution of TEVD. The other solvers do not perform satisfactorily.
3 Regularizing effect of MINRES-QLP
This example illustrates the regularizing effect of MINRES-QLP with the stopping condition . For in Figure 4, we observe the following values:
Because the last value exceeds , MINRES-QLP regards the last diagonal element of as a singular value to be ignored (in the spirit of truncated SVD solutions). It discards the last element of and updates
The full truncation strategy used in the implementation is justified by the fact that with orthogonal. When becomes large, the last element of is treated as zero. If is still large, the second-to-last element of is treated as zero. If is still large, the third-to-last element of is treated as zero.
4 Effects of rounding errors in MINRES-QLP
The recurred residual norms in MINRES usually approximate the directly computed ones very well until becomes small. We observe that continues to decrease in the last few iterations, even though has become stagnant. This is desirable in the sense that the stopping rule will cause termination, although the final solution is not as accurate as predicted.
We present similar plots of MINRES-QLP in the following examples, with the corresponding quantities as and . We observe that except in very ill-conditioned LS problems, approximates very closely.
Figure 5 illustrates four singular compatible linear systems.
Figure 6 illustrates four singular LS problems.
Conclusion
MINRES constructs its th solution estimate from the recursion (6), where separate triangular systems are solved to obtain the elements of each direction . (Only is obtained during iteration , but it has elements.)
In contrast, MINRES-QLP constructs its th solution estimate using orthogonal steps: ; see (19)–(25). Only one triangular system is involved for each .
Thus MINRES-QLP overcomes the potential instability predicted by the MINRES authors and analyzed by Sleijpen et al. . The additional work and storage are moderate, and maximum efficiency is retained by transferring from MINRES to the MINRES-QLP iterates only when the estimated condition number of exceeds a specified value.
MINRES and MINRES-QLP are readily applicable to Hermitian matrices, once is typecast as a real scalar in finite-precision arithmetic. For both algorithms, we derived recurrence relations for and and used them to formulate new stopping conditions for singular problems.
TEVD or TSVD are commonly known to use rank- approximations to to find approximate solutions to that serve as a form of regularization. Krylov subspace methods also have regularization properties . Since MINRES-QLP monitors more carefully the rank of , which could be or , we may say that regularization is a stronger feature in MINRES-QLP, as we have shown in our numerical examples.
It is important to develop robust techniques for estimating an a priori bound for the solution norm since the MINRES-QLP approximations are not monotonic as is the case in CG and LSQR. Ideally, we would also like to determine a practical threshold associated with the stopping condition in order to handle cases when is numerically small but not exactly zero. These are topics for future research.
Software and reproducible research
Matlab 7.6, Fortran 77, and Fortran 90 implementations of MINRES with new stopping conditions and , and a Matlab 7.6 implementation of MINRES-QLP are available from SOL .
Following the philosophy of reproducible computational research as advocated in , for each figure and example in this paper we mention either the source or the specific Matlab command. Our Matlab scripts are available at SOL .
We thank Jan Modersitzki, Gerard Sleijpen, Henk Van der Vorst, and also Kaustuv for providing us with their Matlab scripts, which have aided us in producing parts of Figures 3, 5, and 6. We also thank Michael Friedlander, Rasmus Larsen, and Lek-Heng Lim for their finest examples of work, discussion, and support. We are most grateful to our anonymous reviewers for their insightful suggestions for improving this manuscript. Last but not least, we dedicate this paper to the memory of our colleague and friend, Gene Golub.