poulpy/backend/src/hal/api/scalar_znx.rs
backend/src/hal/api/scalar_znx.rsRaw
1use crate::hal::layouts::ScalarZnxOwned;
2
3/// Allocates as [crate::hal::layouts::ScalarZnx].
4pub trait ScalarZnxAlloc {
5 fn scalar_znx_alloc(&self, cols: usize) -> ScalarZnxOwned;
6}
7
8/// Returns the size in bytes to allocate a [crate::hal::layouts::ScalarZnx].
9pub trait ScalarZnxAllocBytes {
10 fn scalar_znx_alloc_bytes(&self, cols: usize) -> usize;
11}
12
13/// Consume a vector of bytes into a [crate::hal::layouts::ScalarZnx].
14/// User must ensure that bytes is memory aligned and that it length is equal to [ScalarZnxAllocBytes].
15pub trait ScalarZnxFromBytes {
16 fn scalar_znx_from_bytes(&self, cols: usize, bytes: Vec<u8>) -> ScalarZnxOwned;
17}