Struct ark_bls12_381::fq::FqConfig
source · pub struct FqConfig;
Trait Implementations§
source§impl MontConfig<6> for FqConfig
impl MontConfig<6> for FqConfig
source§fn neg_in_place(a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>)
fn neg_in_place(a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>)
Sets a = -a
.
source§const GENERATOR: Fp<MontBackend<FqConfig, { _ }>, { _ }> = _
const GENERATOR: Fp<MontBackend<FqConfig, { _ }>, { _ }> = _
A multiplicative generator of the field.
Self::GENERATOR
is an element having multiplicative order
Self::MODULUS - 1
.source§const TWO_ADIC_ROOT_OF_UNITY: Fp<MontBackend<FqConfig, { _ }>, { _ }> = _
const TWO_ADIC_ROOT_OF_UNITY: Fp<MontBackend<FqConfig, { _ }>, { _ }> = _
2^s root of unity computed by GENERATOR^t
source§const SMALL_SUBGROUP_BASE: Option<u32> = _
const SMALL_SUBGROUP_BASE: Option<u32> = _
An integer
b
such that there exists a multiplicative subgroup
of size b^k
for some integer k
.source§const SMALL_SUBGROUP_BASE_ADICITY: Option<u32> = _
const SMALL_SUBGROUP_BASE_ADICITY: Option<u32> = _
The integer
k
such that there exists a multiplicative subgroup
of size Self::SMALL_SUBGROUP_BASE^k
.source§const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<Fp<MontBackend<FqConfig, { _ }>, { _ }>> = _
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<Fp<MontBackend<FqConfig, { _ }>, { _ }>> = _
GENERATOR^((MODULUS-1) / (2^s *
SMALL_SUBGROUP_BASE^SMALL_SUBGROUP_BASE_ADICITY)).
Used for mixed-radix FFT.
source§fn add_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
fn add_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
Sets
a = a + b
.source§fn sub_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
fn sub_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
Sets
a = a - b
.source§fn double_in_place(a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>)
fn double_in_place(a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>)
Sets
a = 2 * a
.source§fn mul_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
fn mul_assign(
a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>,
b: &Fp<MontBackend<FqConfig, { _ }>, { _ }>
)
This modular multiplication algorithm uses Montgomery
reduction for efficient implementation. It also additionally
uses the “no-carry optimization” outlined
here if
Self::MODULUS
has (a) a non-zero MSB, and (b) at least one
zero bit in the rest of the modulus.fn square_in_place(a: &mut Fp<MontBackend<FqConfig, { _ }>, { _ }>)
fn sum_of_products<const M: usize>(
a: &[Fp<MontBackend<FqConfig, { _ }>, { _ }>; M],
b: &[Fp<MontBackend<FqConfig, { _ }>, { _ }>; M]
) -> Fp<MontBackend<FqConfig, { _ }>, { _ }>
source§const R: BigInt<N> = Self::MODULUS.montgomery_r()
const R: BigInt<N> = Self::MODULUS.montgomery_r()
Let
M
be the power of 2^64 nearest to Self::MODULUS_BITS
. Then
R = M % Self::MODULUS
.source§const SQRT_PRECOMP: Option<SqrtPrecomputation<Fp<MontBackend<Self, N>, N>>> = sqrt_precomputation::<N, Self>()
const SQRT_PRECOMP: Option<SqrtPrecomputation<Fp<MontBackend<Self, N>, N>>> = sqrt_precomputation::<N, Self>()
Precomputed material for use when computing square roots.
The default is to use the standard Tonelli-Shanks algorithm.