pub struct Polynomial<FF: FiniteField> {
    pub coefficients: Vec<FF>,
}

Fields§

§coefficients: Vec<FF>

Implementations§

source§

impl<FF> Polynomial<FF>where FF: FiniteField + MulAssign<BFieldElement>,

source

pub fn scale(&self, alpha: &BFieldElement) -> Self

source

pub fn fast_square(&self) -> Self

source

pub fn square(&self) -> Self

source

pub fn fast_mod_pow(&self, pow: BigInt) -> Self

source

pub fn fast_multiply( lhs: &Self, rhs: &Self, primitive_root: &BFieldElement, root_order: usize ) -> Self

source

pub fn fast_zerofier( domain: &[FF], primitive_root: &BFieldElement, root_order: usize ) -> Self

source

pub fn fast_evaluate( &self, domain: &[FF], primitive_root: &BFieldElement, root_order: usize ) -> Vec<FF>

source

pub fn fast_interpolate( domain: &[FF], values: &[FF], primitive_root: &BFieldElement, root_order: usize ) -> Self

source

pub fn batch_fast_interpolate( domain: &[FF], values_matrix: &Vec<Vec<FF>>, primitive_root: &BFieldElement, root_order: usize ) -> Vec<Self>

source

pub fn fast_coset_evaluate( &self, offset: &BFieldElement, generator: BFieldElement, order: usize ) -> Vec<FF>

Fast evaluate on a coset domain, which is the group generated by generator^i * offset

source

pub fn fast_coset_interpolate( offset: &BFieldElement, generator: BFieldElement, values: &[FF] ) -> Self

The inverse of fast_coset_evaluate

source

pub fn fast_coset_divide( lhs: &Polynomial<FF>, rhs: &Polynomial<FF>, offset: BFieldElement, primitive_root: BFieldElement, root_order: usize ) -> Polynomial<FF>

Divide two polynomials under the homomorphism of evaluation for a N^2 -> N*log(N) speedup Since we often want to use this fast division for numerators and divisors that evaluate to zero in their domain, we do the division with an offset from the polynomials’ original domains. The issue of zero in the numerator and divisor arises when we divide a transition polynomial with a zerofier.

source§

impl<FF: FiniteField> Polynomial<FF>

source

pub const fn new(coefficients: Vec<FF>) -> Self

source

pub fn new_const(element: FF) -> Self

source

pub fn normalize(&mut self)

source

pub fn from_constant(constant: FF) -> Self

source

pub fn is_x(&self) -> bool

source

pub fn evaluate(&self, x: &FF) -> FF

source

pub fn leading_coefficient(&self) -> Option<FF>

source

pub fn lagrange_interpolate(domain: &[FF], values: &[FF]) -> Self

source

pub fn are_colinear_3(p0: (FF, FF), p1: (FF, FF), p2: (FF, FF)) -> bool

source

pub fn get_colinear_y(p0: (FF, FF), p1: (FF, FF), p2_x: FF) -> FF

source

pub fn zerofier(domain: &[FF]) -> Self

source

pub fn slow_square(&self) -> Self

source§

impl<FF: FiniteField> Polynomial<FF>

source

pub fn are_colinear(points: &[(FF, FF)]) -> bool

source

pub fn lagrange_interpolate_zipped(points: &[(FF, FF)]) -> Self

source§

impl<FF: FiniteField> Polynomial<FF>

source

pub fn multiply(self, other: Self) -> Self

source

pub fn mod_pow(&self, pow: BigInt) -> Self

source

pub fn shift_coefficients_mut(&mut self, power: usize, zero: FF)

source

pub fn shift_coefficients(&self, power: usize) -> Self

source

pub fn scalar_mul_mut(&mut self, scalar: FF)

source

pub fn scalar_mul(&self, scalar: FF) -> Self

source

pub fn divide(&self, divisor: Self) -> (Self, Self)

Return (quotient, remainder)

source§

impl<FF: FiniteField> Polynomial<FF>

source

pub fn xgcd( x: Polynomial<FF>, y: Polynomial<FF> ) -> (Polynomial<FF>, Polynomial<FF>, Polynomial<FF>)

Extended Euclidean algorithm with polynomials. Computes the greatest common divisor gcd as a monic polynomial, as well as the corresponding Bézout coefficients a and b, satisfying gcd = a·x + b·y

source§

impl<FF: FiniteField> Polynomial<FF>

source

pub fn degree(&self) -> isize

source

pub fn formal_derivative(&self) -> Self

Trait Implementations§

source§

impl<FF: FiniteField> Add<Polynomial<FF>> for Polynomial<FF>

§

type Output = Polynomial<FF>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl<FF: FiniteField> AddAssign<Polynomial<FF>> for Polynomial<FF>

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<FF: Clone + FiniteField> Clone for Polynomial<FF>

source§

fn clone(&self) -> Polynomial<FF>

Returns a copy 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<FF: FiniteField> Debug for Polynomial<FF>

source§

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

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

impl<FF: FiniteField> Display for Polynomial<FF>

source§

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

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

impl<FF: FiniteField> Div<Polynomial<FF>> for Polynomial<FF>

§

type Output = Polynomial<FF>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl From<Polynomial<BFieldElement>> for XFieldElement

source§

fn from(poly: Polynomial<BFieldElement>) -> Self

Converts to this type from the input type.
source§

impl From<XFieldElement> for Polynomial<BFieldElement>

source§

fn from(item: XFieldElement) -> Self

Converts to this type from the input type.
source§

impl<FF: FiniteField> Hash for Polynomial<FF>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<FF: FiniteField> Mul<Polynomial<FF>> for Polynomial<FF>

§

type Output = Polynomial<FF>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl<FF: FiniteField> One for Polynomial<FF>

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

impl<FF: FiniteField> PartialEq<Polynomial<FF>> for Polynomial<FF>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<FF: FiniteField> Rem<Polynomial<FF>> for Polynomial<FF>

§

type Output = Polynomial<FF>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
source§

impl<FF: FiniteField> Sub<Polynomial<FF>> for Polynomial<FF>

§

type Output = Polynomial<FF>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<FF: FiniteField> Zero for Polynomial<FF>

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<FF: FiniteField> Eq for Polynomial<FF>

Auto Trait Implementations§

§

impl<FF> RefUnwindSafe for Polynomial<FF>where FF: RefUnwindSafe,

§

impl<FF> Send for Polynomial<FF>

§

impl<FF> Sync for Polynomial<FF>

§

impl<FF> Unpin for Polynomial<FF>where FF: Unpin,

§

impl<FF> UnwindSafe for Polynomial<FF>where FF: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 Twhere 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 = mem::align_of::<T>()

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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for Twhere T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,