use crate::layouts::{Backend, MatZnx, ScalarZnx, VecZnx};
pub trait ModuleNew<B: Backend> {
fn new(n: u64) -> Self;
}
pub trait ModuleN {
fn n(&self) -> usize;
}
pub trait ModuleLogN
where
Self: ModuleN,
{
fn log_n(&self) -> usize {
(u64::BITS - (self.n() as u64 - 1).leading_zeros()) as usize
}
}
pub trait ScalarZnxAlloc<B: Backend>: ModuleN {
fn scalar_znx_alloc(&self, cols: usize) -> ScalarZnx<B::OwnedBuf>;
}
pub trait VecZnxAlloc<B: Backend>: ModuleN {
fn vec_znx_alloc(&self, cols: usize, size: usize) -> VecZnx<B::OwnedBuf>;
fn vec_znx_alloc_with_max_size(&self, cols: usize, size: usize, max_size: usize) -> VecZnx<B::OwnedBuf>;
}
pub trait MatZnxAlloc<B: Backend>: ModuleN {
fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnx<B::OwnedBuf>;
}