The division that cannot be done
Worth reading first: The zero that means it is finished · The rate the condition number predicts · A factorisation with nothing to pivot for.
Two essays about a divisor going to zero, and both of them about what the zero means. This one is about a division that is not the point at all.
Conjugate gradients computes a step length as α = rᵀr / pᵀAp. The denominator is the curvature of the quadratic ½xᵀAx − bᵀx along the search direction p, and on a positive definite matrix it is positive by definition. On anything else it can be zero or negative, at which point the method has no step to take: the quadratic it is minimising has no minimum along that direction, and no length of step is better than any other because arbitrarily long is arbitrarily better.
This site’s own conjugate gradient routine has guarded against that since it was first written, with
a comment saying the method “has no step to take” and a flag named breakdown. That is the correct
thing for a linear solver to do and it is the whole of what this collection had ever said about it.
It is the wrong thing for the method that made conjugate gradients famous outside linear algebra.
What the direction is
In a trust-region Newton method the system being solved is the Newton system: A is a Hessian, b is minus a gradient, and the quadratic is a local model of a function somebody is minimising. A direction p with pᵀAp ≤ 0 is a direction along which that model decreases without bound.
That is not a failure to report. It is a certificate, and it has three properties that make it worth more than the answer the solve was going to produce.
It proves something. The current point is not a minimum. Not “appears not to be”, not “the solver had trouble” — a vector d with dᵀAd < 0 is a proof that A is not positive semidefinite, and a proof that survives being handed to somebody who did not run the iteration.
It is checkable in one product. Anybody can take d, form Ad, take the inner product, and see the sign. The certificate does not require trusting the iteration that produced it, which is the difference between a proof and a report.
And it costs what has already been spent. On the matrix in the figure above it arrives after six matrix–vector products on a forty-dimensional problem. Establishing the same fact by attempting a Cholesky factorisation costs a third of n³ operations and requires the matrix to exist as entries.
How long it takes to find
The direction is not free — the iteration has to build a Krylov space large enough to contain a direction that sees the negative eigenvalue. How large depends on how negative it is, and the answer runs in the reassuring direction.
At λ = 3 the certificate arrives after three products. At λ = 10⁻³ it takes nine. The trend is monotone and it is the trend a Krylov method always has: large eigenvalues in magnitude are found first, small ones last.
So the indefiniteness that hides is the indefiniteness that matters least. A Hessian with an eigenvalue at −3 is a point the optimiser should leave immediately and the iteration says so at once; a Hessian with an eigenvalue at −10⁻³ is a point that is very nearly a minimum, and the extra six products spent finding that out are six products spent on a distinction that changes little.
That is not a general law about detection — it is a fact about the interaction between which eigenvalues a Krylov space finds and which eigenvalues matter here, and the two happen to be the same ones. It is worth naming precisely because the reverse arrangement is what one usually gets. On the rank decision this collection has already drawn, on the condition estimate, on the breakdown of the previous essay, the quantity that is hardest to detect is the one whose absence does the most damage.
And the direction is not the eigenvector
The certificate proves indefiniteness and it does not deliver λ_min. Its Rayleigh quotient recovers between eleven and forty-two per cent of the negative eigenvalue across the eight spectra above, with no obvious pattern in which.
That is the honest reading and it is enough. A trust-region method does not need λ_min; it needs a direction of descent that the model does not bound, and any direction with negative curvature is one. Getting λ_min as well would cost the full eigenvalue problem, which is the thing the whole approach exists to avoid.
What the site’s own guard was doing
The guard in this collection’s conjugate gradient routine is worth quoting against itself, because it is a small, correct, and complete example of the mistake this essay is about.
It tests whether pᵀAp is positive, and if it is not it sets a flag and returns. The flag is called
breakdown; the comment beside it says the method has no step to take. Every word of that is true.
What it does not do is keep the vector.
The vector is right there — it is p, the direction the loop was about to divide by — and by the time the flag has been set and the function has returned, it is gone. Recovering it costs another run of the whole iteration. Keeping it costs one array reference.
That asymmetry is why this essay exists rather than a note in a source comment. The routine was written to solve linear systems, it does that correctly, and the information it discards is worthless for that purpose and is the entire answer to a different question. Nothing about the code is wrong. What is missing is a return value, and nothing in the way the routine is tested could have said so: every assertion on it is about the solution it produces on matrices where it produces one.
The same matrix, asked a different question
Put the certificate beside what a different method does with the identical system and the point of this essay is a comparison rather than a claim.
MINRES solves the same Ax = b on the same indefinite A. It builds the same Krylov space by the same products. It never forms pᵀAp at all — it minimises the residual over the space rather than the A-norm of the error, and nothing anywhere in it requires A to be definite. So it never meets the event, and on the matrix at the top of this essay it returns the solution in thirty-seven steps at a relative residual of 2.4·10⁻¹⁴.
Conjugate gradients on the same matrix stops after six products with a residual nowhere near zero and a vector.
Both are right. They were asked different questions. One was asked for the solution of a linear system, which exists — A is nonsingular — and it produced it. The other was asked to minimise a quadratic, which has no minimum, and it produced the proof that there is none. The breakdown belongs to the question rather than to the matrix.
That reading has a consequence worth stating for anybody choosing between them. If the system is genuinely a linear system and A merely happens to be indefinite, conjugate gradients is the wrong method and MINRES is the right one, and the “breakdown” is the method correctly declining a problem it does not solve. If the system is a Newton system, MINRES is the wrong method: it will happily return the stationary point of a model that has no minimum, which is a saddle, and the caller will step to it.
What following it is worth
The direction on its own is unbounded, so a trust-region method bounds it: minimise the model inside a ball of radius Δ, and follow the negative-curvature direction to the boundary of that ball. Steihaug’s method is conjugate gradients with two extra tests — one for leaving the ball and one for the curvature — and it stops at whichever happens first.
The question is what that cheap step gets compared with solving the trust-region subproblem exactly, which needs a full symmetric eigendecomposition and a secular equation solved in the shift.
At Δ = 0.25 the truncated iteration gets 89.2 per cent of the exact decrease for two matrix–vector products. The share falls monotonically as the region grows — 84.9, 76.1, 53.6, 48.1, 42.9 — and at Δ = 16 it is 36.9 per cent. Every stop costs at most six products.
The shape of that curve is the argument for the method and it is worth reading carefully, because both ends matter.
At a small radius it is nearly exact. That is where a trust-region method spends its time when it is in trouble: the radius shrinks precisely when the model has been a poor predictor, and it is exactly then that the cheap step loses almost nothing.
At a large radius it is well short. When the region is generous the truncated path is a conjugate-gradient path with a stopping rule bolted on, and it does not curve the way the exact solution curves. A method that spent most of its time at large radii would be leaving half the available decrease on the table.
And the reason for stopping changes across the sweep. Below Δ = 4 the step is stopped by the ball; above it, by the curvature. That crossover moves with the negative eigenvalue: a very negative one is met immediately and the curvature stops every step, while a tiny one is met after the boundary has already been reached.
What it does not certify
Two things the direction does not prove, and both are worth being explicit about because the word certificate invites over-reading.
It does not say how many negative eigenvalues there are. One direction with negative curvature proves at least one, and that is all. A matrix with three negative eigenvalues and a matrix with one produce the same kind of object, and distinguishing them needs an inertia count — which is a factorisation, and is the thing the whole approach was avoiding.
And it does not certify a direction of descent for the function, only for the model. The quadratic is a local approximation, the direction is unbounded below in the approximation, and how far along it the real function keeps falling is a question the model cannot answer. That is exactly what the trust region is for, and it is why the two halves of this essay are one essay: the certificate is what makes the step possible and the radius is what makes it meaningful.
Where the test can be wrong
Everything above assumes the sign of pᵀAp is the sign of pᵀAp. In floating point it is the sign of a computed inner product, and an inner product whose true value is smaller than its own rounding error has a sign that means nothing.
The condition for that is exactly the condition for a Rayleigh quotient to be lost: the quotient is about λ_min, the rounding in the dot product is about u·‖A‖, so the sign is unreliable once λ_min/λ_max falls below about u·n. At double precision that requires a condition number past 10¹⁵, which is contrived. At the precisions the hardware is moving towards it is not, and the last essay of this collection’s current run measures exactly where.
The practical form of the caution is short: a certificate should be verified in the precision the claim is made in. The vector costs one product to check, the check is independent of the iteration that produced it, and a certificate that fails its own check is a rounding error rather than a proof. That is why the direction is worth returning as a vector rather than as a boolean, and it is the strongest argument for this whole framing: a report cannot be re-checked and an object can.
The cost of not looking
The alternative to all of this is the one most codes take, and it is worth pricing rather than disparaging.
Modify the Hessian until it is positive definite — add a multiple of the identity, or replace the negative eigenvalues by their absolute values, or run a modified Cholesky that adds to the diagonal whenever a pivot comes out non-positive — and then solve. The result is a descent direction, the solver never meets the event, and nothing in the code has to know what indefiniteness is.
What it costs is the direction. A modified Hessian’s Newton step points somewhere sensible and it does not point along the negative curvature, so the method walks away from a saddle at the rate a gradient method walks rather than at the rate the curvature offers. On a problem whose saddles are the interesting feature — which is most non-convex problems of any size — that is the difference between escaping in a few iterations and escaping in many.
The measured version of the same trade is the trust-region curve above: 89 per cent of the exact decrease at a small radius, for two products. A modified-Cholesky step is not on that curve at all, because it is answering the question the model has no answer to by changing the model.
The two meanings, once more
Three essays and three zeros. The first was an object arriving: the Krylov space closed and the answer was inside it. The second was an object failing to arrive: two sequences lost contact and there was no next term. This one is neither — the quantity that changes sign is not a divisor whose vanishing ends a recurrence, it is a measurement of the problem, and what it says is that the problem is not the one the method was written for.
What the three have in common is the shape this collection keeps meeting: the number that stops the method carries information that the method’s own output does not, and whether that information is good news, bad news or a different question entirely is not visible in the number.
The refusal
The assertion behind this essay is fed the claim that a certificate of negative curvature exists on a matrix built to be positive definite.
It is the failure that would make everything above worthless, and it is not far-fetched: it is what happens when the sign of a rounded inner product is read as a fact about the matrix. A routine that accepted it would be manufacturing proofs, and the whole value of the direction as a certificate rests on the claim that a routine which reports one has found one.
The second refusal beside it is smaller and belongs to the trust-region half: a subproblem posed with a region of radius zero, where the model decrease is exactly zero and any share of it is a division by zero. Both are cases where a number comes back that has the right type and no meaning.
What is next
The three essays so far have all been about one matrix. The next three are about problems with two — Ax = λBx — where the zero moves into the second matrix and takes an eigenvalue with it, and where a problem can turn out to have no answer at all while every routine that is asked returns one.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Deciding that a zero has arrived — both name certificate, krylov subspace, negative curvature
- A parameter that counts steps — both name conjugate gradients, krylov subspace
- A rate that is known in advance — both name conjugate gradients, krylov subspace
- An eigenvalue that arrives twice — both name eigenvalues, krylov subspace
- An orthogonalisation nobody calls one — both name conjugate gradients, krylov subspace
- Changing the condition number on purpose — both name cholesky, conjugate gradients
Named objects
A flat tag is an object no other essay names yet.
CertificateCholeskyConjugate gradientsEigenvaluesIndefinite matrixKrylov subspaceMinresNegative curvatureTrust region