p3_matrix

Trait Matrix

Source
pub trait Matrix<T: Send + Sync>: Send + Sync {
    type Row<'a>: Iterator<Item = T> + Send + Sync
       where Self: 'a;

Show 20 methods // Required methods fn width(&self) -> usize; fn height(&self) -> usize; fn row(&self, r: usize) -> Self::Row<'_>; // Provided methods fn dimensions(&self) -> Dimensions { ... } fn get(&self, r: usize, c: usize) -> T { ... } fn rows(&self) -> impl Iterator<Item = Self::Row<'_>> { ... } fn par_rows(&self) -> impl IndexedParallelIterator<Item = Self::Row<'_>> { ... } fn row_slice(&self, r: usize) -> impl Deref<Target = [T]> { ... } fn first_row(&self) -> Self::Row<'_> { ... } fn last_row(&self) -> Self::Row<'_> { ... } fn to_row_major_matrix(self) -> RowMajorMatrix<T> where Self: Sized, T: Clone { ... } fn horizontally_packed_row<'a, P>( &'a self, r: usize, ) -> (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync) where P: PackedValue<Value = T>, T: Clone + 'a { ... } fn padded_horizontally_packed_row<'a, P>( &'a self, r: usize, ) -> impl Iterator<Item = P> + Send + Sync where P: PackedValue<Value = T>, T: Clone + Default + 'a { ... } fn par_horizontally_packed_rows<'a, P>( &'a self, ) -> impl IndexedParallelIterator<Item = (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync)> where P: PackedValue<Value = T>, T: Clone + 'a { ... } fn par_padded_horizontally_packed_rows<'a, P>( &'a self, ) -> impl IndexedParallelIterator<Item = impl Iterator<Item = P> + Send + Sync> where P: PackedValue<Value = T>, T: Clone + Default + 'a { ... } fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P> where T: Copy, P: PackedValue<Value = T> { ... } fn vertically_packed_row_pair<P>(&self, r: usize, step: usize) -> Vec<P> where T: Copy, P: PackedValue<Value = T> { ... } fn vertically_strided( self, stride: usize, offset: usize, ) -> VerticallyStridedMatrixView<Self> where Self: Sized { ... } fn columnwise_dot_product<EF>(&self, v: &[EF]) -> Vec<EF> where T: Field, EF: ExtensionField<T> { ... } fn dot_ext_powers<EF>( &self, base: EF, ) -> impl IndexedParallelIterator<Item = EF> where T: Field, EF: ExtensionField<T> { ... }
}

Required Associated Types§

Source

type Row<'a>: Iterator<Item = T> + Send + Sync where Self: 'a

Required Methods§

Source

fn width(&self) -> usize

Source

fn height(&self) -> usize

Source

fn row(&self, r: usize) -> Self::Row<'_>

Provided Methods§

Source

fn dimensions(&self) -> Dimensions

Source

fn get(&self, r: usize, c: usize) -> T

Source

fn rows(&self) -> impl Iterator<Item = Self::Row<'_>>

Source

fn par_rows(&self) -> impl IndexedParallelIterator<Item = Self::Row<'_>>

Source

fn row_slice(&self, r: usize) -> impl Deref<Target = [T]>

Source

fn first_row(&self) -> Self::Row<'_>

Source

fn last_row(&self) -> Self::Row<'_>

Source

fn to_row_major_matrix(self) -> RowMajorMatrix<T>
where Self: Sized, T: Clone,

Source

fn horizontally_packed_row<'a, P>( &'a self, r: usize, ) -> (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync)
where P: PackedValue<Value = T>, T: Clone + 'a,

Source

fn padded_horizontally_packed_row<'a, P>( &'a self, r: usize, ) -> impl Iterator<Item = P> + Send + Sync
where P: PackedValue<Value = T>, T: Clone + Default + 'a,

Zero padded.

Source

fn par_horizontally_packed_rows<'a, P>( &'a self, ) -> impl IndexedParallelIterator<Item = (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync)>
where P: PackedValue<Value = T>, T: Clone + 'a,

Source

fn par_padded_horizontally_packed_rows<'a, P>( &'a self, ) -> impl IndexedParallelIterator<Item = impl Iterator<Item = P> + Send + Sync>
where P: PackedValue<Value = T>, T: Clone + Default + 'a,

Source

fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P>
where T: Copy, P: PackedValue<Value = T>,

Pack together a collection of adjacent rows from the matrix.

Returns an iterator whose i’th element is packing of the i’th element of the rows r through r + P::WIDTH - 1. If we exceed the height of the matrix, wrap around and include initial rows.

Source

fn vertically_packed_row_pair<P>(&self, r: usize, step: usize) -> Vec<P>
where T: Copy, P: PackedValue<Value = T>,

Pack together a collection of rows and “next” rows from the matrix.

Returns a vector corresponding to 2 packed rows. The i’th element of the first row contains the packing of the i’th element of the rows r through r + P::WIDTH - 1. The i’th element of the second row contains the packing of the i’th element of the rows r + step through r + step + P::WIDTH - 1. If at some point we exceed the height of the matrix, wrap around and include initial rows.

Source

fn vertically_strided( self, stride: usize, offset: usize, ) -> VerticallyStridedMatrixView<Self>
where Self: Sized,

Source

fn columnwise_dot_product<EF>(&self, v: &[EF]) -> Vec<EF>
where T: Field, EF: ExtensionField<T>,

Compute Mᵀv, aka premultiply this matrix by the given vector, aka scale each row by the corresponding entry in v and take the sum across rows. v can be a vector of extension elements.

Source

fn dot_ext_powers<EF>( &self, base: EF, ) -> impl IndexedParallelIterator<Item = EF>
where T: Field, EF: ExtensionField<T>,

Multiply this matrix by the vector of powers of base, which is an extension element.

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§

Source§

impl<F, EF, Inner> Matrix<F> for FlatMatrixView<F, EF, Inner>
where F: Field, EF: ExtensionField<F>, Inner: Matrix<EF>,

Source§

type Row<'a> = FlatIter<F, <Inner as Matrix<EF>>::Row<'a>> where Self: 'a

Source§

impl<T: Clone + Default + Send + Sync> Matrix<T> for CsrMatrix<T>

Source§

type Row<'a> = <Vec<T> as IntoIterator>::IntoIter where Self: 'a

Source§

impl<T: Clone + Send + Sync, S: DenseStorage<T>> Matrix<T> for DenseMatrix<T, S>

Source§

type Row<'a> = Cloned<Iter<'a, T>> where Self: 'a

Source§

impl<T: Send + Sync, First: Matrix<T>, Second: Matrix<T>> Matrix<T> for HorizontalPair<First, Second>

Source§

type Row<'a> = Chain<<First as Matrix<T>>::Row<'a>, <Second as Matrix<T>>::Row<'a>> where Self: 'a

Source§

impl<T: Send + Sync, First: Matrix<T>, Second: Matrix<T>> Matrix<T> for VerticalPair<First, Second>

Source§

type Row<'a> = EitherRow<<First as Matrix<T>>::Row<'a>, <Second as Matrix<T>>::Row<'a>> where Self: 'a

Source§

impl<T: Send + Sync, IndexMap: RowIndexMap, Inner: Matrix<T>> Matrix<T> for RowIndexMappedView<IndexMap, Inner>

Source§

type Row<'a> = <Inner as Matrix<T>>::Row<'a> where Self: 'a