poulpy_hal/delegates/
module.rs1use crate::{
2 api::{MatZnxAlloc, ModuleN, ModuleNew, ScalarZnxAlloc, VecZnxAlloc},
3 layouts::{Backend, MatZnx, Module, ScalarZnx, VecZnx},
4 oep::HalModuleImpl,
5};
6
7impl<B> ModuleNew<B> for Module<B>
8where
9 B: Backend + HalModuleImpl<B>,
10{
11 fn new(n: u64) -> Self {
12 B::new(n)
13 }
14}
15
16impl<B> ModuleN for Module<B>
17where
18 B: Backend,
19{
20 fn n(&self) -> usize {
21 self.n()
22 }
23}
24
25impl<B: Backend> ScalarZnxAlloc<B> for Module<B> {
26 fn scalar_znx_alloc(&self, cols: usize) -> ScalarZnx<B::OwnedBuf> {
27 Module::<B>::scalar_znx_alloc(self, cols)
28 }
29}
30
31impl<B: Backend> VecZnxAlloc<B> for Module<B> {
32 fn vec_znx_alloc(&self, cols: usize, size: usize) -> VecZnx<B::OwnedBuf> {
33 Module::<B>::vec_znx_alloc(self, cols, size)
34 }
35
36 fn vec_znx_alloc_with_max_size(&self, cols: usize, size: usize, max_size: usize) -> VecZnx<B::OwnedBuf> {
37 Module::<B>::vec_znx_alloc_with_max_size(self, cols, size, max_size)
38 }
39}
40
41impl<B: Backend> MatZnxAlloc<B> for Module<B> {
42 fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnx<B::OwnedBuf> {
43 Module::<B>::mat_znx_alloc(self, rows, cols_in, cols_out, size)
44 }
45}