pub struct MultilinearExtension<P: PackedField, Data: Deref<Target = [P]> = Vec<P>> { /* private fields */ }
Expand description
A multilinear polynomial represented by its evaluations over the boolean hypercube.
This polynomial can also be viewed as the multilinear extension of the slice of hypercube evaluations. The evaluation data may be either a borrowed or owned slice.
The packed field width must be a power of two.
Implementations§
source§impl<P: PackedField> MultilinearExtension<P>
impl<P: PackedField> MultilinearExtension<P>
source§impl<P: PackedField, Data: Deref<Target = [P]>> MultilinearExtension<P, Data>
impl<P: PackedField, Data: Deref<Target = [P]>> MultilinearExtension<P, Data>
pub fn from_values_generic(v: Data) -> Result<Self, Error>
pub fn copy_underlier_data(&self) -> Vec<u8> ⓘ
source§impl<U, F, Data> MultilinearExtension<PackedType<U, F>, PackingDeref<U, F, Data>>
impl<U, F, Data> MultilinearExtension<PackedType<U, F>, PackingDeref<U, F, Data>>
pub fn from_underliers(v: Data) -> Result<Self, Error>
source§impl<'a, P: PackedField> MultilinearExtension<P, &'a [P]>
impl<'a, P: PackedField> MultilinearExtension<P, &'a [P]>
pub fn from_values_slice(v: &'a [P]) -> Result<Self, Error>
source§impl<P: PackedField, Data: Deref<Target = [P]>> MultilinearExtension<P, Data>
impl<P: PackedField, Data: Deref<Target = [P]>> MultilinearExtension<P, Data>
pub fn n_vars(&self) -> usize
pub fn size(&self) -> usize
pub fn evals(&self) -> &[P]
pub fn to_ref(&self) -> MultilinearExtension<P, &[P]>
sourcepub fn packed_evaluate_on_hypercube(&self, index: usize) -> Result<P, Error>
pub fn packed_evaluate_on_hypercube(&self, index: usize) -> Result<P, Error>
Get the evaluations of the polynomial on a subcube of the hypercube of size equal to the packing width.
§Arguments
index
- The index of the subcube
pub fn evaluate_on_hypercube(&self, index: usize) -> Result<P::Scalar, Error>
source§impl<P, Data> MultilinearExtension<P, Data>
impl<P, Data> MultilinearExtension<P, Data>
pub fn evaluate<'a, FE, PE>( &self, query: impl Into<MultilinearQueryRef<'a, PE>>, ) -> Result<FE, Error>
sourcepub fn evaluate_partial_high<'a, PE>(
&self,
query: impl Into<MultilinearQueryRef<'a, PE>>,
) -> Result<MultilinearExtension<PE>, Error>
pub fn evaluate_partial_high<'a, PE>( &self, query: impl Into<MultilinearQueryRef<'a, PE>>, ) -> Result<MultilinearExtension<PE>, Error>
Partially evaluate the polynomial with assignment to the high-indexed variables.
The polynomial is multilinear with $\mu$ variables, $p(X_0, …, X_{\mu - 1}$. Given a query vector of length $k$ representing $(z_{\mu - k + 1}, …, z_{\mu - 1})$, this returns the multilinear polynomial with $\mu - k$ variables, $p(X_0, …, X_{\mu - k}, z_{\mu - k + 1}, …, z_{\mu - 1})$.
REQUIRES: the size of the resulting polynomial must have a length which is a multiple of PE::WIDTH, i.e. 2^(\mu - k) \geq PE::WIDTH, since WIDTH is power of two
sourcepub fn evaluate_partial_low<'a, PE>(
&self,
query: impl Into<MultilinearQueryRef<'a, PE>>,
) -> Result<MultilinearExtension<PE>, Error>
pub fn evaluate_partial_low<'a, PE>( &self, query: impl Into<MultilinearQueryRef<'a, PE>>, ) -> Result<MultilinearExtension<PE>, Error>
Partially evaluate the polynomial with assignment to the low-indexed variables.
The polynomial is multilinear with $\mu$ variables, $p(X_0, …, X_{\mu-1}$. Given a query vector of length $k$ representing $(z_0, …, z_{k-1})$, this returns the multilinear polynomial with $\mu - k$ variables, $p(z_0, …, z_{k-1}, X_k, …, X_{\mu - 1})$.
REQUIRES: the size of the resulting polynomial must have a length which is a multiple of P::WIDTH, i.e. 2^(\mu - k) \geq P::WIDTH, since WIDTH is power of two
sourcepub fn evaluate_partial_low_into<PE>(
&self,
query: MultilinearQueryRef<'_, PE>,
out: &mut [PE],
) -> Result<(), Error>
pub fn evaluate_partial_low_into<PE>( &self, query: MultilinearQueryRef<'_, PE>, out: &mut [PE], ) -> Result<(), Error>
Partially evaluate the polynomial with assignment to the low-indexed variables.
The polynomial is multilinear with $\mu$ variables, $p(X_0, …, X_{\mu-1}$. Given a query vector of length $k$ representing $(z_0, …, z_{k-1})$, this returns the multilinear polynomial with $\mu - k$ variables, $p(z_0, …, z_{k-1}, X_k, …, X_{\mu - 1})$.
REQUIRES: the size of the resulting polynomial must have a length which is a multiple of P::WIDTH, i.e. 2^(\mu - k) \geq P::WIDTH, since WIDTH is power of two
source§impl<P, Data> MultilinearExtension<P, Data>
impl<P, Data> MultilinearExtension<P, Data>
pub fn specialize<PE>(self) -> MultilinearExtensionSpecialized<P, PE, Data>
source§impl<'a, P, Data> MultilinearExtension<P, Data>
impl<'a, P, Data> MultilinearExtension<P, Data>
pub fn specialize_arc_dyn<PE>( self, ) -> Arc<dyn MultilinearPoly<PE> + Send + Sync + 'a>
source§impl<F: Field + AsSinglePacked, Data: Deref<Target = [F]>> MultilinearExtension<F, Data>
impl<F: Field + AsSinglePacked, Data: Deref<Target = [F]>> MultilinearExtension<F, Data>
sourcepub fn to_single_packed(self) -> MultilinearExtension<F::Packed>
pub fn to_single_packed(self) -> MultilinearExtension<F::Packed>
Convert MultilinearExtension over a scalar to a MultilinearExtension over a packed field with single element.
Trait Implementations§
source§impl<P, PE, Data> AsRef<MultilinearExtension<P, Data>> for MultilinearExtensionSpecialized<P, PE, Data>where
P: PackedField,
PE: PackedField,
PE::Scalar: ExtensionField<P::Scalar>,
Data: Deref<Target = [P]>,
impl<P, PE, Data> AsRef<MultilinearExtension<P, Data>> for MultilinearExtensionSpecialized<P, PE, Data>where
P: PackedField,
PE: PackedField,
PE::Scalar: ExtensionField<P::Scalar>,
Data: Deref<Target = [P]>,
source§fn as_ref(&self) -> &MultilinearExtension<P, Data>
fn as_ref(&self) -> &MultilinearExtension<P, Data>
source§impl<P: Clone + PackedField, Data: Clone + Deref<Target = [P]>> Clone for MultilinearExtension<P, Data>
impl<P: Clone + PackedField, Data: Clone + Deref<Target = [P]>> Clone for MultilinearExtension<P, Data>
source§fn clone(&self) -> MultilinearExtension<P, Data>
fn clone(&self) -> MultilinearExtension<P, Data>
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<P: Debug + PackedField, Data: Debug + Deref<Target = [P]>> Debug for MultilinearExtension<P, Data>
impl<P: Debug + PackedField, Data: Debug + Deref<Target = [P]>> Debug for MultilinearExtension<P, Data>
source§impl<P, PE, Data> From<MultilinearExtension<P, Data>> for MultilinearExtensionSpecialized<P, PE, Data>where
P: PackedField,
PE: PackedField,
PE::Scalar: ExtensionField<P::Scalar>,
Data: Deref<Target = [P]>,
impl<P, PE, Data> From<MultilinearExtension<P, Data>> for MultilinearExtensionSpecialized<P, PE, Data>where
P: PackedField,
PE: PackedField,
PE::Scalar: ExtensionField<P::Scalar>,
Data: Deref<Target = [P]>,
source§fn from(inner: MultilinearExtension<P, Data>) -> Self
fn from(inner: MultilinearExtension<P, Data>) -> Self
source§impl<P: PartialEq + PackedField, Data: PartialEq + Deref<Target = [P]>> PartialEq for MultilinearExtension<P, Data>
impl<P: PartialEq + PackedField, Data: PartialEq + Deref<Target = [P]>> PartialEq for MultilinearExtension<P, Data>
source§fn eq(&self, other: &MultilinearExtension<P, Data>) -> bool
fn eq(&self, other: &MultilinearExtension<P, Data>) -> bool
self
and other
values to be equal, and is used by ==
.impl<P: Eq + PackedField, Data: Eq + Deref<Target = [P]>> Eq for MultilinearExtension<P, Data>
impl<P: PackedField, Data: Deref<Target = [P]>> StructuralPartialEq for MultilinearExtension<P, Data>
Auto Trait Implementations§
impl<P, Data> Freeze for MultilinearExtension<P, Data>where
Data: Freeze,
impl<P, Data> RefUnwindSafe for MultilinearExtension<P, Data>where
Data: RefUnwindSafe,
impl<P, Data> Send for MultilinearExtension<P, Data>where
Data: Send,
impl<P, Data> Sync for MultilinearExtension<P, Data>where
Data: Sync,
impl<P, Data> Unpin for MultilinearExtension<P, Data>where
Data: Unpin,
impl<P, Data> UnwindSafe for MultilinearExtension<P, Data>where
Data: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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