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 cellsThat is what a stacked commitment expects of a source table. Nothing moves between the two.
Implementations§
Source§impl<A, EF> PackedStack<A, EF>
impl<A, EF> PackedStack<A, EF>
Sourcepub const CELLS_PER_ELEMENT: usize
pub const CELLS_PER_ELEMENT: usize
Cells one wide element absorbs.
Sourcepub fn from_columns(columns: &[&[A]]) -> Result<Self, PackError>
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.
Sourcepub const fn num_columns(&self) -> usize
pub const fn num_columns(&self) -> usize
Source columns the stack holds.
Sourcepub const fn column_num_variables(&self) -> usize
pub const fn column_num_variables(&self) -> usize
Variables one packed column’s multilinear has.
Sourcepub const fn column_num_cells(&self) -> usize
pub const fn column_num_cells(&self) -> usize
Cells one source column held.
Sourcepub fn column(&self, index: usize) -> &[EF]
pub fn column(&self, index: usize) -> &[EF]
One packed column’s elements, panicking on a column the stack does not hold.
Sourcepub fn locate(&self, column: usize, cell: usize) -> (usize, usize)
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.
Sourcepub fn cell(&self, column: usize, cell: usize) -> A
pub fn cell(&self, column: usize, cell: usize) -> A
One source cell, read back out of the element holding it.
Sourcepub fn unpack_column(&self, index: usize) -> Vec<A>
pub fn unpack_column(&self, index: usize) -> Vec<A>
One source column, read back in full.
Sourcepub fn into_poly(self) -> Poly<EF>
pub fn into_poly(self) -> Poly<EF>
The stack as the multilinear a single-column commitment holds.
Sourcepub fn into_table(self) -> Table<EF>
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>
impl<U, EF> PackedStack<PackedGf2<U>, EF>
Sourcepub fn from_bit_rows(
rows: &[PackedGf2<U>],
num_columns: usize,
) -> Result<Self, PackError>
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 blockOne 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§
impl<A: Eq, EF: Eq> Eq for PackedStack<A, EF>
impl<A: PartialEq, EF: PartialEq> StructuralPartialEq for PackedStack<A, EF>
Auto Trait Implementations§
impl<A, EF> Freeze for PackedStack<A, EF>
impl<A, EF> RefUnwindSafe for PackedStack<A, EF>
impl<A, EF> Send for PackedStack<A, EF>
impl<A, EF> Sync for PackedStack<A, EF>
impl<A, EF> Unpin for PackedStack<A, EF>
impl<A, EF> UnsafeUnpin for PackedStack<A, EF>
impl<A, EF> UnwindSafe for PackedStack<A, EF>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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