Eight blocks and sixty-four reflections
Worth reading first: A reflection cannot stop being one · Orthogonal is a number · The same arithmetic at a different price.
A triangle where the scalar was took apart the representation every level-3 QR factorisation uses. A block of Householder reflectors is applied not one at a time but as a single matrix, , with the reflectors as the columns of and an upper triangular computed by a recurrence whose inputs are its own earlier columns. One reflection’s orthogonality rests on one computed scalar; a block of sixteen rests on 136 computed numbers. Measured on a 24 × 16 matrix, the block departed from orthogonality by 3.9·10⁻¹⁵ against the single reflector’s 7.8·10⁻¹⁶: a factor of five.
That measurement was of one block. A factorisation of a 512-column matrix in blocks of 64 is eight blocks in sequence, each built from a panel the earlier blocks have already transformed, and its orthogonal factor is their product. The essay closed on the question that decides whether the factor of five matters: do the blocks’ departures add, add in quadrature, or cancel? If they add, a factorisation of many blocks is many times worse than the measurement suggests. If they cancel, it is no worse than one.
They add in quadrature — and the consequence is that a blocked factorisation ends closer to orthogonal than an unblocked one.
A factorisation of many blocks
The measurement is the textbook blocked Householder QR. Factor a panel of columns by ordinary reflectors, one at a time, applied within the panel. Assemble the panel’s reflectors into by the recurrence. Apply to the columns to the right, and accumulate . Record after every block, and each block’s own beside it. With the same procedure is unblocked Householder, one reflection per factor.
The matrices are 96 × 64 with condition number , five of them, and every number below is the median over the five.
How eight blocks accumulate
In blocks of eight the accumulated departure is 5.4·10⁻¹⁵ after the first block, 8.1·10⁻¹⁵ after the second, 1.11·10⁻¹⁴ after the fourth and 1.42·10⁻¹⁴ after the eighth. The blocks’ own departures run from 5.4·10⁻¹⁵ for the first down to 3.2·10⁻¹⁵ for the last, because each later panel is shorter. Summed, they reach 3.29·10⁻¹⁴; their root-sum-square is 1.18·10⁻¹⁴. The accumulated departure tracks the root-sum-square from above, 1.2 times it at the end, and stays well below the sum.
That is the behaviour of independent errors. Each block’s factor is orthogonal up to a small symmetric error of its own, and the product of several such factors is orthogonal up to, to first order, the sum of their errors after each has been rotated by the factors around it. Rotations do not shrink an error and do not align it with the others, so the errors add as random vectors do: their squared sizes add. The fifth of excess over the root-sum-square is what is left of alignment between the blocks, which share a matrix and are not entirely independent.
Taken one reflector at a time, the same factorisation accumulates 64 errors instead of 8. Each reflector’s own departure is smaller — about 2.5·10⁻¹⁵ at the start and 1.5·10⁻¹⁵ at the end — but there are eight times as many, and the product ends at 2.91·10⁻¹⁴, twice the blocked factorisation’s.
Why the square root
The quadrature law can be written down in two lines, and writing it down says what could break it. Let each block’s computed factor be , where is exactly orthogonal and is small. Then to first order, which is the block’s own departure. The product of eight such factors is times a correction, and to first order
a sum of the blocks’ own departures, each rotated by the exact factors that come after it. A rotation changes no norm, so each term is as large as its block’s own departure. What decides the size of the sum is whether the terms point the same way. Terms that were produced by different roundings, in different panels, and then rotated by different products have no reason to align, and a sum of unaligned terms of size has size about , not .
So the law would fail for errors that are systematically aligned — a rounding mode that always biased in one direction, say, or a construction in which every block saw the same panel. Neither is the case here, and the measured factor of 1.2 above the root-sum-square is the small alignment that remains.
Fewer, larger factors
The comparison generalises across block sizes, and the two effects it balances can be read separately.
One block’s own factor departs by a median of 2.0·10⁻¹⁵ at a block of one, 3.1·10⁻¹⁵ at four, 4.3·10⁻¹⁵ at eight, 5.4·10⁻¹⁵ at sixteen, 9.6·10⁻¹⁵ at thirty-two and 1.4·10⁻¹⁴ at sixty-four, where a single block is the whole factorisation. Quadrupling the block multiplies its departure by one and a half to two and a half. The whole factorisation is the product of of them and departs by 2.91·10⁻¹⁴ unblocked, 1.66·10⁻¹⁴ at four, 1.42·10⁻¹⁴ at eight, 1.24·10⁻¹⁴ at sixteen, 1.27·10⁻¹⁴ at thirty-two and 1.39·10⁻¹⁴ at sixty-four.
If each factor contributes independently, the total goes as the square root of the number of factors times the departure of one. The number of factors falls as and the departure of one rises, very roughly, as , so the product should go as , which is flat — and the measured total is nearly flat above a block of eight, with a shallow minimum at sixteen. Below eight the total rises because the departure of one factor stops falling: a single reflector is not free, and 64 of them in quadrature cost more than eight blocks.
So the factor of five the earlier essay measured is real and is paid per block, and a factorisation pays it fewer times than the unblocked factorisation pays its own smaller price. Blocking was adopted for speed — the essay on the triangle priced it at matrix–matrix products instead of matrix–vector ones, and a block size is a property of the machine showed how the best width is set by the fast memory rather than by the matrix — and on this measurement it also buys a factor of two in orthogonality, at every width a machine is likely to choose.
Signs that do not agree
There is a smaller version of the same fact one level down, in the quantity being measured. Orthogonal is a number made the site’s measure of orthogonality: the entries of are inner products of computed columns, and the departure is the size of how far they are from zero and one. An inner product with no fixed sign looked at those entries across ten ways of partitioning one computation and found 125 of 1,128 off-diagonal entries taking both signs, while the total moved by only 2.4 per cent: the entries are rounding, and rounding has no preferred sign.
The quadrature law between blocks is that observation at the scale of whole factors. Each block contributes a matrix of small errors whose entries have no preferred sign, and eight such matrices, rotated by different products, overlap in their signs about as often as not. Where two blocks’ errors reinforce in one entry they cancel in another, and the total grows as the square root of the count. The unblocked factorisation is sixty-four such contributions. Counted alone, at the square root, eight times as many terms would make it 2.8 times the blocked total if each were as large as a block’s; each is in fact about half as large, which predicts 1.3. It ends at 2.05 times, because its sixty-four errors are more aligned than eight blocks’ are — its total is 1.7 times their root-sum-square where the blocks’ is 1.2. Why single reflections align more is not isolated here; the likeliest reason is that successive reflections share more of their arithmetic than successive blocks do, and what they share, they round alike.
How many numbers the guarantee rests on
The earlier essay counted the numbers that have to be right: one scalar per reflection, per triangle. Counted over the whole factorisation, the blocked form rests on more of them, not fewer. Sixty-four reflections carry 64 scalars. Eight blocks of eight carry eight triangles of 36, 288 numbers. Four blocks of sixteen carry 544, and one block of sixty-four carries a triangle of 2,080.
And the whole factorisation’s departure falls as those counts rise, from 2.91·10⁻¹⁴ on 64 numbers to 1.24·10⁻¹⁴ on 544. The count of computed numbers was a natural thing to worry about and it is the wrong measure. What matters is how many independent factors the errors are committed in, because each factor’s error is one term in the quadrature sum, and a triangle’s 36 numbers produce one term, not 36.
The same arithmetic runs through the same arithmetic at a different price, which found a blocked and an unblocked elimination performing the same 72,568 operations associated differently. Association is also what decides the rounding: the blocked factorisation groups its operations into eight factors and the unblocked into sixty-four, and the rounding follows the grouping.
Independent of the conditioning
The totals do not depend on the matrix. Blocks of eight end between 1.37·10⁻¹⁴ and 1.42·10⁻¹⁴ at condition numbers from to ; one reflector at a time, between 2.78·10⁻¹⁴ and 2.98·10⁻¹⁴. That is the property a reflection cannot stop being one established for a single Householder QR — its orthogonality is a property of how the factor is built, not of the matrix it is built from — and it survives blocking whole. A modified Gram–Schmidt factorisation of the same matrices would lose orthogonality in proportion to the condition number, and none of the blocked forms here do.
A triangle with entries of 10²⁶
The earlier essay’s other open question was about the triangle itself. The recurrence solves against its own earlier columns, whose diagonal holds the reflectors’ scalars , and nothing makes the βs comparable to each other. A reflector whose is small has a large β. A block containing a nearly dependent column — one that is almost a combination of the columns before it — should produce such a reflector, since what is left of the column after the earlier reflectors have acted is small. Whether that makes badly conditioned, and the block’s departure worse, was the measurement it asked for.
The triangle does blow up, exactly as predicted. With the fourth column of a well-conditioned matrix set to the third plus ε times a random vector, the largest entry of the first block’s is 86 at ε = 10⁻², at 10⁻⁶, at 10⁻¹⁰ and at 10⁻¹⁴ — growing as , the square of the small residual’s reciprocal. The orthogonality does not move. The first block’s own departure is between 4.0·10⁻¹⁵ and 5.4·10⁻¹⁵ at every ε, and the whole factorisation’s between 1.33·10⁻¹⁴ and 1.45·10⁻¹⁴.
The reason is a scale invariance. A Householder reflection is unchanged if is multiplied by any and β divided by : the reflection depends only on the direction of . So is the compact form: multiplying a column of by and the corresponding row and column of by leaves exactly the same. A tiny with a huge β is a unit vector with a moderate β, written in different units. The triangle’s entries are large because its reflector is small, and they are large in exactly the proportion that cancels in the product. What must be right is not the size of ’s entries but their relative accuracy, which is what one number that has to be right found for the single scalar: a relative error of in β costs the orthogonality , and a huge β computed to working precision costs nothing.
This does depend on the implementation computing β consistently with , as from the stored . A code that normalised to have a unit first component, as LAPACK does, would store a different pair — and the scale invariance says it would make no difference to the product, which is the point.
What changes in the account of blocking
The earlier essay’s summary was that blocking moves the guarantee from a structure to a recurrence: a block of sixteen rests on 136 computed numbers, and they cost a factor of five. Both halves stand. What the factorisation adds is that the cost is a per-factor cost, that factors accumulate in quadrature, and that a blocked factorisation has fewer factors. The trade was presented as speed against a small loss of orthogonality; measured on whole factorisations, it is speed and a small gain.
Block Gram–Schmidt makes an instructive contrast. A stable block is not a stable basis found that orthogonalising inside each block with Householder does not save a block Gram–Schmidt factorisation, because the blocks are orthogonalised against each other by projections whose error grows with the conditioning. The Householder factorisation’s blocks are joined by multiplication of near-orthogonal factors, which is why they accumulate in quadrature rather than in proportion to κ. The block is not what makes a factorisation stable; the way blocks are combined is.
It also sharpens what a code could check, which the earlier essay proposed: after assembling each block, test against a few units of roundoff times . A block that fails has a triangle wrong in relative terms, which is the only way it can fail; a block whose triangle is merely huge passes, correctly.
What this does not settle
One shape of matrix, 96 × 64, and Gaussian-built matrices of prescribed conditioning. The block’s own departure grows with the length of the panel as well as its width, and a tall matrix — 10,000 × 64 — would change the per-factor cost without changing the number of factors. The quadrature law should survive; the location of the shallow minimum over block sizes need not. Nor is the alignment that puts the unblocked factorisation at 1.7 times its root-sum-square, against the blocked one’s 1.2, explained by anything measured: it is the one number in the comparison that a different matrix family could move, and the comparison’s factor of two rests partly on it.
The departures are of the accumulated formed explicitly. A code that never forms , and applies the stored blocks to vectors instead, commits the errors in a different order, and the orthogonality of that implicit is not the same number. The earlier essay listed the applied form’s departure as the measurement a library would want, and it is still not made.
Still open: the applied form, and blocks of blocks
The factor never formed. Most uses of a QR factorisation apply or to vectors through the stored pairs and never form . The departure that matters there is how far is from for the applied operator. Whether that operator’s departure follows the same quadrature law as the formed matrix’s — it is the same product, applied in a different association — is the measurement that would carry this result into what libraries do.
Recursive blocking. High-performance codes block recursively: a panel is itself factored in blocks, and the triangles are merged. Each level adds a recurrence and multiplies the numbers that must be right, and each level also reduces the count of factors at the level above. Whether the quadrature law makes recursion a further gain in orthogonality, or whether the merged triangles cost more than they save, is a question the same instrument can answer at a few levels.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A reduction that changes the order — both name householder reflection, orthogonality, qr factorisation
- A rule that is correct and unusable — both name backward error, flop count, unit roundoff
- One minus a leverage is a subtraction — both name householder reflection, qr factorisation, unit roundoff
- The factor a sparse code keeps anyway — both name householder reflection, qr factorisation, unit roundoff
- The residual the solution cannot hold — both name householder reflection, qr factorisation, unit roundoff
- The right-hand side as one more column — both name householder reflection, orthogonality, qr factorisation
Named objects
A flat tag is an object no other essay names yet.
Backward errorBlockingFlop countHouseholder reflectionMatrix multiplicationOrthogonalityQR factorisationUnit roundoff