Trait MatrixOperations

Source
pub trait MatrixOperations {
    // Required methods
    fn new(elements: &[Fq]) -> Self;
    fn elements(&self) -> &[Fq] ;
    fn get_element(&self, i: usize, j: usize) -> Fq;
    fn set_element(&mut self, i: usize, j: usize, val: Fq);
    fn n_rows(&self) -> usize;
    fn n_cols(&self) -> usize;
    fn hadamard_product(
        &self,
        rhs: &Self,
    ) -> Result<Self, PoseidonParameterError>
       where Self: Sized;

    // Provided method
    fn iter_rows(&self) -> Chunks<'_, Fq> { ... }
}

Required Methods§

Source

fn new(elements: &[Fq]) -> Self

Create a new matrix

Source

fn elements(&self) -> &[Fq]

Access elements as an array of arrays

Source

fn get_element(&self, i: usize, j: usize) -> Fq

Get element[i,j]

Source

fn set_element(&mut self, i: usize, j: usize, val: Fq)

Set element[i,j]

Source

fn n_rows(&self) -> usize

Number of rows

Source

fn n_cols(&self) -> usize

Number of columns

Source

fn hadamard_product(&self, rhs: &Self) -> Result<Self, PoseidonParameterError>
where Self: Sized,

Compute Hadamard (element-wise) product

Provided Methods§

Source

fn iter_rows(&self) -> Chunks<'_, Fq>

Get rows

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<const N_ROWS: usize, const N_COLS: usize, const N_ELEMENTS: usize> MatrixOperations for ArcMatrix<N_ROWS, N_COLS, N_ELEMENTS>

Source§

impl<const N_ROWS: usize, const N_COLS: usize, const N_ELEMENTS: usize> MatrixOperations for Matrix<N_ROWS, N_COLS, N_ELEMENTS>

Source§

impl<const N_ROWS: usize, const N_COLS: usize, const N_ELEMENTS: usize> MatrixOperations for OptimizedArcMatrix<N_ROWS, N_COLS, N_ELEMENTS>

Source§

impl<const N_ROWS: usize, const N_ELEMENTS: usize> MatrixOperations for SquareMatrix<N_ROWS, N_ELEMENTS>

Source§

impl<const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_ELEMENTS: usize, const NUM_ELEMENTS_STATE_SIZE_MINUS_1_2: usize> MatrixOperations for MdsMatrix<STATE_SIZE, STATE_SIZE_MINUS_1, NUM_ELEMENTS, NUM_ELEMENTS_STATE_SIZE_MINUS_1_2>