FieldElement2625x4

Struct FieldElement2625x4 

Source
pub struct FieldElement2625x4(pub(crate) [u32x8; 5]);
Expand description

A vector of four field elements.

Each operation on a FieldElement2625x4 has documented effects on the bounds of the coefficients. This API is designed for speed and not safety; it is the caller’s responsibility to ensure that the post-conditions of one operation are compatible with the pre-conditions of the next.

Tuple Fields§

§0: [u32x8; 5]

Implementations§

Source§

impl FieldElement2625x4

Source

pub const ZERO: FieldElement2625x4

Source

pub fn split(&self) -> [FieldElement51; 4]

Split this vector into an array of four (serial) field elements.

Source

pub fn shuffle(&self, control: Shuffle) -> FieldElement2625x4

Rearrange the elements of this vector according to control.

The control parameter should be a compile-time constant, so that when this function is inlined, LLVM is able to lower the shuffle using an immediate.

Source

pub fn blend( &self, other: FieldElement2625x4, control: Lanes, ) -> FieldElement2625x4

Blend self with other, taking lanes specified in control from other.

The control parameter should be a compile-time constant, so that this function can be inlined and LLVM can lower it to a blend instruction using an immediate.

Source

pub fn splat(x: &FieldElement51) -> FieldElement2625x4

Convenience wrapper around new(x,x,x,x).

Source

pub fn new( x0: &FieldElement51, x1: &FieldElement51, x2: &FieldElement51, x3: &FieldElement51, ) -> FieldElement2625x4

Create a FieldElement2625x4 from four FieldElement51s.

§Postconditions

The resulting FieldElement2625x4 is bounded with \( b < 0.0002 \).

Source

pub fn negate_lazy(&self) -> FieldElement2625x4

Given \((A,B,C,D)\), compute \((-A,-B,-C,-D)\), without performing a reduction.

§Preconditions

The coefficients of self must be bounded with \( b < 0.999 \).

§Postconditions

The coefficients of the result are bounded with \( b < 1 \).

Source

pub fn diff_sum(&self) -> FieldElement2625x4

Given self = (A,B,C,D), compute (B - A, B + A, D - C, D + C).

§Preconditions

The coefficients of self must be bounded with \( b < 0.01 \).

§Postconditions

The coefficients of the result are bounded with \( b < 1.6 \).

Source

pub fn reduce(&self) -> FieldElement2625x4

Reduce this vector of field elements \(\mathrm{mod} p\).

§Postconditions

The coefficients of the result are bounded with \( b < 0.0002 \).

Source

fn reduce64(z: [u64x4; 10]) -> FieldElement2625x4

Given an array of wide coefficients, reduce them to a FieldElement2625x4.

§Postconditions

The coefficients of the result are bounded with \( b < 0.007 \).

Source

pub fn square_and_negate_D(&self) -> FieldElement2625x4

Square this field element, and negate the result’s \(D\) value.

§Preconditions

The coefficients of self must be bounded with \( b < 1.5 \).

§Postconditions

The coefficients of the result are bounded with \( b < 0.007 \).

Trait Implementations§

Source§

impl Add for FieldElement2625x4

Source§

fn add(self, rhs: FieldElement2625x4) -> FieldElement2625x4

Add two FieldElement2625x4s, without performing a reduction.

Source§

type Output = FieldElement2625x4

The resulting type after applying the + operator.
Source§

impl Clone for FieldElement2625x4

Source§

fn clone(&self) -> FieldElement2625x4

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConditionallySelectable for FieldElement2625x4

Source§

fn conditional_select( a: &FieldElement2625x4, b: &FieldElement2625x4, choice: Choice, ) -> FieldElement2625x4

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &FieldElement2625x4, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

impl Debug for FieldElement2625x4

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Mul<&FieldElement2625x4> for &FieldElement2625x4

Source§

fn mul(self, rhs: &FieldElement2625x4) -> FieldElement2625x4

Multiply self by rhs.

§Preconditions

The coefficients of self must be bounded with \( b < 2.5 \).

The coefficients of rhs must be bounded with \( b < 1.75 \).

§Postconditions

The coefficients of the result are bounded with \( b < 0.007 \).

Source§

type Output = FieldElement2625x4

The resulting type after applying the * operator.
Source§

impl Mul<(u32, u32, u32, u32)> for FieldElement2625x4

Source§

fn mul(self, scalars: (u32, u32, u32, u32)) -> FieldElement2625x4

Perform a multiplication by a vector of small constants.

§Postconditions

The coefficients of the result are bounded with \( b < 0.007 \).

Source§

type Output = FieldElement2625x4

The resulting type after applying the * operator.
Source§

impl Neg for FieldElement2625x4

Source§

fn neg(self) -> FieldElement2625x4

Negate this field element, performing a reduction.

If the coefficients are known to be small, use negate_lazy to avoid performing a reduction.

§Preconditions

The coefficients of self must be bounded with \( b < 4.0 \).

§Postconditions

The coefficients of the result are bounded with \( b < 0.0002 \).

Source§

type Output = FieldElement2625x4

The resulting type after applying the - operator.
Source§

impl Copy for FieldElement2625x4

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.