Struct ark_ed_on_bls12_381::FqConfig
source · pub struct FqConfig;
Trait Implementations§
source§impl MontConfig<4> for FrConfig
impl MontConfig<4> for FrConfig
source§fn neg_in_place(a: &mut Fp<MontBackend<FrConfig, 4>, 4>)
fn neg_in_place(a: &mut Fp<MontBackend<FrConfig, 4>, 4>)
Sets a = -a
.
source§const MODULUS: BigInt<4> = BigInt([18446744069414584321u64, 6034159408538082302u64,
3691218898639771653u64, 8353516859464449352u64])
const MODULUS: BigInt<4> = BigInt([18446744069414584321u64, 6034159408538082302u64, 3691218898639771653u64, 8353516859464449352u64])
The modulus of the field.
source§const GENERATOR: Fp<MontBackend<FrConfig, 4>, 4> = {
let (is_positive, limbs) = (true, [7u64]);
::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs)
}
const GENERATOR: Fp<MontBackend<FrConfig, 4>, 4> = { let (is_positive, limbs) = (true, [7u64]); ::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs) }
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<FrConfig, 4>, 4> = {
let (is_positive, limbs) =
(true,
[4046931900703378731u64, 13129826145616953529u64,
15031722638446171060u64, 1631043718794977056u64]);
::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs)
}
const TWO_ADIC_ROOT_OF_UNITY: Fp<MontBackend<FrConfig, 4>, 4> = { let (is_positive, limbs) = (true, [4046931900703378731u64, 13129826145616953529u64, 15031722638446171060u64, 1631043718794977056u64]); ::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs) }
2^s root of unity computed by GENERATOR^t
source§const SMALL_SUBGROUP_BASE: Option<u32> = Some(3u32)
const SMALL_SUBGROUP_BASE: Option<u32> = Some(3u32)
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> = Some(1u32)
const SMALL_SUBGROUP_BASE_ADICITY: Option<u32> = Some(1u32)
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<FrConfig, 4>, 4>> = Some({
let (is_positive, limbs) =
(true,
[196249104034986263u64, 9632877624223158608u64,
16881125688358416649u64, 4331619260936696776u64]);
::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs)
})
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<Fp<MontBackend<FrConfig, 4>, 4>> = Some({ let (is_positive, limbs) = (true, [196249104034986263u64, 9632877624223158608u64, 16881125688358416649u64, 4331619260936696776u64]); ::ark_ff::Fp::from_sign_and_limbs(is_positive, &limbs) })
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<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
fn add_assign(
a: &mut Fp<MontBackend<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
Sets
a = a + b
.source§fn sub_assign(
a: &mut Fp<MontBackend<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
fn sub_assign(
a: &mut Fp<MontBackend<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
Sets
a = a - b
.source§fn double_in_place(a: &mut Fp<MontBackend<FrConfig, 4>, 4>)
fn double_in_place(a: &mut Fp<MontBackend<FrConfig, 4>, 4>)
Sets
a = 2 * a
.source§fn mul_assign(
a: &mut Fp<MontBackend<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
fn mul_assign(
a: &mut Fp<MontBackend<FrConfig, 4>, 4>,
b: &Fp<MontBackend<FrConfig, 4>, 4>
)
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<FrConfig, 4>, 4>)
fn sum_of_products<const M: usize>(
a: &[Fp<MontBackend<FrConfig, 4>, 4>; M],
b: &[Fp<MontBackend<FrConfig, 4>, 4>; M]
) -> Fp<MontBackend<FrConfig, 4>, 4>
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.