1use crate::layouts::{Backend, MatZnx, ScalarZnx, VecZnx};
2
3pub trait ModuleNew<B: Backend> {
5 fn new(n: u64) -> Self;
6}
7
8pub trait ModuleN {
10 fn n(&self) -> usize;
11}
12
13pub trait ModuleLogN
15where
16 Self: ModuleN,
17{
18 fn log_n(&self) -> usize {
19 (u64::BITS - (self.n() as u64 - 1).leading_zeros()) as usize
20 }
21}
22
23pub trait ScalarZnxAlloc<B: Backend>: ModuleN {
25 fn scalar_znx_alloc(&self, cols: usize) -> ScalarZnx<B::OwnedBuf>;
26}
27
28pub trait VecZnxAlloc<B: Backend>: ModuleN {
30 fn vec_znx_alloc(&self, cols: usize, size: usize) -> VecZnx<B::OwnedBuf>;
31 fn vec_znx_alloc_with_max_size(&self, cols: usize, size: usize, max_size: usize) -> VecZnx<B::OwnedBuf>;
32}
33
34pub trait MatZnxAlloc<B: Backend>: ModuleN {
36 fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnx<B::OwnedBuf>;
37}