Skip to main content

double

Function double 

Source
pub(crate) fn double<U: Limbs>(
    a: U,
    b: (Choice, U),
    c: U::Wide,
) -> (U::Wide, (Choice, U::Wide))
Expand description

Compose a positive definite binary quadratic form with itself.

This requires the form be well-defined, primitive, and with negative odd discriminant. The form is not bound to be reduced however.

This function assumes:

  • floor(log_2(a)) + 1 < AsRef::<[Limb]>::as_ref(&a).len() * Limb::BITS
  • AsRef::<[Limb]>::as_ref(&a).len() == AsRef::<[Limb]>::as_ref(&b.1).len()

This returns the unreduced a', b' coefficients of the resulting form, with the following bounds:

  • $a’ < 2^(floor(log_2(a^2)) + 1)$
  • $b’ < 2^(1 + max(floor(log_2(|b|)), floor(log_2(2 * a^2))) + 1)$