Added LWE-GLWE conversion & LWE Keyswitch, improved LUT generation

This commit is contained in:
Jean-Philippe Bossuat
2025-07-07 11:09:04 +02:00
parent c4a517e9c3
commit 5234c3fc63
28 changed files with 979 additions and 782 deletions

View File

@@ -231,6 +231,23 @@ impl Scratch {
)
}
pub fn tmp_slice_vec_znx_dft<B: Backend>(
&mut self,
slice_size: usize,
module: &Module<B>,
cols: usize,
size: usize,
) -> (Vec<VecZnxDft<&mut [u8], B>>, &mut Self) {
let mut scratch: &mut Scratch = self;
let mut slice: Vec<VecZnxDft<&mut [u8], B>> = Vec::with_capacity(slice_size);
for _ in 0..slice_size{
let (znx, new_scratch) = scratch.tmp_vec_znx_dft(module, cols, size);
scratch = new_scratch;
slice.push(znx);
};
(slice, scratch)
}
pub fn tmp_vec_znx_big<B: Backend>(
&mut self,
module: &Module<B>,
@@ -253,6 +270,23 @@ impl Scratch {
)
}
pub fn tmp_slice_vec_znx<B: Backend>(
&mut self,
slice_size: usize,
module: &Module<B>,
cols: usize,
size: usize,
) -> (Vec<VecZnx<&mut [u8]>>, &mut Self) {
let mut scratch: &mut Scratch = self;
let mut slice: Vec<VecZnx<&mut [u8]>> = Vec::with_capacity(slice_size);
for _ in 0..slice_size{
let (znx, new_scratch) = scratch.tmp_vec_znx(module, cols, size);
scratch = new_scratch;
slice.push(znx);
};
(slice, scratch)
}
pub fn tmp_mat_znx_dft<B: Backend>(
&mut self,
module: &Module<B>,