Skip to main content

tonelli_shanks_two_adic

Function tonelli_shanks_two_adic 

Source
pub fn tonelli_shanks_two_adic<F: TwoAdicField>(a: F) -> Option<F>
Expand description

Return a square root of a if one exists, otherwise None.

A variant of tonelli_shanks for two-adic fields. It seeds the 2-Sylow subgroup directly from TwoAdicField::two_adic_generator (a primitive 2^TWO_ADICITY-th root of unity), avoiding the GENERATOR^q exponentiation that the generic version performs on every call.

For a quadratic residue this returns one of its two square roots; which one is unspecified. ZERO maps to ZERO.