Exact arithmetic, and what it costs instead

A basis that describes its lattice badly

The same set of points has infinitely many bases, they are all correct, and they are not equally useful. One measurement separates them — the product of the vectors' lengths over the lattice determinant — and the determinant is the invariant the reduction may not change, which is what makes the reduction checkable.

Worth reading first: Orthogonal is a number · An answer with no error in it · The condition number is an amplifier.

A lattice is the set of integer combinations of some vectors. The vectors are a basis; the lattice is the set of points; and unlike a vector space over the reals, where any two bases of the same subspace are related by an invertible matrix, here the relation has to be unimodular — integer entries, integer inverse, determinant ±1 — because the integer combinations have to land on the same points either way.

That leaves a great deal of freedom, and it is freedom to describe a very simple object extremely badly.

One lattice, two bases: an orthogonality defect of 7.071 reduced to 1The dots are the lattice generated by (1, 0) and (7, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 7.0711 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before7.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 1 The dots are the lattice generated by (1, 0) and (7, 1) — all of ℤ², since the second vector’s second coordinate is 1. The long pair of arrows is that basis. The short pair is what an exact reduction returns, and the dots do not move.

The lattice in the figure is all of ℤ² — the integer points of the plane, the simplest lattice there is. The basis it is handed describes those points as combinations of (1, 0) and (7, 1), which is true, and which makes the coefficient of a point like (0, 1) equal to (−7, 1) rather than to anything obvious. Nothing is wrong. Every point is reachable, uniquely, with integer coefficients. The description is simply seven times worse than it has to be, and at a skew of 10²⁰ it would be 10²⁰ times worse without ever becoming incorrect.

The quantity that separates two bases of one lattice

Any basis of a lattice spans a fundamental cell, and every basis of the same lattice spans a cell of the same volume, because the determinant of a unimodular change is ±1. So the volume — the lattice determinant — is an invariant: it belongs to the lattice and not to the description.

What varies is the shape. Hadamard’s inequality says the product of the basis vectors’ lengths is at least the volume they enclose, with equality exactly when they are mutually orthogonal, so the ratio

orthogonality defect  =  (Π ‖bᵢ‖) / |det B|

is at least one for every basis, equal to one only for an orthogonal one, and larger the more skewed the description is. It is a single number and it is exactly the thing a reduction reduces.

That is the same inequality the modular route budgets primes with, used the other way round: there it bounds a determinant from above by row lengths, here it bounds row lengths from below by a determinant. It is one theorem doing two jobs in one field, which is worth noticing because the two look unrelated.

Reduced in exact arithmetic, and why that is not fussiness

The reduction here runs in exact rational arithmetic: the Gram–Schmidt coefficients are fractions, the size-reduction rounds an exact rational to the nearest integer, and the exchange condition is decided by comparing two exact rationals.

That is not a purity gesture. A lattice reduction is a discrete algorithm whose decisions are comparisons — swap or do not swap, subtract this integer multiple or that one — and a comparison decided by a float that is a rounding away from the boundary is a different algorithm on some inputs. It is the same shape of failure as a partition decided in the last digit: the output is not a number that could be slightly wrong, it is a basis that is either this one or that one.

The rounding inside is the part most likely to be got wrong quietly. The coefficient being rounded can exceed 2⁵³ on a basis with long vectors, and Math.round(Number(q)) then rounds the wrong integer — which leaves the basis unreduced without failing anything, because the algorithm’s postcondition is about sizes rather than about that particular step. So the rounding here is written on the numerator and denominator directly, and the reduced basis is asserted to be integral before it is returned.

The conserved quantity is the check

Every step of the reduction is a unimodular operation: subtract an integer multiple of one basis vector from another, or exchange two. So the lattice determinant must be unchanged at the end, exactly — not to a tolerance, as an integer.

That is the check, and it is a good one because it is sensitive to precisely the mistakes an implementation makes. A size reduction with the wrong rounding still preserves it. A swap implemented as an overwrite does not. A coefficient computed as a float and truncated does not. The determinant is 1 before and 1 after on the hero’s lattice, and the assertion compares integers.

The defect, meanwhile, is asserted to have gone down rather than up — which sounds trivial and is the other half of the pair. A reduction that preserved the determinant and made the basis worse would be a correct unimodular transformation and a useless one.

One lattice, two bases: an orthogonality defect of 40.01 reduced to 1The dots are the lattice generated by (1, 0) and (40, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 40.012 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before40defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 2 A skew of forty, where the starting basis has a defect of 40.0125 and the reduction returns one at exactly 1. The lattice determinant is 1 in both cases and the picture is the same set of points.

What the reduction actually does here, in one step

On this family the algorithm is short enough to follow completely, and following it makes the two halves of a reduction visible separately.

The basis is (1, 0) and (k, 1). The Gram–Schmidt coefficient of the second against the first is exactly k — a rational whose denominator is 1 — so the size-reduction step subtracts k times the first vector from the second and leaves (0, 1). The exchange condition is then satisfied, the loop ends, and the returned basis is the standard one.

One step, at every skew from 2 to 40. The defect falls from a little over k to exactly 1, the determinant is 1 throughout, and the number of steps does not grow with the skew at all — which is worth noticing, because the size of the coefficient does. A size reduction on a basis with a skew of 10²⁰ is one step whose coefficient has sixty-seven bits in it, and it is the arithmetic on that coefficient rather than the number of steps that costs.

That is the field’s usual observation arriving in a new place: the operation count is one and the price is the length of the operand. It is also why the exact rounding matters. A coefficient of 10²⁰ does not survive a round-trip through a double, and the step that should have cleared the basis in one move would leave it skewed by whatever the rounding lost.

What this has to do with the rest of the field

Two connections, and the first is that this essay is a generalisation of one already written.

Rational reconstruction recovers n/d from a residue by running the Euclidean algorithm and stopping early. The set of pairs (a, b) with a ≡ b·u (mod m) is a two-dimensional lattice of determinant m; the answer is its shortest vector; and the Euclidean algorithm is lattice reduction in two dimensions, where it is exact, terminating, and two thousand years older than the problem. Everything in that essay — the uniqueness of the short vector, the bound at √(m/2), the cliff rather than the slope — is a statement about a lattice with a determinant, read in the smallest case.

The second connection is that a lattice is what the Smith normal form describes. An integer matrix’s rows generate a lattice; the Hermite normal form is a canonical basis for it; the Smith form describes the quotient. So this field has three descriptions of one object — a canonical basis, a quotient decomposition, and a short basis — and only the third is not canonical, because shortness does not determine a basis uniquely. Which is the reverse of the usual situation here, where the canonical object is the expensive one and the practical routine returns something non-unique: a Hermite form is unique and costly, a reduced basis is cheap and is one of many, and both are correct answers to different questions about the same set of points.

Why the reduction terminates at all

There is one thing about the algorithm that is genuinely surprising and is worth a paragraph, because it is the only part of the whole construction that is not immediate.

The loop alternates between size reduction, which does not change any Gram–Schmidt length, and exchanges, which do. A basis could in principle be swapped back and forth for ever. What prevents it is a quantity that strictly decreases: the product of the Gram–Schmidt lengths raised to descending powers, which is a positive integer for an integral basis and which an exchange multiplies by at most δ = 3/4. A positive integer that shrinks by a quarter each time cannot do so many times.

So termination rests on the basis being integral, which is why the routine asserts that the returned vectors have denominator 1 rather than assuming it, and why a reduction implemented over the reals needs an entirely different argument. The guard in the code is a step cap with an assertion attached; on every lattice drawn here the cap is never approached, and if it were the figure would fail rather than silently return a basis the loop had abandoned.

What a short basis is worth

Reduction is worth doing because a skewed basis makes easy questions hard.

Is a given point in the lattice? With an orthogonal basis it is division. With the hero’s skewed basis the coefficients are large and alternate in sign, and rounding to the nearest lattice point by rounding each coefficient is simply wrong — the nearest point in coefficient space is not the nearest point in the plane when the basis is skewed. That failure is the same one the essay on a basis of a subspace describes in the continuous setting, where two spans of one null space behave differently under exactly the operations that are supposed not to care.

How short is the shortest vector? The reduced basis’s first vector is within a factor of 2(n1)/22^{(n-1)/2} of it, which is a bound rather than an answer and is the property the whole algorithm is named for. In two dimensions the reduction finds the shortest vector exactly, which is why reconstruction can be said to find rather than approximate — and it is the reason the previous essay could assert a cliff rather than a trend.

And the conditioning of the basis matrix. The defect and the condition number are different quantities and they move together: a defect of 40 on the hero’s lattice comes with a basis matrix whose two-norm condition number is about 40 as well. The relation is not exact — the defect is a product of lengths over a determinant, the condition number is a ratio of singular values — but they are both measuring the same skew, from the two directions this site usually measures things from. It is the one place in this field where a condition number is still doing work: not amplifying an error, since there is none, but describing how badly a description was chosen.

One lattice, two bases: an orthogonality defect of 2.236 reduced to 1The dots are the lattice generated by (1, 0) and (2, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 2.2361 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before2.2defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 3 A skew of two, where the defect is 2.24 and one size reduction is enough.

Where a badly chosen description turns up elsewhere on this site

The general complaint — the object is fine and the description is terrible — is one this collection has made in four other places, and collecting them is the fastest way to see what is particular about the lattice case.

A basis that is the same subspace and not the same thing is the continuous version: three spans of one null space, identical as subspaces, behaving differently under a projection because their bases are conditioned differently. The units the matrix is measured in is the same complaint about a scaling: one problem, many descriptions, and a condition number that reports the description rather than the problem. A condition number scaling cannot move is the counterweight — the part of the difficulty that survives every rescaling and therefore does belong to the object. And the ordering a sparse elimination is given is a description whose choice changes the cost by orders of magnitude with the answer untouched.

What is unusual here is that the badness has a number with a floor, and the floor is attained. A condition number has no natural best value for a given problem; the orthogonality defect’s best value is 1, it is 1 exactly when the description is as good as descriptions get, and there is a theorem saying so. That is a rarity on this site, where most quantities are compared against a bound nobody reaches.

The refusal, which is a bound rather than a preference

The claim worth breaking is that a reduced basis is orthogonal. It is not, and cannot be in general: most lattices have no orthogonal basis at all, and the reduction returns the best it can find in polynomial time rather than the best that exists.

The defect after reduction on the hero’s lattice is exactly 1, because ℤ² does have an orthogonal basis and the reduction finds it. On a lattice that does not, the defect after reduction is above 1 and stays there — and the assertion that a reduced basis achieves a defect below one is fed the reduced basis and has to reject it, because Hadamard’s inequality forbids it for every basis of every lattice.

That is a refusal of a different kind from most on this site. Usually the claim being broken is one somebody might reasonably hold; this one is broken by a theorem, and the assertion exists to make sure the code’s notion of the defect is the one the theorem is about. A defect computed with a determinant of the wrong sign, or with lengths rather than squared lengths, would sail below one and nothing else in the routine would notice.

Higher dimensions, and what is not measured here

Everything above is drawn in two dimensions, where the reduction finds the genuinely shortest vector and the picture can show the lattice. That is a real limitation and it is worth stating what it hides.

In dimension n the algorithm guarantees only that its first vector is within 2(n1)/22^{(n-1)/2} of the shortest — a bound that is exponential in n and is nearly attained on constructed examples. So “reduced” means something much weaker than it does here: a basis whose defect has been improved by a provable factor rather than a basis that is as good as the lattice allows. Finding the shortest vector exactly is believed to be hard, and a great deal of modern cryptography rests on its being so.

The implementation here is the original algorithm with δ = 3/4, in exact rationals, which means it is correct and it is not fast: a full Gram–Schmidt is recomputed after every step rather than updated, and the coefficients are exact fractions rather than floating point with a controlled error. Both choices are deliberate — the whole point of this field is that the comparisons are decided exactly — and both would be wrong in a routine meant for the dimensions where the algorithm is actually used.

What the two-dimensional case does give is the complete picture: a conserved quantity, a reduced quantity, a bound relating them, and a reduction that attains the bound. The n-dimensional case has all four objects and attains nothing, and the honest way to introduce it is with the case where the arithmetic can be watched.

At other settings

One lattice, two bases: an orthogonality defect of 5.099 reduced to 1The dots are the lattice generated by (1, 0) and (5, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 5.099 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before5.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 4 A skew of five: defect 5.10 before, 1 after, determinant unchanged.
One lattice, two bases: an orthogonality defect of 12.04 reduced to 1The dots are the lattice generated by (1, 0) and (12, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 12.042 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before12defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 5 Twelve, where the arrows have left the drawn window and the dots have not moved.
One lattice, two bases: an orthogonality defect of 20.02 reduced to 1The dots are the lattice generated by (1, 0) and (20, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 20.025 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before20defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 6 Twenty, where the defect before is 20.03 and one size reduction still clears it.
Recovering 355/113 from its residue: nothing below 2^18, everything aboveThe fraction 355/113 is reduced modulo a prime just above 2^e and then reconstructed from that one residue by the extended Euclidean algorithm. Below e = 18 the reconstruction returns a different fraction or refuses; at and above it, it returns 355/113 exactly, at every e tried. The crossover is not a property of the algorithm: a residue determines a rational uniquely once the modulus exceeds twice the square of the LARGER of the two parts, which here is 2^17.94, and below that there are two fractions with the same residue and both parts small enough. The measured first success is 2^18. There is no band in which the answer is is nearly right — the value returned below the cliff is a perfectly good fraction that is not this one.2^18modulus, as a power of twoa lattice with one short vectornumerator355denominator1132·max(n, d)², bits18first recovered at18moduli tried42below the bound there are two answersand the algorithm cannot prefer one
Fig. 7 The two-dimensional case, where the short vector is a fraction and the bound is the cliff.
Recovering 1/99991 from its residue: nothing below 2^35, everything aboveThe fraction 1/99991 is reduced modulo a prime just above 2^e and then reconstructed from that one residue by the extended Euclidean algorithm. Below e = 35 the reconstruction returns a different fraction or refuses; at and above it, it returns 1/99991 exactly, at every e tried. The crossover is not a property of the algorithm: a residue determines a rational uniquely once the modulus exceeds twice the square of the LARGER of the two parts, which here is 2^34.22, and below that there are two fractions with the same residue and both parts small enough. The measured first success is 2^35. There is no band in which the answer is is nearly right — the value returned below the cliff is a perfectly good fraction that is not this one.2^35modulus, as a power of twoa lattice with one short vectornumerator1denominator10·10⁴2·max(n, d)², bits34first recovered at35moduli tried42below the bound there are two answersand the algorithm cannot prefer one
Fig. 8 And a lattice whose short vector has one very small coordinate.
5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 5 is the diagonal [1, 1, 1, 1, 22616], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 22616], and the two agree entry for entry. Their product is 22616, which is |det A| = 22616. The Hermite form of the same matrix reaches 24 bits against the Smith form's 15, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss514 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-2.3·10⁴Π invariants2.3·10⁴SNF widest15HNF widest24det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 9 The other description of a lattice: the invariant factors of the map that generates it.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a wide matrix of order 4 is the diagonal [1, 1, 1, 715250895253], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 715250895253], and the two agree entry for entry. Their product is 715250895253, which is |det A| = 715250895253. The Hermite form of the same matrix reaches 65 bits against the Smith form's 40, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss439 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-7.2·10¹¹Π invariants7.2·10¹¹SNF widest40HNF widest65det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 10 Three-digit entries, where the Hermite transform’s growth is visible against the Smith form’s.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = -40098 on a random matrix of order 6, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 1 word-sized prime put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns -4.0098·10⁴, a relative error of 3.629·10⁻¹⁶, which is what a determinant of 16 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 23 bits are needed and 1 prime supplies them.Bareiss16 bitsrationals13 bitsmodular26 bitsthe answer16 bitsHadamard23 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 1 prime0floating-point LU3.6·10⁻¹⁶det A = -40098three routes, one integerand no tolerance anywhere in the comparison
Fig. 11 The lattice determinant, computed three exact ways.
QᵀQ from classical Gram–Schmidt and from Householder on the 8×8 Hilbert matrixTwo eight-by-eight tables of QᵀQ. The upper one has ones on the diagonal and entries as large as one off it; the lower one is the identity to three decimal places everywhere.A = H8 · κ = 1.5·10¹⁰ · both factorisations reconstruct A to 6·10⁻¹⁷the diagonal is 1 in both — every column is a unit vector either way1.000000000001.000000000001.000000000001.000000000001.00000.002-0.002000001.0000.125-0.13300000.0020.1251.000-1.0000000-0.002-0.133-1.0001.000classical Gram–Schmidt1.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000Householderclassical ‖QᵀQ − I‖1.4Householder ‖QᵀQ − I‖1.4·10⁻¹⁵largest off-diagonal 1 against 3.1·10⁻¹⁶length is not angle
Fig. 12 Orthogonality as a measured number in the continuous setting, which the defect is the discrete analogue of.
Loss of orthogonality against condition number, in binary64A log–log plot of the norm of Q-transpose-Q minus the identity against condition number. Classical Gram–Schmidt rises steeply, modified Gram–Schmidt rises gently, and Householder is flat.110²10⁴10⁶10⁸10¹⁰10¹²10⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹condition number κ(A)‖QᵀQ − I‖classicalmodifiedHouseholderκ²uκu8×8, eight seeds per κ, binary64all three reconstruct A
Fig. 13 Loss of orthogonality during a factorisation, which a lattice reduction cannot suffer because it never rounds.
The exact solution of a random system is longer than the systemAx = b with A a random integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 10 the question occupies 400 bits — 10² entries of 4 bits each — and the answer occupies 721, a ratio of 1.8. Every entry is a ratio of two determinants by Cramer's rule, checked here by multiplying each one back by det A and comparing it with the determinant of the column-replaced matrix as an integer — so every denominator divides det A and none of them is longer than its 37 bits, while a numerator can be, at 38 here. The answer IS that long, whatever route produced it. That is a floor no exact solver can get under, and it is why the modular route reconstructs the answer rather than eliminating its way to it.34567891010²10³nbitsthe answerthe question · det Abits in, bits outn10question400answer721det A37widest part38the answer is the floorand no route writes it down more cheaply
Fig. 14 The lengths a lattice computation has to carry, in the field’s usual unit.
Three exact eliminations of the same random matrix, and the widest number each one formsEvery route here returns the same determinant exactly, so there is no error to plot and the y-axis is the length of the intermediates in bits. At n = 11 the answer itself is 33 bits and Hadamard's bound allows 47. Fraction-free elimination never forms a number wider than 35 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 35 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 341287 bits — 9750 times the width of the fraction-free route and 10300 times the width of the answer. All three are correct.34567891011110¹10²10³10⁴10⁵nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn11answer33Hadamard bound47fraction-free35reduced rationals35unreduced3.4·10⁵the error is zero on every curvethe cost is the length of the numbers
Fig. 15 And the growth that exact rational Gram–Schmidt would suffer without reduction.
One lattice, two bases: an orthogonality defect of 3.162 reduced to 1The dots are the lattice generated by (1, 0) and (3, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 3.1623 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before3.2defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 16 A skew of three, where one size reduction returns the standard basis.
One lattice, two bases: an orthogonality defect of 8.062 reduced to 1The dots are the lattice generated by (1, 0) and (8, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 8.0623 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before8.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 17 Eight, where the defect before is 8.06 and after is exactly 1.
One lattice, two bases: an orthogonality defect of 30.02 reduced to 1The dots are the lattice generated by (1, 0) and (30, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 30.017 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before30defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 18 Thirty, where the arrows leave the frame and the dots do not move.
Recovering 9973/113 from its residue: nothing below 2^28, everything aboveThe fraction 9973/113 is reduced modulo a prime just above 2^e and then reconstructed from that one residue by the extended Euclidean algorithm. Below e = 28 the reconstruction returns a different fraction or refuses; at and above it, it returns 9973/113 exactly, at every e tried. The crossover is not a property of the algorithm: a residue determines a rational uniquely once the modulus exceeds twice the square of the LARGER of the two parts, which here is 2^27.57, and below that there are two fractions with the same residue and both parts small enough. The measured first success is 2^28. There is no band in which the answer is is nearly right — the value returned below the cliff is a perfectly good fraction that is not this one.2^28modulus, as a power of twoa lattice with one short vectornumerator9973denominator1132·max(n, d)², bits28first recovered at28moduli tried42below the bound there are two answersand the algorithm cannot prefer one
Fig. 19 The same reduction in the case where the short vector is a fraction.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a wide matrix of order 4 is the diagonal [1, 1, 1, 715250895253], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 715250895253], and the two agree entry for entry. Their product is 715250895253, which is |det A| = 715250895253. The Hermite form of the same matrix reaches 65 bits against the Smith form's 40, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss439 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-7.2·10¹¹Π invariants7.2·10¹¹SNF widest40HNF widest65det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 20 The quotient of the lattice by the image of an integer map.
5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a unitriangular matrix of order 5 is the diagonal [1, 1, 1, 1, 1], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1], and the two agree entry for entry. Their product is 1, which is |det A| = 1. The Hermite form of the same matrix reaches 1 bits against the Smith form's 1, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A1Π invariants1SNF widest1HNF widest1det of the transform1an algorithm and a definitionagreeing as integers
Fig. 21 A unimodular map, which changes a description and not a lattice.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = -8650618 on a random matrix of order 8, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 2 word-sized primes put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns -8.650618·10⁶, a relative error of 2.153·10⁻¹⁶, which is what a determinant of 24 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 33 bits are needed and 2 primes supply them.Bareiss24 bitsrationals23 bitsmodular26 bitsthe answer24 bitsHadamard33 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 2 primes0floating-point LU2.2·10⁻¹⁶det A = -8650618three routes, one integerand no tolerance anywhere in the comparison
Fig. 22 The determinant that every unimodular step preserves.
The determinant's length, and the bound that decides how many primes to use before any of them is chosenSolid: Hadamard's bound on |det A|, the product of the row 2-norms, in bits. Dotted: the determinant's actual length. The bound is what a modular determinant budgets against — at n = 9 the random family needs 37 bits, which is 2 word-sized primes at 26 bits each, and that count is fixed before the first residue is computed. On a Sylvester Hadamard matrix of order 8 the bound is 13 bits and the determinant has 13, so the bound is attained rather than merely satisfied. On the unit triangular family the determinant is 1 at every size while the bound grows, which is the gap the budget pays for: a matrix can have a determinant of one and rows that are long.3456789110¹10²nbitsthe budget and what it buysrandom, bound37random, actual25primes needed2Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 23 Hadamard used the other way round, bounding a determinant by lengths.
One 6 × 6 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 6; over 𝔽2 and 𝔽3 it is 4 and 5. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.6𝔽24𝔽35𝔽56𝔽76𝔽116𝔽136𝔽1016𝔽655376rank, by the ring the entries are read inthe rank of one matrixover ℚ6over 𝔽24over 𝔽35over 𝔽56over 𝔽76nothing is rounded hereand the answer still is not a property of the matrix
Fig. 24 The invariant factors read modulo a prime.
Three exact eliminations of the same random matrix, and the widest number each one formsEvery route here returns the same determinant exactly, so there is no error to plot and the y-axis is the length of the intermediates in bits. At n = 10 the answer itself is 37 bits and Hadamard's bound allows 42. Fraction-free elimination never forms a number wider than 37 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 36 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 30683 bits — 829 times the width of the fraction-free route and 829 times the width of the answer. All three are correct.345678910110¹10²10³10⁴nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn10answer37Hadamard bound42fraction-free37reduced rationals36unreduced3.1·10⁴the error is zero on every curvethe cost is the length of the numbers
Fig. 25 The lengths an exact Gram–Schmidt has to carry.
One lattice, two bases: an orthogonality defect of 4.123 reduced to 1The dots are the lattice generated by (1, 0) and (4, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 4.1231 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before4.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 26 A skew of four.
One lattice, two bases: an orthogonality defect of 16.03 reduced to 1The dots are the lattice generated by (1, 0) and (16, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 16.031 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before16defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 27 Sixteen, where the defect before is 16.03.
One lattice, two bases: an orthogonality defect of 25.02 reduced to 1The dots are the lattice generated by (1, 0) and (25, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 25.02 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before25defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 28 And twenty-five.
Recovering 1013/29 from its residue: nothing below 2^21, everything aboveThe fraction 1013/29 is reduced modulo a prime just above 2^e and then reconstructed from that one residue by the extended Euclidean algorithm. Below e = 21 the reconstruction returns a different fraction or refuses; at and above it, it returns 1013/29 exactly, at every e tried. The crossover is not a property of the algorithm: a residue determines a rational uniquely once the modulus exceeds twice the square of the LARGER of the two parts, which here is 2^20.97, and below that there are two fractions with the same residue and both parts small enough. The measured first success is 2^21. There is no band in which the answer is is nearly right — the value returned below the cliff is a perfectly good fraction that is not this one.2^21modulus, as a power of twoa lattice with one short vectornumerator1013denominator292·max(n, d)², bits21first recovered at21moduli tried42below the bound there are two answersand the algorithm cannot prefer one
Fig. 29 The two-dimensional reduction with a large numerator.
6 × 6: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 6 is the diagonal [1, 1, 1, 1, 1, 40098], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1, 40098], and the two agree entry for entry. Their product is 40098, which is |det A| = 40098. The Hermite form of the same matrix reaches 27 bits against the Smith form's 16, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitss615 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-4·10⁴Π invariants4·10⁴SNF widest16HNF widest27det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 30 The invariant factors of a map on the same lattice.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = -522130948717689337 on a wide matrix of order 6, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 3 word-sized primes put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns -5.22130949·10¹⁷, a relative error of 2.451·10⁻¹⁶, which is what a determinant of 59 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 65 bits are needed and 3 primes supply them.Bareiss59 bitsrationals59 bitsmodular26 bitsthe answer59 bitsHadamard65 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 3 primes0floating-point LU2.5·10⁻¹⁶det A = -522130948717689337three routes, one integerand no tolerance anywhere in the comparison
Fig. 31 The lattice determinant, computed three ways.
One 5 × 5 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 5; over 𝔽2 and 𝔽3 it is 3 and 4. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.5𝔽23𝔽34𝔽55𝔽75𝔽115𝔽135𝔽1015𝔽655375rank, by the ring the entries are read inthe rank of one matrixover ℚ5over 𝔽23over 𝔽34over 𝔽55over 𝔽75nothing is rounded hereand the answer still is not a property of the matrix
Fig. 32 Its rank, read in three rings.
The determinant's length, and the bound that decides how many primes to use before any of them is chosenSolid: Hadamard's bound on |det A|, the product of the row 2-norms, in bits. Dotted: the determinant's actual length. The bound is what a modular determinant budgets against — at n = 11 the random family needs 47 bits, which is 2 word-sized primes at 26 bits each, and that count is fixed before the first residue is computed. On a Sylvester Hadamard matrix of order 8 the bound is 13 bits and the determinant has 13, so the bound is attained rather than merely satisfied. On the unit triangular family the determinant is 1 at every size while the bound grows, which is the gap the budget pays for: a matrix can have a determinant of one and rows that are long.34567891011110¹10²nbitsthe budget and what it buysrandom, bound47random, actual33primes needed2Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 33 Hadamard, whose equality case is an orthogonal basis.

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.

DeterminantExact arithmeticLatticeLattice reductionOrthogonality defectRational reconstructionUnimodular