Skip to main content

ChipInstances

Trait ChipInstances 

Source
pub trait ChipInstances {
    // Required methods
    fn n_chips(&self) -> usize;
    fn n_instances(&self, chip_id: usize) -> usize;
    fn instance(&self, chip_id: usize, row: usize) -> Cow<'_, ValueVec>;
}
Expand description

The chip instances of an M4 witness, addressed by chip ID and row.

ConstraintSystemM4::verify reads one instance at a time and never holds two, so this is all it needs of a witness. A witness that stores its instances packed — as the prover’s tables do, one column per instance — can therefore serve them one at a time rather than expanding the whole witness into value vectors first, which for a system of any size is most of its memory.

Instances are served, not lent, because a packed witness has to build one to hand it over. One that already holds value vectors lends them and pays nothing.

Required Methods§

Source

fn n_chips(&self) -> usize

The number of chips the witness covers, which must be the number the system has.

Source

fn n_instances(&self, chip_id: usize) -> usize

The number of instances of the given chip, which must be at least its active-instance count.

Source

fn instance(&self, chip_id: usize, row: usize) -> Cow<'_, ValueVec>

The value vector of one instance of one chip.

Implementations on Foreign Types§

Source§

impl ChipInstances for [Vec<ValueVec>]

Source§

fn n_chips(&self) -> usize

Source§

fn n_instances(&self, chip_id: usize) -> usize

Source§

fn instance(&self, chip_id: usize, row: usize) -> Cow<'_, ValueVec>

Implementors§