Trait binius_core::polynomial::multilinear::MultilinearPoly
source · pub trait MultilinearPoly<P: PackedField>: Debug {
// Required methods
fn n_vars(&self) -> usize;
fn extension_degree(&self) -> usize;
fn evaluate_on_hypercube(&self, index: usize) -> Result<P::Scalar, Error>;
fn evaluate_on_hypercube_and_scale(
&self,
index: usize,
scalar: P::Scalar
) -> Result<P::Scalar, Error>;
fn evaluate(
&self,
query: MultilinearQueryRef<'_, P>
) -> Result<P::Scalar, Error>;
fn evaluate_partial_low(
&self,
query: MultilinearQueryRef<'_, P>
) -> Result<MultilinearExtensionSpecialized<P, P>, Error>;
fn evaluate_partial_high(
&self,
query: MultilinearQueryRef<'_, P>
) -> Result<MultilinearExtensionSpecialized<P, P>, Error>;
fn subcube_inner_products(
&self,
query: MultilinearQueryRef<'_, P>,
subcube_vars: usize,
subcube_index: usize,
inner_products: &mut [P]
) -> Result<(), Error>;
fn subcube_evals(
&self,
subcube_vars: usize,
subcube_index: usize,
evals: &mut [P]
) -> Result<(), Error>;
fn underlier_data(&self) -> Option<Vec<u8>>;
// Provided method
fn size(&self) -> usize { ... }
}
Expand description
Represents a multilinear polynomial.
This interface includes no generic methods, in order to support the creation of trait objects.
Required Methods§
sourcefn extension_degree(&self) -> usize
fn extension_degree(&self) -> usize
Degree of P::Scalar
as a field extension over the smallest subfield containing the polynomial’s coefficients.
sourcefn evaluate_on_hypercube(&self, index: usize) -> Result<P::Scalar, Error>
fn evaluate_on_hypercube(&self, index: usize) -> Result<P::Scalar, Error>
Get the evaluations of the polynomial at a vertex of the hypercube.
§Arguments
index
- The index of the point, in lexicographic order
sourcefn evaluate_on_hypercube_and_scale(
&self,
index: usize,
scalar: P::Scalar
) -> Result<P::Scalar, Error>
fn evaluate_on_hypercube_and_scale( &self, index: usize, scalar: P::Scalar ) -> Result<P::Scalar, Error>
Get the evaluations of the polynomial at a vertex of the hypercube and scale the value.
This can be more efficient than calling evaluate_on_hypercube
followed by a
multiplication when the trait implementation can use a subfield multiplication.
§Arguments
index
- The index of the point, in lexicographic orderscalar
- The scaling coefficient
fn evaluate( &self, query: MultilinearQueryRef<'_, P> ) -> Result<P::Scalar, Error>
fn evaluate_partial_low( &self, query: MultilinearQueryRef<'_, P> ) -> Result<MultilinearExtensionSpecialized<P, P>, Error>
fn evaluate_partial_high( &self, query: MultilinearQueryRef<'_, P> ) -> Result<MultilinearExtensionSpecialized<P, P>, Error>
sourcefn subcube_inner_products(
&self,
query: MultilinearQueryRef<'_, P>,
subcube_vars: usize,
subcube_index: usize,
inner_products: &mut [P]
) -> Result<(), Error>
fn subcube_inner_products( &self, query: MultilinearQueryRef<'_, P>, subcube_vars: usize, subcube_index: usize, inner_products: &mut [P] ) -> Result<(), Error>
Compute inner products of a multilinear query inside a subcube.
Equivalent computation is evaluate_partial_low(query)
followed by a subcube_evals
on a result. This method is more efficient due to handling it as a special case.
sourcefn subcube_evals(
&self,
subcube_vars: usize,
subcube_index: usize,
evals: &mut [P]
) -> Result<(), Error>
fn subcube_evals( &self, subcube_vars: usize, subcube_index: usize, evals: &mut [P] ) -> Result<(), Error>
Get a subcube of the boolean hypercube of a given size.
sourcefn underlier_data(&self) -> Option<Vec<u8>>
fn underlier_data(&self) -> Option<Vec<u8>>
If available, returns underliers of the data of this multilinear as bytes.