Two errors, and whose fault they are

A second small value costs the sign nothing

A determinant's sign computed by LU was found to fail only where the value's relative error reaches one, 45 to 51 bits from singular on a matrix one rank short. Give the matrix a second small singular value and the determinant shrinks by twice as many bits, and the prediction was that the sign would therefore fail at about half the distance, near 24 bits, because a condition number sees only one small value. It fails at 48 bits at order 4 with one small value and at 48 with two, and at 45 with three. The determinant loses one, two and three bits for every bit of distance; the value's error and the condition number lose one, whatever the count. The condition number was seeing exactly what the sign depends on, and the determinant's size was the wrong scale to read it on.

Worth reading first: The number that decides nothing · Orthogonal is a number · The same arithmetic at a different price.

The sign is the last digit to go took integer matrices one rank short, perturbed one row at a relative size 2−d2^{-d}, and computed the determinant by LU with partial pivoting against an exact reference. The value lost a decimal digit every 3.3 bits of distance, as a condition number says it should, and the sign held until the last digit went: right on every draw out to 45 bits at order 4, wrong on three draws of forty at 48. A sign is wrong exactly when the value’s relative error reaches one, and that is the only way it can be.

The essay then asked what happens with more than one small singular value. Give the matrix two, each at a distance of 2−d2^{-d}, and the determinant, as the product of the singular values, shrinks by twice as many bits. A condition number, being the ratio of the largest singular value to the smallest, sees only one of them. So the prediction with a sign was that the sign would still fail only where the value’s relative error reaches one, but that this would happen at about half as many bits of distance as before, near 24 at order 4, and that the crude bound used to certify signs would move by less, shrinking the window in which the sign is right but cannot be certified.

The first half holds. The rest of it is wrong, and wrong in a way that turns the reasoning around: the condition number was not undercounting. It was counting the right thing.

Matrices one, two and three ranks short

The construction generalises the earlier one. A matrix of order nn that is ss ranks short has n−sn - s rows of random integers of about 2202^{20}, and ss rows that are small integer combinations of those, each with its own random perturbation of relative size 2−d2^{-d}. So there are ss singular values near 2−d2^{-d} times the others. Orders 4, 6 and 8 are used, with ss of one, two and three, and dd from 6 to 51 in steps of three, forty draws at each. Beyond 51 bits the perturbation is smaller than the spacing of entries of 2202^{20} and is lost when the matrix is stored, so the stored matrix is exactly singular and every count is left out there. Every entry is a double, so the exact determinant is the determinant of a matrix of integers over a power of two and fraction-free elimination returns it exactly. The computed determinant is the signed product of the pivots of one LU in binary64. The bound is the earlier essay’s, unchanged: four times n2un^2 u, times the growth, times the largest entry, times the product of every pivot but the smallest.

At order 4 with two small singular values, over forty draws at each relative distance from singular: the share whose determinant from LU has the wrong sign, and the share a first-order bound certifies6 bits: wrong 0%, certified 100%; 9 bits: wrong 0%, certified 100%; 12 bits: wrong 0%, certified 100%; 15 bits: wrong 0%, certified 100%; 18 bits: wrong 0%, certified 100%; 21 bits: wrong 0%, certified 100%; 24 bits: wrong 0%, certified 100%; 27 bits: wrong 0%, certified 100%; 30 bits: wrong 0%, certified 100%; 33 bits: wrong 0%, certified 100%; 36 bits: wrong 0%, certified 100%; 39 bits: wrong 0%, certified 93%; 42 bits: wrong 0%, certified 30%; 45 bits: wrong 0%, certified 0%; 48 bits: wrong 3%, certified 0%; 51 bits: wrong 48%, certified 0%. The first wrong sign is at 48 bits, and the bound certifies nine in ten to 39.0612182430364248540255075100bits of distance from singular, each small valueper cent of forty drawscertified by the boundsign wrongorder 4 · two small · LU with partial pivotingthe same edge for any count
Fig. 1 At order 4, over forty draws at each distance: the share of signs certified by the bound (blue) and the share wrong (red). The dial sets how many singular values are small.

At order 4 with one small value, every sign is right to 45 bits, the bound certifies nine in ten to 39, and the first wrong sign is at 48. With two small values the picture is the same, step for step: certified to 39, right to 45, first wrong at 48. With three, the bound still certifies to 39 and the first wrong sign arrives one step earlier, at 45. The dial moves almost nothing. The sign of a matrix two ranks short holds out exactly as far as the sign of a matrix one rank short, and the predicted edge at 24 bits is not there; at 24 bits every sign at every count is right and every one is certified.

What shrank and what did not

The prediction’s premise was that the determinant shrinks by twice as many bits. That part is true, and it can be measured directly: the number of bits by which the determinant falls below the product of the rows’ lengths, which is Hadamard’s bound and the size it would have if the rows were orthogonal.

At order 4, the median bits by which the determinant falls below the product of its row lengths, and the median condition number in bits, against the distance from singular, with one, two and three small singular valuesone small: below by 17 at 12, 30 at 24, 42 at 36, 53 at 48; condition 18 at 12, 31 at 24, 43 at 36, 55 at 48; two small: below by 32 at 12, 56 at 24, 80 at 36, 104 at 48; condition 19 at 12, 31 at 24, 43 at 36, 55 at 48; three small: below by 44 at 12, 79 at 24, 116 at 36, 153 at 48; condition 19 at 12, 31 at 24, 43 at 36, 55 at 48, in bits.061218243036424854020406080100120140160bits of distance from singular, each small valuebitssize: one smallsize: two smallsize: three smallcondition, every countforty draws at each distancethe size counts them, the condition does not
Fig. 2 At order 4, the median bits by which the determinant falls below the product of its row lengths, with one (blue), two (green) and three (red) small singular values, and the median condition number in bits for every count (grey), against the distance.

The three size lines are straight with slopes one, two and three. At d=48d = 48 the determinant is 53 bits below its rows’ product with one small value, 104 with two and 153 with three, which is very nearly ss times dd plus a constant. The condition number is a single line under all three counts: 18 or 19 bits at d=12d = 12, 31 at 24, 43 at 36 and 55 at 48, whatever ss is. It grows one bit for each bit of distance, and a second or third small singular value adds nothing to it.

That much was in the prediction too, as the observation that a condition number “sees only one of them”. The question is which of the two lines the value’s error follows.

At order 4, the median relative error of the determinant's value from LU against the distance from singular, with one, two and three small singular valuesone small: 1e-12 at 12, 7e-9 at 24, 3e-5 at 36, 1e-1 at 48; two small: 3e-12 at 12, 9e-9 at 24, 6e-5 at 36, 1e-1 at 48; three small: 1e-12 at 12, 8e-9 at 24, 2e-5 at 36, 1e-1 at 48 bits.06121824303642485410⁻¹⁶10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1bits of distance from singular, each small valuerelative error of the valueone smalltwo smallthree smallforty draws at each distanceone curve, three counts
Fig. 3 At order 4, the median relative error of the determinant’s value from LU against the distance from singular, with one (blue), two (green) and three (red) small singular values.

It follows the condition number. With one small value the median relative error is 10−1210^{-12} at d=12d = 12, 7⋅10−97 \cdot 10^{-9} at 24, 3⋅10−53 \cdot 10^{-5} at 36 and 0.10.1 at 48. With two it is 3⋅10−123 \cdot 10^{-12}, 9⋅10−99 \cdot 10^{-9}, 6⋅10−56 \cdot 10^{-5} and 0.10.1; with three, 10−1210^{-12}, 8⋅10−98 \cdot 10^{-9}, 2⋅10−52 \cdot 10^{-5} and 0.10.1. The three curves lie on one another to within a factor of three at every distance. A determinant a hundred bits smaller than another has the same relative error, because relative error is not a statement about size.

The size was the wrong scale

The clearest way to see where the prediction’s reasoning went wrong is to plot the same errors against the quantity the prediction used.

At order 4, the median relative error of the determinant's value from LU against how many bits the determinant falls below the product of its row lengths, with one, two and three small singular valuesone small: 1e-12 at 17 bits below, 7e-9 at 30 bits below, 3e-5 at 42 bits below, 1e-1 at 53 bits below; two small: 3e-12 at 32 bits below, 9e-9 at 56 bits below, 6e-5 at 80 bits below, 1e-1 at 104 bits below; three small: 1e-12 at 44 bits below, 8e-9 at 79 bits below, 2e-5 at 116 bits below, 1e-1 at 153 bits below.02040608010012014016010⁻¹⁶10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1bits the determinant falls below its row lengths' productrelative error of the valueone smalltwo smallthree smallthe same draws, the size on the axisthe size is the wrong scale
Fig. 4 At order 4, the same median relative errors against how many bits the determinant falls below the product of its row lengths, with one (blue), two (green) and three (red) small singular values.

On this axis the three curves come apart. An error of 0.1, the point at which signs begin to fail, arrives at 53 bits below the rows’ product with one small value, at 104 with two and at 153 with three. Read on the size of the determinant, the sign of a matrix with three small values survives three times as far. That is nonsense as a statement about robustness, and it is exactly what the prediction assumed in reverse: it assumed the sign lives on the size axis, so that a determinant reaching a given smallness twice as fast would lose its sign twice as fast. The sign lives on the condition number’s axis, where every count of small values gives the same curve. The determinant’s size is the scale on which a rule that is correct and unusable went wrong too: Cramer’s rule divides one determinant by another, and every quotient of two small numbers looks precarious on a size axis while the error that matters is set by how each was computed, not by how small it came out.

The reason is a short calculation. LU with partial pivoting computes, as the exact answer to a nearby problem puts it, the exact determinant of a nearby matrix A+EA + E, with EE of order uu times the size of AA’s entries. Each small singular value σi\sigma_i of AA moves under that perturbation by an amount of order uσ1u \sigma_1, so its relative error is about uσ1/σiu \sigma_1 / \sigma_i, the ratio the condition number takes for the smallest one. The determinant is the product of all the singular values, so its relative error is the sum of their relative errors, and with ss values near the smallest that sum is about ss times uσ1/σnu \sigma_1 / \sigma_n. A factor of ss, at most three here, is under two bits, and it is the step by which the sign failed earlier with three small values than with one. The size of the determinant does not appear in the sum at all. A matrix with two small singular values has a determinant that is small twice over, and an error that is large once.

The factor of ss can be seen at the larger orders, where the draws are steadier. At d=36d = 36 and order 6 the median error is 6.9⋅10−56.9 \cdot 10^{-5} with one small value, 9.2⋅10−59.2 \cdot 10^{-5} with two and 1.1⋅10−41.1 \cdot 10^{-4} with three; at order 8 it is 1.1⋅10−41.1 \cdot 10^{-4}, 1.4⋅10−41.4 \cdot 10^{-4} and 2.3⋅10−42.3 \cdot 10^{-4}. Three small values cost a factor of 1.6 and 2.1, under the three the sum allows, since the terms are of similar size but not equal. Over the same three counts the determinant falls 44, 83 and 122 bits below its rows’ product at order 6 and 45, 85 and 124 at order 8, a factor of nearly three in the logarithm, which is a factor of about 2802^{80} in the determinant itself. A factor of two in the error against a factor of 2802^{80} in the size is the whole argument in two numbers.

So the condition number does see only the smallest singular value, as the earlier essay said, and that is exactly why it is the right number. The relative error of each small value depends on its own distance, and the condition number reports the worst one. Two small values at the same distance are two terms of the same size in a sum, not two factors in a product. The number that decides nothing made the point that a determinant’s value says nothing about how close a matrix is to singular, using scaling; here the same point arrives from the singular values, and it applies to the value’s error as much as to the value.

The window does not close

The bound used to certify signs is built from the pivots and the growth, and the prediction expected it to move by less than the sign’s own limit, so that the window between the two would narrow. Since the sign’s limit did not move, the question is only whether the bound’s did.

For each order and each count of small singular values, the last distance from singular at which a first-order bound certifies nine signs in ten, and the first at which a sign is wrong, in bitsorder 4: one small certified to 39 and first wrong at 48, two small certified to 39 and first wrong at 48, three small certified to 39 and first wrong at 45; order 6: one small certified to 36 and first wrong at 45, two small certified to 36 and first wrong at 45, three small certified to 36 and first wrong at 48; order 8: one small certified to 36 and first wrong at 48, two small certified to 36 and first wrong at 45, three small certified to 36 and first wrong at 45.3036424854order 4one small: certified to39one small: first wrong sign48two small: certified to39two small: first wrong sign48three small: certified to39three small: first wrong sign45order 6one small: certified to36one small: first wrong sign45two small: certified to36two small: first wrong sign45three small: certified to36three small: first wrong sign48order 8one small: certified to36one small: first wrong sign48two small: certified to36two small: first wrong sign45three small: certified to36three small: first wrong sign45bits of distance from singular, each small valueforty draws at each distancethe window does not close
Fig. 5 For each order and count of small singular values, the last distance at which the bound certifies nine signs in ten (blue), and the first at which a sign is wrong (red), in bits.

It did not either. At order 4 the bound certifies to 39 bits with one, two or three small values. At orders 6 and 8 it certifies to 36 with every count. The first wrong sign arrives at 45 or 48 bits in all nine cases. So the window in which the sign is right and the bound cannot say so is 6 to 12 bits at every order and count, the same width the earlier essay measured on a single small value. The bound behaves like the sign for the same reason: it divides the product of the pivots by the smallest pivot, and with ss small values s−1s - 1 small pivots remain in that product, so the bound shrinks with the determinant and its ratio to the determinant depends, again, on the smallest pivot alone. A first-order bound built from the factorisation inherits the factorisation’s view of the problem, which is the condition number’s view.

Not one of the 4,304 certified signs in this sweep was wrong. The one wrong certificate the earlier essay found, at order 8 and 57 bits on a matrix that rounding had made exactly singular, lies beyond the distances used here, where the perturbation no longer survives the trip into binary64 at all.

Where geometry puts two small values

The case is not contrived. An orientation test in three dimensions asks for the sign of a determinant of order four built from four points, and it is one rank short when the four points are coplanar, which is the configuration the test exists to detect. When three of the four are also collinear, or all four lie on one line, the matrix is two or three ranks short. Meshes of regular grids, points snapped to a lattice and models built from extruded planar faces put such configurations in front of a predicate constantly, and a robust geometry code has to return the right sign, or zero, on every one of them. The reasoning that a matrix two ranks short is twice as hard would have suggested that those cases need an exact stage far more often. On this measurement they need it exactly as often as a matrix one rank short at the same distance, and a filter tuned to the one case serves the other.

What the count of small values does change

It changes how small a determinant is, and so it changes the range. A matrix of order 4 that is three ranks short has a determinant 153 bits below its rows’ product at a distance of 48 bits, and a matrix of order 40 that is twenty ranks short at the same distance has one about a thousand bits below, which would underflow binary64 before any question of its sign arose. That is the failure the number that decides nothing described for large orders, and it is a failure of the format’s exponent rather than of the factorisation’s accuracy. A determinant accumulated as a sum of logarithms, as the modular methods in a cheap logarithm, and what vouches for it do, has no such limit, and then the relative error measured here is the whole story.

It also changes what the sign means. A matrix with several small singular values is close to a matrix of lower rank, not merely to a singular one, and rank is a decision is the essay about what a code should report there. A sign of a determinant answers the question of which side of the singular matrices a nearby matrix lies on, and with two small singular values there are many directions in which singular matrices lie close by. The sign is still correct as far as 45 bits out. Whether it is the question a caller should be asking of a matrix that is two ranks short is a different matter, and the cheap rank and what it cannot see is where that question is taken up.

Where the construction is narrow

Every small singular value here sits at the same distance, 2−d2^{-d}, because the perturbations on the ss dependent rows have the same size. Two small values at different distances would give two terms of different size in the error’s sum, and the larger would dominate; that case was not measured, and it is the more common one in practice. The entries are integers of about 2202^{20} with combinations whose coefficients are below five, so growth in the factorisation is modest, and the bound’s constant of 4n24n^2 with growth included is still a first-order estimate rather than a proved one. Forty draws at each distance give shares in steps of 2.5 per cent, so a first wrong sign is a first wrong sign among forty, and a rarer one could sit a step earlier.

What is settled is narrow and clear. With one, two or three small singular values at the same distance, the sign of a determinant computed by LU fails at the same distance, within one step of three bits, at orders 4, 6 and 8; the value’s error and the condition number move together and the determinant’s size does not move with either; and the certifiable window does not close. An estimate that can be fooled is about how to estimate that condition number cheaply, and nothing here suggests a reason to estimate anything else.

Still open: two distances, and a bound that reads the smallest pivots

Two small values at different distances. The calculation above says the determinant’s relative error is the sum of each small value’s own uσ1/σiu \sigma_1 / \sigma_i. The prediction with a sign is that with one small value at 2−d2^{-d} and a second at 2−d/22^{-d/2}, the first wrong sign arrives within one step of where it arrives with the first value alone, at every order here, and that with both at 2−d2^{-d} but on rows whose perturbations are correlated, so that the two small singular values are not independent, nothing changes either, since the factorisation’s backward error does not know which rows were built together.

A bound that uses the smallest pivots. The window stays open because the bound uses the growth and the largest entry where the determinant’s error depends on the condition. The prediction is that a bound written as 4n2u4n^2 u times the product of the pivots times the sum over pivots of ∥A∥/∣uii∣\|A\| / |u_{ii}|, which is the first-order error of the product, certifies nine signs in ten to within three bits of the first wrong sign at every order and count here, closing the window to a single step, and that it is never wrong on any draw up to 51 bits.

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.

Backward errorCondition numberDeterminantExact ground truthLU factorisationNumerical rankSingular values