poulpy/poulpy-hal/src/oep/vec_znx_big.rs
poulpy-hal/src/oep/vec_znx_big.rsRaw
1use crate::{
2 layouts::{Backend, Module, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef},
3 source::Source,
4};
5
6/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
7/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
8/// * See [crate::api::VecZnxBigFromSmall] for corresponding public API.
9/// # Safety [crate::doc::backend_safety] for safety contract.
10pub unsafe trait VecZnxBigFromSmallImpl<B: Backend> {
11 fn vec_znx_big_from_small_impl<R, A>(res: &mut R, res_col: usize, a: &A, a_col: usize)
12 where
13 R: VecZnxBigToMut<B>,
14 A: VecZnxToRef;
15}
16
17/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
18/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
19/// * See [crate::api::VecZnxBigAlloc] for corresponding public API.
20/// # Safety [crate::doc::backend_safety] for safety contract.
21pub unsafe trait VecZnxBigAllocImpl<B: Backend> {
22 fn vec_znx_big_alloc_impl(n: usize, cols: usize, size: usize) -> VecZnxBigOwned<B>;
23}
24
25/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
26/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
27/// * See [crate::api::VecZnxBigFromBytes] for corresponding public API.
28/// # Safety [crate::doc::backend_safety] for safety contract.
29pub unsafe trait VecZnxBigFromBytesImpl<B: Backend> {
30 fn vec_znx_big_from_bytes_impl(n: usize, cols: usize, size: usize, bytes: Vec<u8>) -> VecZnxBigOwned<B>;
31}
32
33/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
34/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
35/// * See [crate::api::VecZnxBigAllocBytes] for corresponding public API.
36/// # Safety [crate::doc::backend_safety] for safety contract.
37pub unsafe trait VecZnxBigAllocBytesImpl<B: Backend> {
38 fn vec_znx_big_alloc_bytes_impl(n: usize, cols: usize, size: usize) -> usize;
39}
40
41#[allow(clippy::too_many_arguments)]
42/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
43/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
44/// * See [crate::api::VecZnxBigAddNormal] for corresponding public API.
45/// # Safety [crate::doc::backend_safety] for safety contract.
46pub unsafe trait VecZnxBigAddNormalImpl<B: Backend> {
47 fn add_normal_impl<R: VecZnxBigToMut<B>>(
48 module: &Module<B>,
49 res_basek: usize,
50 res: &mut R,
51 res_col: usize,
52 k: usize,
53 source: &mut Source,
54 sigma: f64,
55 bound: f64,
56 );
57}
58
59/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
60/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
61/// * See [crate::api::VecZnxBigAdd] for corresponding public API.
62/// # Safety [crate::doc::backend_safety] for safety contract.
63pub unsafe trait VecZnxBigAddImpl<B: Backend> {
64 fn vec_znx_big_add_impl<R, A, C>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
65 where
66 R: VecZnxBigToMut<B>,
67 A: VecZnxBigToRef<B>,
68 C: VecZnxBigToRef<B>;
69}
70
71/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
72/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
73/// * See [crate::api::VecZnxBigAddInplace] for corresponding public API.
74/// # Safety [crate::doc::backend_safety] for safety contract.
75pub unsafe trait VecZnxBigAddInplaceImpl<B: Backend> {
76 fn vec_znx_big_add_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
77 where
78 R: VecZnxBigToMut<B>,
79 A: VecZnxBigToRef<B>;
80}
81
82/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
83/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
84/// * See [crate::api::VecZnxBigAddSmall] for corresponding public API.
85/// # Safety [crate::doc::backend_safety] for safety contract.
86pub unsafe trait VecZnxBigAddSmallImpl<B: Backend> {
87 fn vec_znx_big_add_small_impl<R, A, C>(
88 module: &Module<B>,
89 res: &mut R,
90 res_col: usize,
91 a: &A,
92 a_col: usize,
93 b: &C,
94 b_col: usize,
95 ) where
96 R: VecZnxBigToMut<B>,
97 A: VecZnxBigToRef<B>,
98 C: VecZnxToRef;
99}
100
101/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
102/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
103/// * See [crate::api::VecZnxBigAddSmallInplace] for corresponding public API.
104/// # Safety [crate::doc::backend_safety] for safety contract.
105pub unsafe trait VecZnxBigAddSmallInplaceImpl<B: Backend> {
106 fn vec_znx_big_add_small_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
107 where
108 R: VecZnxBigToMut<B>,
109 A: VecZnxToRef;
110}
111
112/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
113/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
114/// * See [crate::api::VecZnxBigSub] for corresponding public API.
115/// # Safety [crate::doc::backend_safety] for safety contract.
116pub unsafe trait VecZnxBigSubImpl<B: Backend> {
117 fn vec_znx_big_sub_impl<R, A, C>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
118 where
119 R: VecZnxBigToMut<B>,
120 A: VecZnxBigToRef<B>,
121 C: VecZnxBigToRef<B>;
122}
123
124/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
125/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
126/// * See [crate::api::VecZnxBigSubInplace] for corresponding public API.
127/// # Safety [crate::doc::backend_safety] for safety contract.
128pub unsafe trait VecZnxBigSubInplaceImpl<B: Backend> {
129 fn vec_znx_big_sub_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
130 where
131 R: VecZnxBigToMut<B>,
132 A: VecZnxBigToRef<B>;
133}
134
135/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
136/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
137/// * See [crate::api::VecZnxBigSubNegateInplace] for corresponding public API.
138/// # Safety [crate::doc::backend_safety] for safety contract.
139pub unsafe trait VecZnxBigSubNegateInplaceImpl<B: Backend> {
140 fn vec_znx_big_sub_negate_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
141 where
142 R: VecZnxBigToMut<B>,
143 A: VecZnxBigToRef<B>;
144}
145
146/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
147/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
148/// * See [crate::api::VecZnxBigSubSmallA] for corresponding public API.
149/// # Safety [crate::doc::backend_safety] for safety contract.
150pub unsafe trait VecZnxBigSubSmallAImpl<B: Backend> {
151 fn vec_znx_big_sub_small_a_impl<R, A, C>(
152 module: &Module<B>,
153 res: &mut R,
154 res_col: usize,
155 a: &A,
156 a_col: usize,
157 b: &C,
158 b_col: usize,
159 ) where
160 R: VecZnxBigToMut<B>,
161 A: VecZnxToRef,
162 C: VecZnxBigToRef<B>;
163}
164
165/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
166/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
167/// * See [crate::api::VecZnxBigSubSmallInplace] for corresponding public API.
168/// # Safety [crate::doc::backend_safety] for safety contract.
169pub unsafe trait VecZnxBigSubSmallInplaceImpl<B: Backend> {
170 fn vec_znx_big_sub_small_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
171 where
172 R: VecZnxBigToMut<B>,
173 A: VecZnxToRef;
174}
175
176/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
177/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
178/// * See [crate::api::VecZnxBigSubSmallB] for corresponding public API.
179/// # Safety [crate::doc::backend_safety] for safety contract.
180pub unsafe trait VecZnxBigSubSmallBImpl<B: Backend> {
181 fn vec_znx_big_sub_small_b_impl<R, A, C>(
182 module: &Module<B>,
183 res: &mut R,
184 res_col: usize,
185 a: &A,
186 a_col: usize,
187 b: &C,
188 b_col: usize,
189 ) where
190 R: VecZnxBigToMut<B>,
191 A: VecZnxBigToRef<B>,
192 C: VecZnxToRef;
193}
194
195/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
196/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
197/// * See [crate::api::VecZnxBigSubSmallNegateInplace] for corresponding public API.
198/// # Safety [crate::doc::backend_safety] for safety contract.
199pub unsafe trait VecZnxBigSubSmallNegateInplaceImpl<B: Backend> {
200 fn vec_znx_big_sub_small_negate_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
201 where
202 R: VecZnxBigToMut<B>,
203 A: VecZnxToRef;
204}
205
206/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
207/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
208/// * See [crate::api::VecZnxBigNegate] for corresponding public API.
209/// # Safety [crate::doc::backend_safety] for safety contract.
210pub unsafe trait VecZnxBigNegateImpl<B: Backend> {
211 fn vec_znx_big_negate_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
212 where
213 R: VecZnxBigToMut<B>,
214 A: VecZnxBigToRef<B>;
215}
216
217/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
218/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
219/// * See [crate::api::VecZnxBigNegateInplace] for corresponding public API.
220/// # Safety [crate::doc::backend_safety] for safety contract.
221pub unsafe trait VecZnxBigNegateInplaceImpl<B: Backend> {
222 fn vec_znx_big_negate_inplace_impl<A>(module: &Module<B>, a: &mut A, a_col: usize)
223 where
224 A: VecZnxBigToMut<B>;
225}
226
227/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
228/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
229/// * See [crate::api::VecZnxBigNormalizeTmpBytes] for corresponding public API.
230/// # Safety [crate::doc::backend_safety] for safety contract.
231pub unsafe trait VecZnxBigNormalizeTmpBytesImpl<B: Backend> {
232 fn vec_znx_big_normalize_tmp_bytes_impl(module: &Module<B>) -> usize;
233}
234
235#[allow(clippy::too_many_arguments)]
236/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
237/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
238/// * See [crate::api::VecZnxBigNormalize] for corresponding public API.
239/// # Safety [crate::doc::backend_safety] for safety contract.
240pub unsafe trait VecZnxBigNormalizeImpl<B: Backend> {
241 fn vec_znx_big_normalize_impl<R, A>(
242 module: &Module<B>,
243 res_basek: usize,
244 res: &mut R,
245 res_col: usize,
246 a_basek: usize,
247 a: &A,
248 a_col: usize,
249 scratch: &mut Scratch<B>,
250 ) where
251 R: VecZnxToMut,
252 A: VecZnxBigToRef<B>;
253}
254
255/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
256/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
257/// * See [crate::api::VecZnxBigAutomorphism] for corresponding public API.
258/// # Safety [crate::doc::backend_safety] for safety contract.
259pub unsafe trait VecZnxBigAutomorphismImpl<B: Backend> {
260 fn vec_znx_big_automorphism_impl<R, A>(module: &Module<B>, k: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
261 where
262 R: VecZnxBigToMut<B>,
263 A: VecZnxBigToRef<B>;
264}
265
266/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
267/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
268/// * See [crate::api::VecZnxBigAutomorphismInplaceTmpBytes] for corresponding public API.
269/// # Safety [crate::doc::backend_safety] for safety contract.
270pub unsafe trait VecZnxBigAutomorphismInplaceTmpBytesImpl<B: Backend> {
271 fn vec_znx_big_automorphism_inplace_tmp_bytes_impl(module: &Module<B>) -> usize;
272}
273
274/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
275/// * See the [poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx_big.rs) reference implementation.
276/// * See [crate::api::VecZnxBigAutomorphismInplace] for corresponding public API.
277/// # Safety [crate::doc::backend_safety] for safety contract.
278pub unsafe trait VecZnxBigAutomorphismInplaceImpl<B: Backend> {
279 fn vec_znx_big_automorphism_inplace_impl<A>(module: &Module<B>, k: i64, a: &mut A, a_col: usize, scratch: &mut Scratch<B>)
280 where
281 A: VecZnxBigToMut<B>;
282}