Struct sp1_core::air::Polynomial
source · pub struct Polynomial<T> { /* private fields */ }Expand description
A polynomial represented as a vector of coefficients.
Implementations§
source§impl<T> Polynomial<T>
impl<T> Polynomial<T>
sourcepub const fn new(coefficients: Vec<T>) -> Self
pub const fn new(coefficients: Vec<T>) -> Self
Create a new polynomial from a vector of coefficients.
sourcepub fn from_coefficients(coefficients: &[T]) -> Selfwhere
T: Clone,
pub fn from_coefficients(coefficients: &[T]) -> Selfwhere
T: Clone,
Create a new polynomial from a slice of coefficients.
sourcepub fn as_coefficients(self) -> Vec<T>
pub fn as_coefficients(self) -> Vec<T>
Gets the coefficients of the polynomial.
sourcepub fn coefficients(&self) -> &[T]
pub fn coefficients(&self) -> &[T]
Gets the coefficients of the polynomial.
sourcepub fn eval<S: AbstractExtensionField<T>>(&self, x: S) -> Swhere
T: AbstractField,
pub fn eval<S: AbstractExtensionField<T>>(&self, x: S) -> Swhere
T: AbstractField,
Evaluates the polynomial at a given point.
sourcepub fn root_quotient(&self, r: T) -> Selfwhere
T: Field,
pub fn root_quotient(&self, r: T) -> Selfwhere
T: Field,
Computes the root quotient of the polynomial.
source§impl Polynomial<u8>
impl Polynomial<u8>
pub fn as_field<F: Field>(self) -> Polynomial<F>
Trait Implementations§
source§impl<T: Add<Output = T> + Clone> Add<&Polynomial<T>> for Polynomial<T>
impl<T: Add<Output = T> + Clone> Add<&Polynomial<T>> for Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
+ operator.source§fn add(self, other: &Polynomial<T>) -> Polynomial<T>
fn add(self, other: &Polynomial<T>) -> Polynomial<T>
Performs the
+ operation. Read moresource§impl<T: Mul<Output = T> + Add<Output = T> + Add + Clone> Add<T> for &Polynomial<T>
impl<T: Mul<Output = T> + Add<Output = T> + Add + Clone> Add<T> for &Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
+ operator.source§fn add(self, other: T) -> Polynomial<T>
fn add(self, other: T) -> Polynomial<T>
Performs the
+ operation. Read moresource§impl<T: Mul<Output = T> + Add<Output = T> + AddAssign + Clone> Add<T> for Polynomial<T>
impl<T: Mul<Output = T> + Add<Output = T> + AddAssign + Clone> Add<T> for Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
+ operator.source§fn add(self, other: T) -> Polynomial<T>
fn add(self, other: T) -> Polynomial<T>
Performs the
+ operation. Read moresource§impl<T: Add<Output = T> + Clone> Add for &Polynomial<T>
impl<T: Add<Output = T> + Clone> Add for &Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
+ operator.source§fn add(self, other: Self) -> Polynomial<T>
fn add(self, other: Self) -> Polynomial<T>
Performs the
+ operation. Read moresource§impl<T: Clone> Clone for Polynomial<T>
impl<T: Clone> Clone for Polynomial<T>
source§fn clone(&self) -> Polynomial<T>
fn clone(&self) -> Polynomial<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<T: Debug> Debug for Polynomial<T>
impl<T: Debug> Debug for Polynomial<T>
source§impl<Var: Into<Expr> + Clone, N: ArrayLength, Expr: Clone> From<Limbs<Var, N>> for Polynomial<Expr>
impl<Var: Into<Expr> + Clone, N: ArrayLength, Expr: Clone> From<Limbs<Var, N>> for Polynomial<Expr>
source§impl<T: Debug + Default + Clone, N: ArrayLength> From<Polynomial<T>> for Limbs<T, N>
impl<T: Debug + Default + Clone, N: ArrayLength> From<Polynomial<T>> for Limbs<T, N>
source§fn from(value: Polynomial<T>) -> Self
fn from(value: Polynomial<T>) -> Self
Converts to this type from the input type.
source§impl<T> FromIterator<T> for Polynomial<T>
impl<T> FromIterator<T> for Polynomial<T>
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<T: AbstractField> Mul<T> for &Polynomial<T>
impl<T: AbstractField> Mul<T> for &Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
* operator.source§fn mul(self, other: T) -> Polynomial<T>
fn mul(self, other: T) -> Polynomial<T>
Performs the
* operation. Read moresource§impl<T: AbstractField> Mul<T> for Polynomial<T>
impl<T: AbstractField> Mul<T> for Polynomial<T>
source§impl<T: AbstractField> Mul for &Polynomial<T>
impl<T: AbstractField> Mul for &Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
* operator.source§fn mul(self, other: Self) -> Polynomial<T>
fn mul(self, other: Self) -> Polynomial<T>
Performs the
* operation. Read moresource§impl<T: AbstractField> Mul for Polynomial<T>
impl<T: AbstractField> Mul for Polynomial<T>
source§impl<T: Neg<Output = T>> Neg for Polynomial<T>
impl<T: Neg<Output = T>> Neg for Polynomial<T>
source§impl<T: Eq + AbstractField> PartialEq for Polynomial<T>
impl<T: Eq + AbstractField> PartialEq for Polynomial<T>
source§fn eq(&self, other: &Polynomial<T>) -> bool
fn eq(&self, other: &Polynomial<T>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<T: Sub<Output = T> + Neg<Output = T> + Clone> Sub<&Polynomial<T>> for Polynomial<T>
impl<T: Sub<Output = T> + Neg<Output = T> + Clone> Sub<&Polynomial<T>> for Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
- operator.source§fn sub(self, other: &Polynomial<T>) -> Polynomial<T>
fn sub(self, other: &Polynomial<T>) -> Polynomial<T>
Performs the
- operation. Read moresource§impl<T: Sub<Output = T> + Neg<Output = T> + Clone> Sub for &Polynomial<T>
impl<T: Sub<Output = T> + Neg<Output = T> + Clone> Sub for &Polynomial<T>
§type Output = Polynomial<T>
type Output = Polynomial<T>
The resulting type after applying the
- operator.source§fn sub(self, other: Self) -> Polynomial<T>
fn sub(self, other: Self) -> Polynomial<T>
Performs the
- operation. Read moreAuto Trait Implementations§
impl<T> Freeze for Polynomial<T>
impl<T> RefUnwindSafe for Polynomial<T>where
T: RefUnwindSafe,
impl<T> Send for Polynomial<T>where
T: Send,
impl<T> Sync for Polynomial<T>where
T: Sync,
impl<T> Unpin for Polynomial<T>where
T: Unpin,
impl<T> UnwindSafe for Polynomial<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more