Struct ark_ff::fields::models::fp::MontBackend

source ·
pub struct MontBackend<T: MontConfig<N>, const N: usize>(/* private fields */);

Trait Implementations§

source§

impl<T: MontConfig<N>, const N: usize> FpConfig<N> for MontBackend<T, N>

source§

const MODULUS: BigInt<N> = T::MODULUS

The modulus of the field.

source§

const GENERATOR: Fp<Self, N> = T::GENERATOR

A multiplicative generator of the field. Self::GENERATOR is an element having multiplicative order Self::MODULUS - 1.

source§

const ZERO: Fp<Self, N> = _

Additive identity of the field, i.e. the element e such that, for all elements f of the field, e + f = f.

source§

const ONE: Fp<Self, N> = _

Multiplicative identity of the field, i.e. the element e such that, for all elements f of the field, e * f = f.

source§

fn mul_assign(a: &mut Fp<Self, N>, b: &Fp<Self, N>)

This modular multiplication algorithm uses Montgomery reduction for efficient implementation. It also additionally uses the “no-carry optimization” outlined here if P::MODULUS has (a) a non-zero MSB, and (b) at least one zero bit in the rest of the modulus.

source§

const TWO_ADICITY: u32 = _

Let N be the size of the multiplicative group defined by the field. Then TWO_ADICITY is the two-adicity of N, i.e. the integer s such that N = 2^s * t for some odd integer t.
source§

const TWO_ADIC_ROOT_OF_UNITY: Fp<Self, N> = T::TWO_ADIC_ROOT_OF_UNITY

2^s root of unity computed by GENERATOR^t
source§

const SMALL_SUBGROUP_BASE: Option<u32> = T::SMALL_SUBGROUP_BASE

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> = T::SMALL_SUBGROUP_BASE_ADICITY

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<Self, N>> = T::LARGE_SUBGROUP_ROOT_OF_UNITY

GENERATOR^((MODULUS-1) / (2^s * SMALL_SUBGROUP_BASE^SMALL_SUBGROUP_BASE_ADICITY)) Used for mixed-radix FFT.
source§

const SQRT_PRECOMP: Option<SqrtPrecomputation<Fp<Self, N>>> = T::SQRT_PRECOMP

Precomputed material for use when computing square roots. Currently uses the generic Tonelli-Shanks, which works for every modulus.
source§

fn add_assign(a: &mut Fp<Self, N>, b: &Fp<Self, N>)

Set a += b.
source§

fn sub_assign(a: &mut Fp<Self, N>, b: &Fp<Self, N>)

Set a -= b.
source§

fn double_in_place(a: &mut Fp<Self, N>)

Set a = a + a.
source§

fn neg_in_place(a: &mut Fp<Self, N>)

Set a = -a;
source§

fn sum_of_products<const M: usize>( a: &[Fp<Self, N>; M], b: &[Fp<Self, N>; M] ) -> Fp<Self, N>

Compute the inner product <a, b>.
source§

fn square_in_place(a: &mut Fp<Self, N>)

Set a *= b.
source§

fn inverse(a: &Fp<Self, N>) -> Option<Fp<Self, N>>

Compute a^{-1} if a is not zero.
source§

fn from_bigint(r: BigInt<N>) -> Option<Fp<Self, N>>

Construct a field element from an integer in the range 0..(Self::MODULUS - 1). Returns None if the integer is outside this range.
source§

fn into_bigint(a: Fp<Self, N>) -> BigInt<N>

Convert a field element to an integer in the range 0..(Self::MODULUS - 1).

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for MontBackend<T, N>

§

impl<T, const N: usize> RefUnwindSafe for MontBackend<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for MontBackend<T, N>

§

impl<T, const N: usize> Sync for MontBackend<T, N>

§

impl<T, const N: usize> Unpin for MontBackend<T, N>
where T: Unpin,

§

impl<T, const N: usize> UnwindSafe for MontBackend<T, N>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V