binius_math

Trait CompositionPolyOS

Source
pub trait CompositionPolyOS<P>:
    Debug
    + Send
    + Sync
where P: PackedField,
{ // Required methods fn n_vars(&self) -> usize; fn degree(&self) -> usize; fn binary_tower_level(&self) -> usize; fn expression(&self) -> ArithExpr<P::Scalar>; fn evaluate(&self, query: &[P]) -> Result<P, Error>; // Provided method fn batch_evaluate( &self, batch_query: &[&[P]], evals: &mut [P], ) -> Result<(), Error> { ... } }
Expand description

A multivariate polynomial that is used as a composition of several multilinear polynomials.

This is an object-safe version of the CompositionPoly trait.

Required Methods§

Source

fn n_vars(&self) -> usize

The number of variables.

Source

fn degree(&self) -> usize

Total degree of the polynomial.

Source

fn binary_tower_level(&self) -> usize

Returns the maximum binary tower level of all constants in the arithmetic expression.

Source

fn expression(&self) -> ArithExpr<P::Scalar>

Returns the arithmetic expression representing the polynomial.

Source

fn evaluate(&self, query: &[P]) -> Result<P, Error>

Evaluates the polynomial using packed values, where each packed value may contain multiple scalar values. The evaluation follows SIMD semantics, meaning that operations are performed element-wise across corresponding scalar values in the packed values.

For example, given a polynomial represented as query[0] + query[1]:

  • The addition operation is applied element-wise between query[0] and query[1].
  • Each scalar value in query[0] is added to the corresponding scalar value in query[1].
  • There are no operations performed between scalar values within the same packed value.

Provided Methods§

Source

fn batch_evaluate( &self, batch_query: &[&[P]], evals: &mut [P], ) -> Result<(), Error>

Batch evaluation that admits non-strided argument layout. batch_query is a slice of slice references of equal length, which furthermore should equal the length of evals parameter.

Evaluation follows SIMD semantics as in evaluate:

  • evals[j] := composition([batch_query[i][j] forall i]) forall j
  • no crosstalk between evaluations

This method has a default implementation.

Implementations on Foreign Types§

Source§

impl<'a, P, T: 'a + CompositionPolyOS<P> + ?Sized> CompositionPolyOS<P> for &'a T
where &'a T: Debug + Send + Sync, P: PackedField,

Source§

fn n_vars(&self) -> usize

Source§

fn degree(&self) -> usize

Source§

fn binary_tower_level(&self) -> usize

Source§

fn expression(&self) -> ArithExpr<P::Scalar>

Source§

fn evaluate(&self, query: &[P]) -> Result<P, Error>

Source§

fn batch_evaluate( &self, batch_query: &[&[P]], evals: &mut [P], ) -> Result<(), Error>

Source§

impl<P, T: CompositionPolyOS<P> + ?Sized> CompositionPolyOS<P> for Arc<T>
where Arc<T>: Debug + Send + Sync, P: PackedField,

Source§

fn n_vars(&self) -> usize

Source§

fn degree(&self) -> usize

Source§

fn binary_tower_level(&self) -> usize

Source§

fn expression(&self) -> ArithExpr<P::Scalar>

Source§

fn evaluate(&self, query: &[P]) -> Result<P, Error>

Source§

fn batch_evaluate( &self, batch_query: &[&[P]], evals: &mut [P], ) -> Result<(), Error>

Implementors§