pub struct DenseMultilinearExtension<F: Field> {
pub evaluations: Vec<F>,
pub num_vars: usize,
}
Expand description
Stores a multilinear polynomial in dense evaluation form.
Fields§
§evaluations: Vec<F>
The evaluation over {0,1}^num_vars
num_vars: usize
Number of variables
Implementations§
source§impl<F: Field> DenseMultilinearExtension<F>
impl<F: Field> DenseMultilinearExtension<F>
sourcepub fn from_evaluations_slice(num_vars: usize, evaluations: &[F]) -> Self
pub fn from_evaluations_slice(num_vars: usize, evaluations: &[F]) -> Self
Construct a new polynomial from a list of evaluations where the index
represents a point in {0,1}^num_vars
in little endian form. For
example, 0b1011
represents P(1,1,0,1)
sourcepub fn from_evaluations_vec(num_vars: usize, evaluations: Vec<F>) -> Self
pub fn from_evaluations_vec(num_vars: usize, evaluations: Vec<F>) -> Self
Construct a new polynomial from a list of evaluations where the index
represents a point in {0,1}^num_vars
in little endian form. For
example, 0b1011
represents P(1,1,0,1)
sourcepub fn relabel_in_place(&mut self, a: usize, b: usize, k: usize)
pub fn relabel_in_place(&mut self, a: usize, b: usize, k: usize)
Relabel the point in place by switching k
scalars from position a
to
position b
, and from position b
to position a
in vector.
This function turns P(x_1,...,x_a,...,x_{a+k - 1},...,x_b,...,x_{b+k - 1},...,x_n)
to P(x_1,...,x_b,...,x_{b+k - 1},...,x_a,...,x_{a+k - 1},...,x_n)
Trait Implementations§
source§impl<'a, 'b, F: Field> Add<&'a DenseMultilinearExtension<F>> for &'b DenseMultilinearExtension<F>
impl<'a, 'b, F: Field> Add<&'a DenseMultilinearExtension<F>> for &'b DenseMultilinearExtension<F>
§type Output = DenseMultilinearExtension<F>
type Output = DenseMultilinearExtension<F>
The resulting type after applying the
+
operator.source§impl<F: Field> Add<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<F: Field> Add<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
§type Output = DenseMultilinearExtension<F>
type Output = DenseMultilinearExtension<F>
The resulting type after applying the
+
operator.source§fn add(self, other: DenseMultilinearExtension<F>) -> Self
fn add(self, other: DenseMultilinearExtension<F>) -> Self
Performs the
+
operation. Read moresource§impl<'a, F: Field> AddAssign<&'a DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<'a, F: Field> AddAssign<&'a DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
source§fn add_assign(&mut self, other: &'a DenseMultilinearExtension<F>)
fn add_assign(&mut self, other: &'a DenseMultilinearExtension<F>)
Performs the
+=
operation. Read moresource§impl<'a, F: Field> AddAssign<(F, &'a DenseMultilinearExtension<F>)> for DenseMultilinearExtension<F>
impl<'a, F: Field> AddAssign<(F, &'a DenseMultilinearExtension<F>)> for DenseMultilinearExtension<F>
source§fn add_assign(&mut self, (f, other): (F, &'a DenseMultilinearExtension<F>))
fn add_assign(&mut self, (f, other): (F, &'a DenseMultilinearExtension<F>))
Performs the
+=
operation. Read moresource§impl<F: Field> AddAssign<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<F: Field> AddAssign<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moresource§impl<F: Field> CanonicalDeserialize for DenseMultilinearExtension<F>
impl<F: Field> CanonicalDeserialize for DenseMultilinearExtension<F>
source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
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<F: Field> CanonicalSerialize for DenseMultilinearExtension<F>
impl<F: Field> CanonicalSerialize for DenseMultilinearExtension<F>
source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
fn serialized_size(&self, compress: 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<F: Clone + Field> Clone for DenseMultilinearExtension<F>
impl<F: Clone + Field> Clone for DenseMultilinearExtension<F>
source§fn clone(&self) -> DenseMultilinearExtension<F>
fn clone(&self) -> DenseMultilinearExtension<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<F: Field> Debug for DenseMultilinearExtension<F>
impl<F: Field> Debug for DenseMultilinearExtension<F>
source§impl<F: Default + Field> Default for DenseMultilinearExtension<F>
impl<F: Default + Field> Default for DenseMultilinearExtension<F>
source§fn default() -> DenseMultilinearExtension<F>
fn default() -> DenseMultilinearExtension<F>
Returns the “default value” for a type. Read more
source§impl<F: Field> Index<usize> for DenseMultilinearExtension<F>
impl<F: Field> Index<usize> for DenseMultilinearExtension<F>
source§impl<F: Field> MultilinearExtension<F> for DenseMultilinearExtension<F>
impl<F: Field> MultilinearExtension<F> for DenseMultilinearExtension<F>
source§fn evaluate(&self, point: &[F]) -> Option<F>
fn evaluate(&self, point: &[F]) -> Option<F>
Evaluates
self
at the given the vector point
in slice.
If the number of variables does not match, return None
.source§fn rand<R: Rng>(num_vars: usize, rng: &mut R) -> Self
fn rand<R: Rng>(num_vars: usize, rng: &mut R) -> Self
Outputs an
l
-variate multilinear extension where value of evaluations
are sampled uniformly at random.source§fn relabel(&self, a: usize, b: usize, k: usize) -> Self
fn relabel(&self, a: usize, b: usize, k: usize) -> Self
Relabel the point by swapping
k
scalars from positions a..a+k
to
positions b..b+k
, and from position b..b+k
to position a..a+k
in vector. Read moresource§fn fix_variables(&self, partial_point: &[F]) -> Self
fn fix_variables(&self, partial_point: &[F]) -> Self
Reduce the number of variables of
self
by fixing the
partial_point.len()
variables at partial_point
.source§fn to_evaluations(&self) -> Vec<F>
fn to_evaluations(&self) -> Vec<F>
Returns a list of evaluations over the domain, which is the boolean
hypercube.
source§impl<F: Field> Neg for DenseMultilinearExtension<F>
impl<F: Field> Neg for DenseMultilinearExtension<F>
source§impl<F: PartialEq + Field> PartialEq<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<F: PartialEq + Field> PartialEq<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
source§fn eq(&self, other: &DenseMultilinearExtension<F>) -> bool
fn eq(&self, other: &DenseMultilinearExtension<F>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a, 'b, F: Field> Sub<&'a DenseMultilinearExtension<F>> for &'b DenseMultilinearExtension<F>
impl<'a, 'b, F: Field> Sub<&'a DenseMultilinearExtension<F>> for &'b DenseMultilinearExtension<F>
§type Output = DenseMultilinearExtension<F>
type Output = DenseMultilinearExtension<F>
The resulting type after applying the
-
operator.source§impl<F: Field> Sub<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<F: Field> Sub<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
§type Output = DenseMultilinearExtension<F>
type Output = DenseMultilinearExtension<F>
The resulting type after applying the
-
operator.source§fn sub(self, other: DenseMultilinearExtension<F>) -> Self
fn sub(self, other: DenseMultilinearExtension<F>) -> Self
Performs the
-
operation. Read moresource§impl<'a, F: Field> SubAssign<&'a DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<'a, F: Field> SubAssign<&'a DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
source§fn sub_assign(&mut self, other: &'a DenseMultilinearExtension<F>)
fn sub_assign(&mut self, other: &'a DenseMultilinearExtension<F>)
Performs the
-=
operation. Read moresource§impl<F: Field> SubAssign<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
impl<F: Field> SubAssign<DenseMultilinearExtension<F>> for DenseMultilinearExtension<F>
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read more