Skip to content

Commit

Permalink
removes Matrix::new
Browse files Browse the repository at this point in the history
all matrices should be created through derive
  • Loading branch information
supinie committed Apr 17, 2024
1 parent b0611e0 commit 5144d10
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/matrix.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{
errors::CrystalsError,
params::{SecurityLevel, K},
polynomials::{Montgomery, Normalised, Poly, State},
polynomials::{Montgomery, Poly, State},
vectors::PolyVec,
};
use tinyvec::{array_vec, ArrayVec};
use tinyvec::ArrayVec;

#[derive(Default, PartialEq, Debug, Eq)]
pub struct Matrix<S: State> {
Expand Down Expand Up @@ -46,26 +46,6 @@ impl<S: State + Copy> Matrix<S> {
}
}

impl Matrix<Normalised> {
// Create a new, empty matrix
fn new(k: K) -> Self {
let polyvecs = match k {
K::Two => array_vec!([PolyVec<Normalised>; 4] => PolyVec::new(k), PolyVec::new(k)),
K::Three => {
array_vec!([PolyVec<Normalised>; 4] => PolyVec::new(k), PolyVec::new(k), PolyVec::new(k))
}
K::Four => {
array_vec!([PolyVec<Normalised>; 4] => PolyVec::new(k), PolyVec::new(k), PolyVec::new(k), PolyVec::new(k))
}
};

Self {
polyvecs,
sec_level: k,
}
}
}

impl Matrix<Montgomery> {
pub(crate) fn derive(
seed: &[u8],
Expand Down

0 comments on commit 5144d10

Please sign in to comment.