Skip to main content

VectorInstructions

Trait VectorInstructions 

Source
pub trait VectorInstructions<F, T, const M: usize, const A: usize>{
    // Required methods
    fn resize<const L: usize>(
        &self,
        layouter: &mut impl Layouter<F>,
        input: AssignedVector<F, T, M, A>,
    ) -> Result<AssignedVector<F, T, L, A>, Error>;
    fn assign_with_filler(
        &self,
        layouter: &mut impl Layouter<F>,
        value: Value<Vec<T::Element>>,
        filler: Option<T::Element>,
    ) -> Result<AssignedVector<F, T, M, A>, Error>;
    fn trim_beginning(
        &self,
        layouter: &mut impl Layouter<F>,
        input: &AssignedVector<F, T, M, A>,
        n_elems: usize,
    ) -> Result<AssignedVector<F, T, M, A>, Error>;
    fn padding_flag(
        &self,
        layouter: &mut impl Layouter<F>,
        input: &AssignedVector<F, T, M, A>,
    ) -> Result<(Box<[AssignedBit<F>; M]>, VectorBounds<F>), Error>;
    fn get_limits(
        &self,
        layouter: &mut impl Layouter<F>,
        input: &AssignedVector<F, T, M, A>,
    ) -> Result<VectorBounds<F>, Error>;
}
Expand description

Instructions for Vector manipulation..

Required Methods§

Source

fn resize<const L: usize>( &self, layouter: &mut impl Layouter<F>, input: AssignedVector<F, T, M, A>, ) -> Result<AssignedVector<F, T, L, A>, Error>

Changes the size of an AssignedVector from M to L.

§Panics

If L <= M or A does not divide L.

Source

fn assign_with_filler( &self, layouter: &mut impl Layouter<F>, value: Value<Vec<T::Element>>, filler: Option<T::Element>, ) -> Result<AssignedVector<F, T, M, A>, Error>

Assigns vector with a chosen filler value.

§Panics

If |value| > M.

Source

fn trim_beginning( &self, layouter: &mut impl Layouter<F>, input: &AssignedVector<F, T, M, A>, n_elems: usize, ) -> Result<AssignedVector<F, T, M, A>, Error>

Trims n_elems elements from the beginning of the vector. The trimmed elements will not be changed by filler elements, they will remain in the buffer but not as part of the effective payload.

§Unsatisfiable Circuit

If the vector length < n_elems.

Source

fn padding_flag( &self, layouter: &mut impl Layouter<F>, input: &AssignedVector<F, T, M, A>, ) -> Result<(Box<[AssignedBit<F>; M]>, VectorBounds<F>), Error>

Returns a vector of AssignedBits signaling the cells that represent padding with a 1, and the ones that represent payload data with a 0. Also returns the (start, end) limits of the data in the buffer, since they are computed internally.

Source

fn get_limits( &self, layouter: &mut impl Layouter<F>, input: &AssignedVector<F, T, M, A>, ) -> Result<VectorBounds<F>, Error>

Returns the first and last positions of data in the buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§