Skip to main content

normalize

Function normalize 

Source
fn normalize<L: Limbs>(a: L, b: (Choice, L), c: L) -> (L, (Choice, L), L)
Expand description

Normalize an almost-reduced element.

For a positive definite binary quadratic form (a, b, c) such that:

  • b^2 - 4ac = delta where delta < 0 (the form is well-defined for a negative discriminant)
  • $delta \cong 1 \mod 2$
  • 0 <= a, c (a and c aren’t negative, as enforced by the type system)
  • |b| <= a <= c

Yield the reduced equivalent form (a', b', c') such that:

  • |b'| <= a' <= c'
  • b' >= 0 if (|b'| == a') || (a' == c')

This is intended to correspond to steps 2 and 5 of Algorithm 1.