← LibraryIntegral LLL: Avoiding Floating PointEngineering · MathematicsLesson 252/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginintegral LLLexact arithmeticfloating pointscaled Gram-Schmidt

Lattices and LLL Reduction

Integral LLL: Avoiding Floating Point

Running LLL entirely in integer arithmetic using scaled Gram-Schmidt quantities, and why this matters for exact downstream computation.

Engineering / MathematicsLattices and LLL Reduction2 min readKV-MATH-0549

Floating-point LLL is faster and fails silently. The integral variant carries scaled Gram-Schmidt quantities as exact integers, which is slower but produces a result that can be trusted inside an exact computation.

The problem with floating point

The integral approach

Rather than storing the rational coefficients directly, store them scaled by the relevant Gram determinants, which makes them integers. All comparisons in the algorithm can then be rewritten as integer comparisons.

Store d_k = det of the k-th leading Gram submatrix, and lambda_{ij} = d_j * mu_{ij}Both are integers; the divisions occurring are exact.

Cost

Choosing an LLL arithmetic variant
VariantSpeedReliabilityUse when
Floating pointFastestCan fail silentlyResult is verified downstream anyway
IntegralSlower, entries growExactResult feeds an exact computation
Floating point with fallbackFast in the common caseExactBest of both, if the check is genuinely exact

The hybrid pattern

Hybrid floating point and exact LLL

  1. Reduce in floating pointFast, produces a candidate basis and the transformation matrix.
  2. Verify exactlyApply the transformation to the exact input and check the reduction conditions in integers.
  3. Fall backIf verification fails, re-run integrally, or increase precision and retry.

Where exactness is mandatory

Any use inside Hermite normal form computation or polynomial factorisation requires an exact result, because a wrong basis there produces a wrong answer rather than merely a slow one.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 2.6.3. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.

Continue learning

LLL with Deep InsertionsArticle · MathematicsNEXT LESSON →LLL for Linearly Dependent Generating SetsArticle · MathematicsLLL Reduction Quality and Proof SketchArticle · MathematicsInteger Kernel and Image via LLLArticle · Mathematics