poulpy/backend/src/implementation/cpu_spqlios/vec_znx_big_ntt120.rs
backend/src/implementation/cpu_spqlios/vec_znx_big_ntt120.rsRaw
1use crate::{
2 hal::{
3 api::{ZnxInfos, ZnxSliceSize, ZnxView},
4 layouts::{Data, DataRef, VecZnxBig, VecZnxBigBytesOf},
5 oep::VecZnxBigAllocBytesImpl,
6 },
7 implementation::cpu_spqlios::module_ntt120::NTT120,
8};
9
10const VEC_ZNX_BIG_NTT120_WORDSIZE: usize = 4;
11
12impl<D: DataRef> ZnxView for VecZnxBig<D, NTT120> {
13 type Scalar = i128;
14}
15
16impl<D: Data> VecZnxBigBytesOf for VecZnxBig<D, NTT120> {
17 fn bytes_of(n: usize, cols: usize, size: usize) -> usize {
18 VEC_ZNX_BIG_NTT120_WORDSIZE * n * cols * size * size_of::<f64>()
19 }
20}
21
22impl<D: Data> ZnxSliceSize for VecZnxBig<D, NTT120> {
23 fn sl(&self) -> usize {
24 VEC_ZNX_BIG_NTT120_WORDSIZE * self.n() * self.cols()
25 }
26}
27
28unsafe impl VecZnxBigAllocBytesImpl<NTT120> for NTT120 {
29 fn vec_znx_big_alloc_bytes_impl(n: usize, cols: usize, size: usize) -> usize {
30 VecZnxBig::<Vec<u8>, NTT120>::bytes_of(n, cols, size)
31 }
32}