Skip to main content

WordAxisFolder

Struct WordAxisFolder 

Source
pub struct WordAxisFolder<F: BinaryField> { /* private fields */ }
Expand description

A reusable Method of Four Russians folder over a fixed evaluation point, contracting the word axis.

Many word-lists often share one point, so the tables are built once here and reused. The batched instance fold is that case: every committed word folds against the same point.

The two tables it holds:

  • per-byte subset-sum lookups, built from the point’s prefix.
  • one weight per chunk, built from the point’s suffix.

Implementations§

Source§

impl<F: BinaryField> WordAxisFolder<F>

Source

pub fn new(point: &[F]) -> Self

Builds the folding tables for point.

Each later fold takes a list of at most 2^point.len() words, folded against this point.

Source

pub fn fold(&self, words: &[Word]) -> FoldedWord<F>

Folds one word-list against the point.

Returns the array whose entry at bit position b is

out[b] = sum_i eq(point, i) * bit_b(words[i])

with a clear bit read as zero and a set bit read as one.

This runs sequentially over the list’s chunks, so it leaves every other core free. It is the right driver for a caller already parallel over many lists. A caller with few lists wants the parallel driver below instead.

A list shorter than the word axis reads its missing high rows as zero: an absent row’s weight multiplies nothing, so it contributes nothing to any bit position. Chunks lying entirely past the list’s end are therefore never visited at all.

§Preconditions
  • words.len() <= 1 << point.len()
Source

pub fn fold_par(&self, words: &[Word]) -> FoldedWord<F>

Folds one word-list against the point, parallel over that list’s chunks.

Returns the same array the sequential fold returns, under the same contract. The two differ only in how the chunk axis is divided across workers.

Reach for this when few lists share the point, so the chunk axis is the only one wide enough to divide. A caller folding many lists against one point should instead parallelize across the lists and fold each one sequentially.

§Preconditions
  • words.len() <= 1 << point.len()

Trait Implementations§

Source§

impl<F: Debug + BinaryField> Debug for WordAxisFolder<F>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, 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