multiples fixes to base2k, including svp to take into account column interleaving

This commit is contained in:
Jean-Philippe Bossuat
2025-05-07 15:51:01 +02:00
parent 6ce525e5a1
commit 64874dbda8
12 changed files with 99 additions and 14 deletions

View File

@@ -177,7 +177,7 @@ impl Scratch {
}
}
pub fn tmp_scalar_slice<T>(&mut self, len: usize) -> (&mut [T], &mut Self) {
pub fn tmp_slice<T>(&mut self, len: usize) -> (&mut [T], &mut Self) {
let (take_slice, rem_slice) = Self::take_slice_aligned(&mut self.data, len * std::mem::size_of::<T>());
unsafe {
@@ -188,6 +188,24 @@ impl Scratch {
}
}
pub fn tmp_scalar<B: Backend>(&mut self, module: &Module<B>, cols: usize) -> (ScalarZnx<&mut [u8]>, &mut Self) {
let (take_slice, rem_slice) = Self::take_slice_aligned(&mut self.data, bytes_of_scalar_znx(module, cols));
(
ScalarZnx::from_data(take_slice, module.n(), cols),
Self::new(rem_slice),
)
}
pub fn tmp_scalar_dft<B: Backend>(&mut self, module: &Module<B>, cols: usize) -> (ScalarZnxDft<&mut [u8], B>, &mut Self) {
let (take_slice, rem_slice) = Self::take_slice_aligned(&mut self.data, bytes_of_scalar_znx_dft(module, cols));
(
ScalarZnxDft::from_data(take_slice, module.n(), cols),
Self::new(rem_slice),
)
}
pub fn tmp_vec_znx_dft<B: Backend>(
&mut self,
module: &Module<B>,