Sparsity, and what elimination costs

The column that was never fixed

Every threshold-pivoting measurement so far chose the pivot row in a fixed column, and the routine's own description said that choosing the column as well would change the constants and not the argument. Measured, it changes the argument. On the 8×8 conflict grid the factor shrinks from 875 entries to 640 at the library default, and the growth factor that climbed to 2,209 as the threshold loosened stays at 2.54 at every threshold from 0.3 down to 0.001. What does most of the work is not the column but which of several equally cheap entries is taken — and on random sparse matrices, choosing the column without that makes the growth worse.

Worth reading first: Structure and stability stop being separable.

A threshold between fill and growth measured one number deciding how small a pivot a sparse elimination will accept. On a convection grid with one ruinous corner entry, a threshold of 0.001 gave a small factor and a growth factor over a thousand, a threshold of 1 gave a large factor and growth near one, and the libraries’ default of 0.1 sat at most of both. The trade was the argument, and every essay on sparse pivoting since has been built on it.

Every one of them measured it with a rule that chooses rows only. At each step the column is the next one in order, and the rule takes the sparsest row whose entry in that column is at least τ times the column’s largest. The routine’s own description said so, and said in the same sentence that real codes choose the column too, “and doing so changes the constants and not the argument”.

That sentence was never measured. It is wrong in an informative way.

Fill and growth against the pivot threshold, choosing rows only and choosing rows and columns, on the 8×8 conflict gridThe 8×8 convection grid with a corner diagonal of 10⁻¹², 64 unknowns and 288 entries, factorised with threshold pivoting at τ from 0.001 to 1, on logarithmic axes. Dashed: the sparsest acceptable row in a fixed column. Solid: the entry anywhere in the active matrix with the least Markowitz cost among those within τ of their column's largest. Growth factor in red, entries of L + U over entries of A in blue. τ 0.001: rows only 741 entries, growth 2210; rows and columns 640, 2.54; τ 0.003: rows only 771 entries, growth 585; rows and columns 640, 2.54; τ 0.01: rows only 798 entries, growth 153; rows and columns 640, 2.54; τ 0.03: rows only 817 entries, growth 31.3; rows and columns 640, 2.54; τ 0.1: rows only 875 entries, growth 38.5; rows and columns 640, 2.54; τ 0.3: rows only 896 entries, growth 4.08; rows and columns 640, 2.54; τ 1: rows only 986 entries, growth 1.2; rows and columns 659, 1.23.10⁻³10⁻²10⁻¹1110¹10²10³10⁴pivot threshold τgrowth factor · entries in L + U ÷ entries in Agrowth, rows onlygrowth, rows and columnsfill ratio, rows onlyfill ratio, rows and columns8×8 grid, 64 unknowns, 288 entriesτ = 0.001: rows only — 741 entries; growth2209τ = 0.001: rows and columns — 640 entries; growth2.5τ = 0.1: rows only — 875 entries; growth38τ = 0.1: rows and columns — 640 entries; growth2.5τ = 1: rows only — 986 entries; growth1.2τ = 1: rows and columns — 659 entries; growth1.2dashed: a fixed column · solid: the column chosen toothe same threshold rule in both
Fig. 1 The 8×8 conflict grid, 64 unknowns and 288 entries. Growth factor (red) and entries of L + U over entries of A (blue) against the pivot threshold on logarithmic axes; dashed for the rule that fixes the column, solid for the rule that chooses it. The dashed growth climbs three decades as τ falls. The solid growth does not move.

The Markowitz rule, stated

Choosing rows and columns together is the Markowitz rule with a threshold. At every step it looks at every entry of the part of the matrix still to be eliminated. An entry is acceptable if it is at least τ times the largest entry in its own column. Among the acceptable entries it takes the one with the least Markowitz cost (r − 1)(c − 1), where r and c count the nonzeros in the entry’s row and column — the most new entries eliminating it could create. The row and the column are both moved to the front, so the factorisation is PAQ = LU rather than PA = LU.

The row-only rule is the same rule with the column fixed at the next index, and the implementation measured here is the same code with that one restriction, checked against the original row-only routine on every matrix and threshold: the same fill and the same growth factor to nine digits. So everything that differs below is the column choice and one other detail that turned out to matter more.

What the column buys on the conflict grid

At τ = 0.1 on the 8×8 grid the row-only rule builds a factor of 875 entries with growth 38.5. The row-and-column rule builds 640 entries with growth 2.54. At τ = 0.001 the row-only rule has 741 entries and growth 2,209; the row-and-column rule, 640 and 2.54 again. At τ = 1 the row-only rule has 986 entries and growth 1.20; the other, 659 and 1.23.

Read along the thresholds, the solid curves are flat. The row-and-column rule’s factor holds between 640 and 659 entries at every threshold, and its growth factor is 2.54 at every threshold from 0.3 to 0.001 and 1.23 at 1. There is no trade left to make. The threshold that decided the row-only rule’s fate in both currencies decides almost nothing once the column is free, and loosening it costs nothing because the rule never takes the small pivots the loose threshold would allow.

The size of every pivot the elimination accepted, relative to the largest entry in its column, with rows only and with rows and columns chosenThe 8×8 conflict grid at threshold 0.001: for each of the 64 elimination steps, the accepted pivot's magnitude divided by the largest entry in its column of the active matrix, on a logarithmic axis. Row-only pivoting's smallest is 0.00105, and 42 of its pivots are under a tenth of their column's largest; row-and-column pivoting's smallest is 0.333, with 0 under a tenth.-171523313947556310⁻³10⁻²10⁻¹1elimination steppivot ÷ largest entry in its columnthe threshold, 0.001○ rows only■ rows and columns8×8 grid, τ = 0.001rows only: smallest pivot ÷ its column's largest0.0011rows only: pivots under a tenth of their column's largest42rows and columns: smallest pivot ÷ its column's largest0.33rows and columns: pivots under a tenth0a pivot at 1 is the largest in its columnthe threshold allows anything above the line
Fig. 2 The 8×8 grid at τ = 0.001. For each of the 64 elimination steps, the accepted pivot divided by the largest entry in its column. Open circles: rows only. Squares: rows and columns. The threshold is the dashed line at 0.001.

The pivots show why. At τ = 0.001 the row-only rule accepts a pivot as small as 0.0011 of its column’s largest entry, and 42 of its 64 pivots are under a tenth. It is not doing anything wrong: in a fixed column the sparsest acceptable row is often one whose entry is small, and the threshold permits it. The row-and-column rule’s smallest pivot is a third of its column’s largest, and none is under a tenth. With every column of the remaining matrix to choose from, there is almost always an entry that is both as cheap as the cheapest and large in its column, and the rule finds it.

What happened to the ruinous corner

The conflict grid was built so that the cheapest elimination at the first step — the corner node, with two neighbours — has a diagonal entry of 10⁻¹². Structure and stability stop being separable showed what taking it costs. Neither rule measured here takes it; both are thresholded. What they do instead differs, and it is not where one would guess.

The row-only rule, forced to eliminate column 0 first, takes the corner’s neighbour as the pivot row — an ordinary coupling entry of −1.5 — and then must eliminate column 1, then column 2, in the grid’s own order, each time taking the sparsest acceptable row in a column it did not choose. The corner is handled safely at step 0. The growth comes afterwards, from the columns the fixed order hands it.

The row-and-column rule eliminates the three other corners first, each on its own diagonal at a cost of four. At the fourth step it eliminates the ruinous corner’s column, pivoting on the same coupling entry of −1.5 in the row below it. The corner’s own row is not eliminated until step 35, by which time an earlier elimination has filled its diagonal with an ordinary number: the pivot it is finally eliminated on is −2.60.

So the tiny entry was never the difficulty either rule had to solve. The difficulty for the row-only rule was the order of the columns — a fixed order that is fine for the corner and poor for the rest of the grid.

The factors of the 6×6 conflict grid at τ = 0.1, choosing rows only and choosing rows and columnsTwo sparsity patterns of L + U for the 36-unknown conflict grid at threshold 0.1, with the entries the factorisation added marked apart from those the matrix already had. Rows only: 372 entries, growth 38.5. Rows and columns: 298 entries, growth 5.4. The matrix has 156.rows only372 entries, growth 38.5rows and columns298 entries, growth 5.4filled marks: entries the factorisation addedthe matrix has 156
Fig. 3 The factors of the 6×6 conflict grid at τ = 0.1, with the entries the factorisation created marked apart from those the matrix already had. The row-only factor fills in broad dense bands; the row-and-column factor’s fill is scattered and mostly at the end.

The patterns make the fill difference visible. The row-only factor of the 6×6 grid has 372 entries with growth 38.5 at τ = 0.1: the lexicographic column order builds dense bands of fill that grow toward the bottom right, the familiar profile of a band-ordered grid. The row-and-column factor has 298 entries with growth 5.40, and its fill is concentrated in the last dozen rows — the pattern of an elimination that took the cheapest entries first, as a minimum-degree ordering would, while checking each against its column — the ordering the order decides the memory found beating the orderings with better asymptotics on a matrix of this kind. An ordering that does not wait for the numbers found a family where the ordering could be chosen for fill alone; this is the unsymmetric case doing something similar dynamically.

The size of the grid

Fill and growth against the size of the conflict grid at τ = 0.1, choosing rows only and rows and columnsConflict grids of 4×4 to 10×10 at τ = 0.1, on logarithmic axes against the number of unknowns: the growth factor and the entries of L + U over the entries of A, for row-only and row-and-column threshold pivoting. 4×4: rows only 111/64, growth 7.3; rows and columns 99, 2.43; 5×5: rows only 217/105, growth 38.5; rows and columns 179, 1; 6×6: rows only 372/156, growth 38.5; rows and columns 298, 5.4; 7×7: rows only 575/217, growth 38.5; rows and columns 455, 2.54; 8×8: rows only 875/288, growth 38.5; rows and columns 640, 2.54; 9×9: rows only 1223/369, growth 38.5; rows and columns 897, 2.54; 10×10: rows only 1635/460, growth 38.5; rows and columns 1170, 2.54.10²110¹10²unknownsgrowth factor · entries in L + U ÷ entries in A162536496481growth, rows onlygrowth, rows and columnsfill ratio, rows onlyfill ratio, rows and columnsdashed: a fixed column · solid: the column chosen tooτ = 0.1
Fig. 4 Conflict grids from 4×4 to 10×10 at τ = 0.1: growth and fill ratio against the number of unknowns, row-only dashed and row-and-column solid.

From 5×5 upward the row-only rule’s growth at τ = 0.1 is 38.5 on every grid, to three digits; the row-and-column rule’s is 1.00, 5.40 and then 2.54 on every grid from 7×7 to 10×10. The fill ratio grows with the grid under both rules, as fill in a two-dimensional grid must, and the gap between them widens: 111 against 99 entries on the 4×4 grid, 1,635 against 1,170 on the 10×10. By the largest grid the row-only factor is 40 per cent bigger.

The constant 38.5 is itself worth a sentence. A growth factor that does not change with the size of the problem is a property of a local pattern the fixed column order meets on every grid — the same few rows in the same arrangement near one boundary — and not of the problem’s size. It is what the row-only rule pays for being made to take the columns in an order it did not choose.

The tie-break, which does the rest

Implementing the rule exposed a detail that the description above passed over. Markowitz costs are products of small integers, so many candidates tie. The row-only routine took the earliest row among equally cheap candidates. The row-and-column implementation took the one whose entry was largest relative to its column. Those are two changes, not one, and they can be separated.

Growth under four threshold-pivoting rules — rows only or rows and columns, ties to the earliest or to the largest entry — at two thresholdsFor twenty random sparse 40 × 40 matrices (bars: median growth; ticks: worst) and for the 8×8 conflict grid (diamonds), at τ = 0.1 and 0.001, on a logarithmic axis, under four rules. τ 0.1: rows only, earliest on a tie — random median 15.1, worst 155, fill 246; grid 38.5, 875 entries; rows only, largest on a tie — random median 9.7, worst 91.7, fill 253; grid 12, 850 entries; rows and columns, earliest on a tie — random median 24.8, worst 195, fill 113; grid 2, 639 entries; rows and columns, largest on a tie — random median 5.69, worst 57.5, fill 115; grid 2.54, 640 entries. τ 0.001: rows only, earliest on a tie — random median 560, worst 54500, fill 215; grid 2210, 741 entries; rows only, largest on a tie — random median 190, worst 9780, fill 214; grid 1540, 761 entries; rows and columns, earliest on a tie — random median 694, worst 2.2·10⁵, fill 109; grid 21.9, 639 entries; rows and columns, largest on a tie — random median 150, worst 1260, fill 110; grid 2.54, 640 entries.growth factor110¹10²10³10⁴10⁵10⁶τ = 0.1rows only, earliest on a tiemedian fill 246, grid 875rows only, largest on a tiemedian fill 253, grid 850rows and columns, earliest on a tiemedian fill 113, grid 639rows and columns, largest on a tiemedian fill 115, grid 640τ = 0.001rows only, earliest on a tiemedian fill 215, grid 741rows only, largest on a tiemedian fill 214, grid 761rows and columns, earliest on a tiemedian fill 109, grid 639rows and columns, largest on a tiemedian fill 110, grid 640bar: random median · tick: random worst · diamond: conflict gridlog scale
Fig. 5 Four rules — rows only or rows and columns, ties to the earliest or to the largest — at τ = 0.1 and 0.001. Bars: median growth over twenty random sparse 40 × 40 matrices, with the worst as a tick. Diamonds: the 8×8 conflict grid.

On the conflict grid, each change helps and together they do all of it. At τ = 0.001 the row-only rule with earliest ties has growth 2,209; with largest ties, 1,545; the row-and-column rule with earliest ties, 21.9; with largest ties, 2.54. The column choice takes the first two decades and the tie-break the last one.

On random sparse matrices the two changes do not add, and one of them is harmful alone. At τ = 0.1 the median growth is 15.1 for rows only with earliest ties, 9.7 with largest ties, 24.8 for rows and columns with earliest ties, and 5.7 for rows and columns with largest ties. At τ = 0.001 the row-and-column rule with earliest ties has a worst case of 217,000, four times the row-only rule’s worst. Choosing the column without looking at magnitude gives the rule many more cheap candidates to choose among and nothing to prefer the safe ones by, and on a matrix with no structure the earliest cheap candidate is as likely to be small as large.

The fill is a different matter. Whichever way ties are broken, the row-and-column rule’s median fill on the random matrices is 109 to 115 against the row-only rule’s 214 to 253: the column choice halves it, and the tie-break does not move it. So the two halves of the argument come apart cleanly. Fill is bought by the column choice. Growth is bought by the tie-break, and the column choice only makes the tie-break more valuable.

A search for size that costs nothing

The tie-break is a search for a large pivot, and searches for large pivots have been measured before. A pivot that searches one row and one column measured rook pivoting on dense matrices: walk from a column’s largest entry along its row to a larger one and back, until an entry is largest in both, and the growth factor falls from partial pivoting’s 4.06 to 2.53 at a cost of about three times the comparisons. Complete pivoting, which searches everything, reaches 1.88 at forty times the comparisons.

The magnitude tie-break is a search of the same kind with a different budget. It does not look for the largest entry anywhere; it looks among the entries that are already the cheapest by Markowitz cost and already pass the threshold, and it takes the largest of those relative to its column. The comparisons are ones the rule was making anyway — it had to compute every candidate’s cost and ratio to know which were cheapest and acceptable — so the search is free. What it cannot do is trade sparsity for size: a large entry with one more nonzero in its row is never considered.

That is why its effect depends on how many ties there are. On the conflict grid, whose interior rows and columns all have the same counts, a step can have dozens of candidates at the minimum cost, and the tie-break is choosing the largest of dozens. On a random sparse matrix with varied counts the minimum cost is shared by fewer entries, and the tie-break is choosing among a handful. That it still cuts the random matrices’ median growth by a factor of two to four suggests that even a handful of equally cheap candidates rarely all have small entries.

It also explains the one harmful combination. Freeing the column multiplies the number of cheap candidates. With a magnitude tie-break that is more choice among safe entries; with a positional tie-break it is more opportunities to take the first small entry that passes the threshold, and the threshold at 0.1 or 0.001 lets through entries that the swap that is not optional would recognise as the start of the trouble.

On matrices with no structure

Growth against the pivot threshold over random sparse matrices, choosing rows only and rows and columnsTwenty random 40 × 40 matrices with a nonzero diagonal and 8% off-diagonal density, factorised at τ = 1, 0.1, 0.01 and 0.001, on logarithmic axes: the median and worst growth factor, and the median fill, for each rule. τ 1: rows only fill 457, growth 1 (worst 2.2); rows and columns fill 188, growth 1 (worst 1.24); τ 0.1: rows only fill 246, growth 15.1 (worst 155); rows and columns fill 115, growth 5.69 (worst 57.5); τ 0.01: rows only fill 218, growth 162 (worst 889); rows and columns fill 111, growth 43.7 (worst 586); τ 0.001: rows only fill 215, growth 560 (worst 54500); rows and columns fill 110, growth 150 (worst 1260).10⁻³10⁻²10⁻¹1110¹10²10³10⁴10⁵pivot threshold τgrowth factorworst growth, rows onlyworst growth, rows and columnsmedian growth, rows onlymedian growth, rows and columnsfill 457 → 188fill 246 → 115fill 218 → 111fill 215 → 11040 unknowns, 8% off-diagonal density, twenty matricesτ = 1: median growth, rows only1τ = 1: median growth, rows and columns1τ = 0.1: median growth, rows only15τ = 0.1: median growth, rows and columns5.7τ = 0.01: median growth, rows only162τ = 0.01: median growth, rows and columns44τ = 0.001: median growth, rows only560τ = 0.001: median growth, rows and columns150median fill printed along the bottomrows only → rows and columns
Fig. 6 Twenty random sparse 40 × 40 matrices with 8% off-diagonal density, against the threshold: median and worst growth for row-only pivoting and for row-and-column pivoting with ties to the largest entry, with the median fill of each along the bottom.

On random matrices the trade the earlier essay measured is still there under both rules: growth rises as the threshold falls, from median 1 at τ = 1 to 560 and 150 at τ = 0.001. What the row-and-column rule with the magnitude tie-break changes is its price. At every threshold its fill is half the row-only rule’s — 188 against 457 at τ = 1, 110 against 215 at τ = 0.001 — and its median growth is two and a half to four times smaller. Its worst case at τ = 0.001, 1,261, is forty times smaller than the row-only rule’s 54,484.

So the docstring’s sentence is half right about random matrices and wrong about the grid. On matrices without structure the threshold still trades fill for growth and the column choice changes where the trade sits. On the structured grid the rows-only rule’s trade was an artefact of being made to take columns in a fixed order, and it vanishes when the order is free. What the symbolic phase can only bound found the fill of threshold pivoting to be unpredictable before the numbers arrive; a rule that chooses columns dynamically makes it more so, since both permutations now depend on the values.

What codes do, and what this says about it

Production unsymmetric sparse solvers do choose both. They search a small number of the sparsest columns rather than all of them, and they break ties among candidates of equal cost in various ways, commonly by magnitude. The measurement here says the second choice is not a detail. A rule that chooses columns and breaks ties by position can be less stable than a rule that chooses rows only; a rule that chooses columns and breaks ties by magnitude is both sparser and more stable at every threshold measured.

It also qualifies the threshold essay’s finding about the default. τ = 0.1 is where the row-only rule gets most of both, and that remains true of it. Under the row-and-column rule with the magnitude tie-break, on the grid, τ matters very little, and on random matrices it matters in the same direction as before but a factor of three less. The default was justified by a trade that a better rule makes smaller.

What this rests on

Conflict grids from 4×4 to 10×10 with a drift of 0.5 and a corner diagonal of 10⁻¹²; twenty random 40 × 40 matrices with a nonzero diagonal and 8% off-diagonal density; thresholds from 0.001 to 1. The growth factor is the largest entry of any reduced matrix over the largest entry of A. The row-and-column rule searches every column at every step, which no production code does; a code searching only the few sparsest columns may find fewer large cheap candidates, and how many columns the search needs before the tie-break has something to choose among is not measured here. Every factorisation reproduces its matrix to 10⁻¹⁰ times its growth factor or better, and on the grid to 10⁻¹⁶.

The claims that have to fail

The first is the sentence in the routine’s description: that choosing columns changes the constants and not the argument. On the 8×8 grid the row-and-column rule’s growth is 2.54 at τ = 0.001 and 1.23 at τ = 1; the refusal is fed the claim that the first exceeds the second a hundredfold, as it does for the row-only rule, and fails.

The second is the natural repair of the first: that freedom to choose the column is itself what makes the pivots safer. With ties broken by position, the row-and-column rule’s median growth on random sparse matrices at τ = 0.1 is 24.8 against the row-only rule’s 15.1; the refusal is fed the claim that it is no larger, and fails.

Still open: how few columns the search needs, and the symmetric case

A search over a few columns. The rule here looks at every column. Codes look at a handful — the two or four sparsest — because a full search is quadratic per step. The tie-break’s value depends on how many equally cheap, large candidates the search can see, so the measurement to make is the growth and fill against the number of columns searched, on the grid and on random matrices, to find where the benefit saturates.

Symmetric indefinite matrices. A symmetric factorisation must permute rows and columns together, so the freedom measured here is not available: a diagonal pivot is chosen, or a two-by-two block, and the off-diagonal coupling the row-and-column rule used to step around the corner cannot be taken on its own. Whether the fixed-column rule’s trade returns for a symmetric version of the conflict grid under threshold Bunch–Kaufman pivoting, and what the two-by-two pivots cost in fill, is the case the order that was right last time and the quasi-definite family stepped around and nobody here has measured.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Fill-inGaussian eliminationGrowth factorMarkowitz costPermutationSparse LUSparse pivotingThreshold pivoting