Skip to main content

RoundCoeffs

Struct RoundCoeffs 

Source
pub struct RoundCoeffs<F>(pub Vec<F>);
Expand description

A univariate polynomial in monomial basis.

The coefficient at position i in the inner vector corresponds to the term $X^i$.

Tuple Fields§

§0: Vec<F>

Implementations§

Source§

impl<F> RoundCoeffs<F>

Source

pub fn truncate(self) -> RoundProof<F>

Truncate the highest-degree coefficient to produce a more compact round proof.

§Pre-conditions
  • The coefficient vector must be non-empty.
  • A round polynomial always has degree at least one, so an empty vector signals a bug.
Source

pub fn as_slice(&self) -> &[F]

The coefficients ordered from the constant term to the highest-degree term.

Source§

impl<F: FieldOps> RoundCoeffs<F>

Source

pub fn evaluate(&self, x: &F) -> F

Evaluate the polynomial at a point.

Source

pub fn batch(polys: Vec<Self>, batch_coeff: &F) -> Self

Batches round polynomials into one, weighting polynomial i by batch_coeff^i.

The verifier weights the matching claims with the same coefficient. Each claim therefore stays tied to its own round polynomial.

An empty input is the zero polynomial.

Source

pub fn sum_over_endpoints(&self) -> F

The claimed sum $R(0) + R(1)$ that this round polynomial encodes.

For a sumcheck round polynomial, this is the round’s claimed sum. The verifier expects the identity $s = R(0) + R(1)$ (see RoundProof::recover).

Source

pub fn lerp_over_endpoints(&self, alpha: F) -> F

The claimed value $(1 - \alpha) R(0) + \alpha R(1)$ that this round polynomial encodes in an MLE-check.

This is the MLE-check analogue of Self::sum_over_endpoints. An MLE-check round polynomial satisfies $s = (1 - \alpha) R(0) + \alpha R(1)$. Here $\alpha$ is the round’s evaluation-point coordinate (see crate::mlecheck::RoundProof::recover). Equivalently, this is the linear extrapolation of $R$ from the endpoints $0$ and $1$ to $\alpha$.

Source§

impl<F: Field> RoundCoeffs<F>

Source

pub fn mul_by_eq(&self, alpha: F) -> Self

Multiplies this polynomial by the equality factor $\text{eq}(X, \alpha)$.

$$ \text{eq}(X, \alpha) = (1 - \alpha) + (2 \alpha - 1) X $$

An MLE-check prover interpolates the prime polynomial, which carries no equality factor. This multiplies the factor back in.

Monomial form makes that one scaling and one shift. Sampling the factored polynomial instead would cost an extra evaluation point.

The factor is linear, so the result has one more coefficient than self.

Trait Implementations§

Source§

impl<F: FieldOps> Add<&RoundCoeffs<F>> for RoundCoeffs<F>

Source§

type Output = RoundCoeffs<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: FieldOps> AddAssign<&RoundCoeffs<F>> for RoundCoeffs<F>

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl<F: Clone> Clone for RoundCoeffs<F>

Source§

fn clone(&self) -> RoundCoeffs<F>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug> Debug for RoundCoeffs<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F> Default for RoundCoeffs<F>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<F: Eq> Eq for RoundCoeffs<F>

Source§

impl<F> Index<usize> for RoundCoeffs<F>

Source§

type Output = F

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &F

Performs the indexing (container[index]) operation. Read more
Source§

impl<F: FieldOps> Mul<F> for RoundCoeffs<F>

Source§

type Output = RoundCoeffs<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: FieldOps> MulAssign<F> for RoundCoeffs<F>

Source§

fn mul_assign(&mut self, rhs: F)

Performs the *= operation. Read more
Source§

impl<F: PartialEq> PartialEq for RoundCoeffs<F>

Source§

fn eq(&self, other: &RoundCoeffs<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: PartialEq> StructuralPartialEq for RoundCoeffs<F>

Source§

impl<F: FieldOps> Sum for RoundCoeffs<F>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.

Auto Trait Implementations§

§

impl<F> Freeze for RoundCoeffs<F>

§

impl<F> RefUnwindSafe for RoundCoeffs<F>
where F: RefUnwindSafe,

§

impl<F> Send for RoundCoeffs<F>
where F: Send,

§

impl<F> Sync for RoundCoeffs<F>
where F: Sync,

§

impl<F> Unpin for RoundCoeffs<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for RoundCoeffs<F>

§

impl<F> UnwindSafe for RoundCoeffs<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more