Enum snarkvm_algorithms::fft::polynomial::Polynomial
source · pub enum Polynomial<'a, F: Field> {
Sparse(Cow<'a, SparsePolynomial<F>>),
Dense(Cow<'a, DensePolynomial<F>>),
}
Expand description
Represents either a sparse polynomial or a dense one.
Variants§
Sparse(Cow<'a, SparsePolynomial<F>>)
Represents the case where self
is a sparse polynomial
Dense(Cow<'a, DensePolynomial<F>>)
Represents the case where self
is a dense polynomial
Implementations§
source§impl<'a, F: Field> Polynomial<'a, F>
impl<'a, F: Field> Polynomial<'a, F>
pub fn leading_coefficient(&self) -> Option<&F>
pub fn as_dense(&self) -> Option<&DensePolynomial<F>>
pub fn to_dense(&self) -> Cow<'_, DensePolynomial<F>>
pub fn as_dense_mut(&mut self) -> Option<&mut DensePolynomial<F>>
pub fn as_sparse(&self) -> Option<&SparsePolynomial<F>>
pub fn into_dense(&self) -> DensePolynomial<F>
pub fn evaluate(&self, point: F) -> F
pub fn coeffs(&'a self) -> Box<dyn Iterator<Item = (usize, &'a F)> + 'a>
sourcepub fn divide_with_q_and_r(
&self,
divisor: &Self
) -> Result<(DensePolynomial<F>, DensePolynomial<F>)>
pub fn divide_with_q_and_r( &self, divisor: &Self ) -> Result<(DensePolynomial<F>, DensePolynomial<F>)>
Divide self by another (sparse or dense) polynomial, and returns the quotient and remainder.
source§impl<F: PrimeField> Polynomial<'_, F>
impl<F: PrimeField> Polynomial<'_, F>
sourcepub fn evaluate_over_domain(
poly: impl Into<Self>,
domain: EvaluationDomain<F>
) -> Evaluations<F>
pub fn evaluate_over_domain( poly: impl Into<Self>, domain: EvaluationDomain<F> ) -> Evaluations<F>
Construct Evaluations
by evaluating a polynomial over the domain domain
.
Trait Implementations§
source§impl<'a, F: Field> AddAssign<&'a Polynomial<'a, F>> for DensePolynomial<F>
impl<'a, F: Field> AddAssign<&'a Polynomial<'a, F>> for DensePolynomial<F>
source§fn add_assign(&mut self, other: &'a Polynomial<'_, F>)
fn add_assign(&mut self, other: &'a Polynomial<'_, F>)
Performs the
+=
operation. Read moresource§impl<'a, F: Field> CanonicalDeserialize for Polynomial<'a, F>
impl<'a, F: Field> CanonicalDeserialize for Polynomial<'a, F>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where R: Read,
fn deserialize_compressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>where R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where R: Read,
fn deserialize_uncompressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>where R: Read,
source§impl<'a, F: Field> CanonicalSerialize for Polynomial<'a, F>
impl<'a, F: Field> CanonicalSerialize for Polynomial<'a, F>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress ) -> Result<(), SerializationError>
fn serialized_size(&self, mode: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where W: Write,
fn uncompressed_size(&self) -> usize
source§impl<'a, F: Clone + Field> Clone for Polynomial<'a, F>
impl<'a, F: Clone + Field> Clone for Polynomial<'a, F>
source§fn clone(&self) -> Polynomial<'a, F>
fn clone(&self) -> Polynomial<'a, F>
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<'a, F: Field> From<&'a DensePolynomial<F>> for Polynomial<'a, F>
impl<'a, F: Field> From<&'a DensePolynomial<F>> for Polynomial<'a, F>
source§fn from(other: &'a DensePolynomial<F>) -> Self
fn from(other: &'a DensePolynomial<F>) -> Self
Converts to this type from the input type.
source§impl<'a, F: Field> From<&'a SparsePolynomial<F>> for Polynomial<'a, F>
impl<'a, F: Field> From<&'a SparsePolynomial<F>> for Polynomial<'a, F>
source§fn from(other: &'a SparsePolynomial<F>) -> Self
fn from(other: &'a SparsePolynomial<F>) -> Self
Converts to this type from the input type.
source§impl<F: Field> From<DensePolynomial<F>> for Polynomial<'_, F>
impl<F: Field> From<DensePolynomial<F>> for Polynomial<'_, F>
source§fn from(other: DensePolynomial<F>) -> Self
fn from(other: DensePolynomial<F>) -> Self
Converts to this type from the input type.
source§impl<F: Field> From<SparsePolynomial<F>> for Polynomial<'_, F>
impl<F: Field> From<SparsePolynomial<F>> for Polynomial<'_, F>
source§fn from(other: SparsePolynomial<F>) -> Self
fn from(other: SparsePolynomial<F>) -> Self
Converts to this type from the input type.
source§impl<F: Field> Into<DensePolynomial<F>> for Polynomial<'_, F>
impl<F: Field> Into<DensePolynomial<F>> for Polynomial<'_, F>
source§fn into(self) -> DensePolynomial<F>
fn into(self) -> DensePolynomial<F>
Converts this type into the (usually inferred) input type.
source§impl<'a, F: PartialEq + Field> PartialEq for Polynomial<'a, F>
impl<'a, F: PartialEq + Field> PartialEq for Polynomial<'a, F>
source§fn eq(&self, other: &Polynomial<'a, F>) -> bool
fn eq(&self, other: &Polynomial<'a, F>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<F: Field> TryInto<SparsePolynomial<F>> for Polynomial<'_, F>
impl<F: Field> TryInto<SparsePolynomial<F>> for Polynomial<'_, F>
source§impl<'a, F: Field> Valid for Polynomial<'a, F>
impl<'a, F: Field> Valid for Polynomial<'a, F>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send ) -> Result<(), SerializationError>where Self: 'a,
impl<'a, F: Eq + Field> Eq for Polynomial<'a, F>
impl<'a, F: Field> StructuralEq for Polynomial<'a, F>
impl<'a, F: Field> StructuralPartialEq for Polynomial<'a, F>
Auto Trait Implementations§
impl<'a, F> RefUnwindSafe for Polynomial<'a, F>where F: RefUnwindSafe,
impl<'a, F> Send for Polynomial<'a, F>
impl<'a, F> Sync for Polynomial<'a, F>
impl<'a, F> Unpin for Polynomial<'a, F>where F: Unpin,
impl<'a, F> UnwindSafe for Polynomial<'a, F>where F: UnwindSafe + RefUnwindSafe,
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.