Skip to main content

PackedStack

Struct PackedStack 

Source
pub struct PackedStack<A, EF> { /* private fields */ }
Expand description

Equal-height columns over a narrow alphabet, held as the elements a commitment takes.

§Overview

Each column packs on its own, so a column boundary lands on an element boundary.

    elements   [ column 0 ][ column 1 ] ... [ column k-1 ]
    column     2^arity elements, each holding d / a cells

That is what a stacked commitment expects of a source table. Nothing moves between the two.

Implementations§

Source§

impl<A, EF> PackedStack<A, EF>

Source

pub const CELLS_PER_ELEMENT: usize

Cells one wide element absorbs.

Source

pub fn from_columns(columns: &[&[A]]) -> Result<Self, PackError>

Pack equal-height columns, lowest column first.

§Errors
  • The alphabet is wider than the level packing it, so no cell fits.
  • No column was supplied, so there is nothing to commit.
  • The columns have different heights, so the layout has no common arity.
  • A column’s cells do not fill a whole number of elements.
  • A packed column is no power-of-two length, so it covers no hypercube.
Source

pub fn elements(&self) -> &[EF]

Every column’s elements, lowest column first.

Source

pub const fn num_columns(&self) -> usize

Source columns the stack holds.

Source

pub const fn column_num_variables(&self) -> usize

Variables one packed column’s multilinear has.

Source

pub const fn column_num_cells(&self) -> usize

Cells one source column held.

Source

pub fn column(&self, index: usize) -> &[EF]

One packed column’s elements, panicking on a column the stack does not hold.

Source

pub fn locate(&self, column: usize, cell: usize) -> (usize, usize)

Which element of the stack, and which cell inside it, one source cell landed in.

This is the view an opening reads, since a claim lands on the committed polynomial.

§Panics

Panics if the column or the cell is not one the stack holds.

Source

pub fn cell(&self, column: usize, cell: usize) -> A

One source cell, read back out of the element holding it.

Source

pub fn unpack_column(&self, index: usize) -> Vec<A>

One source column, read back in full.

Source

pub fn into_poly(self) -> Poly<EF>

The stack as the multilinear a single-column commitment holds.

Source

pub fn into_table(self) -> Table<EF>

The stack as one source table of a commitment’s stacked layout.

Row i of the table is packed column i, the orientation that layout reads.

Source§

impl<U, EF> PackedStack<PackedGf2<U>, EF>

Source

pub fn from_bit_rows( rows: &[PackedGf2<U>], num_columns: usize, ) -> Result<Self, PackError>

Pack a bit-sliced block whose lanes are columns rather than rows.

    in     row r    ->  lanes are columns 0 .. d
    out    column c ->  lanes are the rows of one block

One square bit transpose per block of d rows, so whole words move at a time.

§Arguments
  • rows: one block per row, in row order, covering whole blocks.
  • num_columns: leading lanes to keep, the rest being unused width.
§Errors
  • The rows are no whole number of square blocks, or ask for more than a block’s lanes.
  • The transposed columns do not pack, for any of the reasons columns can fail to.

Trait Implementations§

Source§

impl<A: Clone, EF: Clone> Clone for PackedStack<A, EF>

Source§

fn clone(&self) -> Self

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<A: Debug, EF: Debug> Debug for PackedStack<A, EF>

Source§

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

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

impl<A: Eq, EF: Eq> Eq for PackedStack<A, EF>

Source§

impl<A: PartialEq, EF: PartialEq> PartialEq for PackedStack<A, EF>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<A: PartialEq, EF: PartialEq> StructuralPartialEq for PackedStack<A, EF>

Auto Trait Implementations§

§

impl<A, EF> Freeze for PackedStack<A, EF>
where Vec<EF>: Freeze, PhantomData<A>: Freeze,

§

impl<A, EF> RefUnwindSafe for PackedStack<A, EF>

§

impl<A, EF> Send for PackedStack<A, EF>
where Vec<EF>: Send, PhantomData<A>: Send,

§

impl<A, EF> Sync for PackedStack<A, EF>
where Vec<EF>: Sync, PhantomData<A>: Sync,

§

impl<A, EF> Unpin for PackedStack<A, EF>
where Vec<EF>: Unpin, PhantomData<A>: Unpin,

§

impl<A, EF> UnsafeUnpin for PackedStack<A, EF>

§

impl<A, EF> UnwindSafe for PackedStack<A, EF>

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.

Source§

impl<T> Instrument for T

Source§

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

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

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
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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