Struct poseidon_parameters::MdsMatrix
source · pub struct MdsMatrix<F: PrimeField>(pub SquareMatrix<F>);
Expand description
Represents an MDS (maximum distance separable) matrix.
Tuple Fields§
§0: SquareMatrix<F>
Implementations§
source§impl<F: PrimeField> MdsMatrix<F>
impl<F: PrimeField> MdsMatrix<F>
sourcepub fn from_elements(elements: Vec<F>) -> Self
pub fn from_elements(elements: Vec<F>) -> Self
Instantiate an MDS matrix from a list of elements.
Security
You must ensure this matrix was generated securely,
using the Cauchy method in fixed_cauchy_matrix
or
using the random subsampling method described in the original
paper.
sourcepub fn inverse(&self) -> SquareMatrix<F>
pub fn inverse(&self) -> SquareMatrix<F>
Compute inverse of MDS matrix
sourcepub fn v(&self) -> Matrix<F>
pub fn v(&self) -> Matrix<F>
Return the elements M_{0,1} .. M_{0,t} from the first row
Ref: p.20 of the Poseidon paper
sourcepub fn w(&self) -> Matrix<F>
pub fn w(&self) -> Matrix<F>
Return the elements M_{1,0} .. M_{t,0}from the first column
Ref: p.20 of the Poseidon paper
sourcepub fn hat(&self) -> SquareMatrix<F>
pub fn hat(&self) -> SquareMatrix<F>
Compute the (t - 1) x (t - 1) Mhat matrix from the MDS matrix
This is simply the MDS matrix with the first row and column removed
Ref: p.20 of the Poseidon paper
Trait Implementations§
source§impl<F: PrimeField> MatrixOperations<F> for MdsMatrix<F>
impl<F: PrimeField> MatrixOperations<F> for MdsMatrix<F>
source§impl<F: PartialEq + PrimeField> PartialEq<MdsMatrix<F>> for MdsMatrix<F>
impl<F: PartialEq + PrimeField> PartialEq<MdsMatrix<F>> for MdsMatrix<F>
impl<F: Eq + PrimeField> Eq for MdsMatrix<F>
impl<F: PrimeField> StructuralEq for MdsMatrix<F>
impl<F: PrimeField> StructuralPartialEq for MdsMatrix<F>
Auto Trait Implementations§
impl<F> RefUnwindSafe for MdsMatrix<F>where F: RefUnwindSafe,
impl<F> Send for MdsMatrix<F>
impl<F> Sync for MdsMatrix<F>
impl<F> Unpin for MdsMatrix<F>where F: Unpin,
impl<F> UnwindSafe for MdsMatrix<F>where F: UnwindSafe,
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
Mutably borrows from an owned value. Read more