Added tmp_mat_znx_dft to Scratch
Jean-Philippe Bossuat jeanphilippe.bossuat@gmail.com
Wed, 28 May 2025 14:55:31 +0200
2 files changed,
32 insertions(+),
0 deletions(-)
M
backend/src/lib.rs
→
backend/src/lib.rs
@@ -248,4 +248,22 @@ VecZnx::from_data(take_slice, module.n(), cols, size),
Self::new(rem_slice), ) } + + pub fn tmp_mat_znx_dft<B: Backend>( + &mut self, + module: &Module<B>, + rows: usize, + cols_in: usize, + cols_out: usize, + size: usize, + ) -> (MatZnxDft<&mut [u8], B>, &mut Self) { + let (take_slice, rem_slice) = Self::take_slice_aligned( + &mut self.data, + module.bytes_of_mat_znx_dft(rows, cols_in, cols_out, size), + ); + ( + MatZnxDft::from_data(take_slice, module.n(), rows, cols_in, cols_out, size), + Self::new(rem_slice), + ) + } }
M
backend/src/mat_znx_dft.rs
→
backend/src/mat_znx_dft.rs
@@ -198,3 +198,17 @@ _phantom: std::marker::PhantomData,
} } } + +impl<D, B: Backend> MatZnxDft<D, B> { + pub(crate) fn from_data(data: D, n: usize, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> Self { + Self { + data, + n, + rows, + cols_in, + cols_out, + size, + _phantom: PhantomData, + } + } +}