poulpy/poulpy-hal/src/oep/vec_znx.rs
poulpy-hal/src/oep/vec_znx.rsRaw
1use crate::{
2 layouts::{Backend, Module, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef},
3 source::Source,
4};
5
6/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
7/// * See TODO for reference implementation.
8/// * See [crate::api::VecZnxZero] for corresponding public API.
9/// # Safety [crate::doc::backend_safety] for safety contract.
10pub unsafe trait VecZnxZeroImpl<B: Backend> {
11 fn vec_znx_zero_impl<R>(module: &Module<B>, res: &mut R, res_col: usize)
12 where
13 R: VecZnxToMut;
14}
15
16/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
17/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
18/// * See [crate::api::VecZnxNormalizeTmpBytes] for corresponding public API.
19/// # Safety [crate::doc::backend_safety] for safety contract.
20pub unsafe trait VecZnxNormalizeTmpBytesImpl<B: Backend> {
21 fn vec_znx_normalize_tmp_bytes_impl(module: &Module<B>) -> usize;
22}
23
24/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
25/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
26/// * See [crate::api::VecZnxNormalize] for corresponding public API.
27/// # Safety [crate::doc::backend_safety] for safety contract.
28pub unsafe trait VecZnxNormalizeImpl<B: Backend> {
29 #[allow(clippy::too_many_arguments)]
30 fn vec_znx_normalize_impl<R, A>(
31 module: &Module<B>,
32 res: &mut R,
33 res_base2k: usize,
34 res_offset: i64,
35 res_col: usize,
36 a: &A,
37 a_base2k: usize,
38 a_col: usize,
39 scratch: &mut Scratch<B>,
40 ) where
41 R: VecZnxToMut,
42 A: VecZnxToRef;
43}
44
45/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
46/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
47/// * See [crate::api::VecZnxNormalizeInplace] for corresponding public API.
48/// # Safety [crate::doc::backend_safety] for safety contract.
49pub unsafe trait VecZnxNormalizeInplaceImpl<B: Backend> {
50 fn vec_znx_normalize_inplace_impl<A>(module: &Module<B>, base2k: usize, a: &mut A, a_col: usize, scratch: &mut Scratch<B>)
51 where
52 A: VecZnxToMut;
53}
54
55/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
56/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
57/// * See [crate::api::VecZnxAdd] for corresponding public API.
58/// # Safety [crate::doc::backend_safety] for safety contract.
59pub unsafe trait VecZnxAddImpl<B: Backend> {
60 fn vec_znx_add_impl<R, A, C>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
61 where
62 R: VecZnxToMut,
63 A: VecZnxToRef,
64 C: VecZnxToRef;
65}
66
67/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
68/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
69/// * See [crate::api::VecZnxAddInplace] for corresponding public API.
70/// # Safety [crate::doc::backend_safety] for safety contract.
71pub unsafe trait VecZnxAddInplaceImpl<B: Backend> {
72 fn vec_znx_add_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
73 where
74 R: VecZnxToMut,
75 A: VecZnxToRef;
76}
77
78/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
79/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
80/// * See [crate::api::VecZnxAddScalar] for corresponding public API.
81/// # Safety [crate::doc::backend_safety] for safety contract.
82pub unsafe trait VecZnxAddScalarImpl<D: Backend> {
83 /// Adds the selected column of `a` on the selected column and limb of `b` and writes the result on the selected column of `res`.
84 #[allow(clippy::too_many_arguments)]
85 fn vec_znx_add_scalar_impl<R, A, B>(
86 module: &Module<D>,
87 res: &mut R,
88 res_col: usize,
89 a: &A,
90 a_col: usize,
91 b: &B,
92 b_col: usize,
93 b_limb: usize,
94 ) where
95 R: VecZnxToMut,
96 A: ScalarZnxToRef,
97 B: VecZnxToRef;
98}
99
100/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
101/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
102/// * See [crate::api::VecZnxAddScalarInplace] for corresponding public API.
103/// # Safety [crate::doc::backend_safety] for safety contract.
104pub unsafe trait VecZnxAddScalarInplaceImpl<B: Backend> {
105 fn vec_znx_add_scalar_inplace_impl<R, A>(
106 module: &Module<B>,
107 res: &mut R,
108 res_col: usize,
109 res_limb: usize,
110 a: &A,
111 a_col: usize,
112 ) where
113 R: VecZnxToMut,
114 A: ScalarZnxToRef;
115}
116
117/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
118/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
119/// * See [crate::api::VecZnxSub] for corresponding public API.
120/// # Safety [crate::doc::backend_safety] for safety contract.
121pub unsafe trait VecZnxSubImpl<B: Backend> {
122 fn vec_znx_sub_impl<R, A, C>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
123 where
124 R: VecZnxToMut,
125 A: VecZnxToRef,
126 C: VecZnxToRef;
127}
128
129/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
130/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
131/// * See [crate::api::VecZnxSubInplace] for corresponding public API.
132/// # Safety [crate::doc::backend_safety] for safety contract.
133pub unsafe trait VecZnxSubInplaceImpl<B: Backend> {
134 fn vec_znx_sub_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
135 where
136 R: VecZnxToMut,
137 A: VecZnxToRef;
138}
139
140/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
141/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
142/// * See [crate::api::VecZnxSubNegateInplace] for corresponding public API.
143/// # Safety [crate::doc::backend_safety] for safety contract.
144pub unsafe trait VecZnxSubNegateInplaceImpl<B: Backend> {
145 fn vec_znx_sub_negate_inplace_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
146 where
147 R: VecZnxToMut,
148 A: VecZnxToRef;
149}
150
151/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
152/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
153/// * See [crate::api::VecZnxAddScalar] for corresponding public API.
154/// # Safety [crate::doc::backend_safety] for safety contract.
155pub unsafe trait VecZnxSubScalarImpl<D: Backend> {
156 /// Adds the selected column of `a` on the selected column and limb of `b` and writes the result on the selected column of `res`.
157 #[allow(clippy::too_many_arguments)]
158 fn vec_znx_sub_scalar_impl<R, A, B>(
159 module: &Module<D>,
160 res: &mut R,
161 res_col: usize,
162 a: &A,
163 a_col: usize,
164 b: &B,
165 b_col: usize,
166 b_limb: usize,
167 ) where
168 R: VecZnxToMut,
169 A: ScalarZnxToRef,
170 B: VecZnxToRef;
171}
172
173/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
174/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
175/// * See [crate::api::VecZnxSubScalarInplace] for corresponding public API.
176/// # Safety [crate::doc::backend_safety] for safety contract.
177pub unsafe trait VecZnxSubScalarInplaceImpl<B: Backend> {
178 fn vec_znx_sub_scalar_inplace_impl<R, A>(
179 module: &Module<B>,
180 res: &mut R,
181 res_col: usize,
182 res_limb: usize,
183 a: &A,
184 a_col: usize,
185 ) where
186 R: VecZnxToMut,
187 A: ScalarZnxToRef;
188}
189
190/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
191/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
192/// * See [crate::api::VecZnxNegate] for corresponding public API.
193/// # Safety [crate::doc::backend_safety] for safety contract.
194pub unsafe trait VecZnxNegateImpl<B: Backend> {
195 fn vec_znx_negate_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
196 where
197 R: VecZnxToMut,
198 A: VecZnxToRef;
199}
200
201/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
202/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
203/// * See [crate::api::VecZnxNegateInplace] for corresponding public API.
204/// # Safety [crate::doc::backend_safety] for safety contract.
205pub unsafe trait VecZnxNegateInplaceImpl<B: Backend> {
206 fn vec_znx_negate_inplace_impl<A>(module: &Module<B>, a: &mut A, a_col: usize)
207 where
208 A: VecZnxToMut;
209}
210
211/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
212/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
213/// * See [crate::api::VecZnxRshTmpBytes] for corresponding public API.
214/// # Safety [crate::doc::backend_safety] for safety contract.
215pub unsafe trait VecZnxRshTmpBytesImpl<B: Backend> {
216 fn vec_znx_rsh_tmp_bytes_impl(module: &Module<B>) -> usize;
217}
218
219/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
220/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
221/// * See [crate::api::VecZnxRsh] for corresponding public API.
222/// # Safety [crate::doc::backend_safety] for safety contract.
223pub unsafe trait VecZnxRshImpl<B: Backend> {
224 #[allow(clippy::too_many_arguments)]
225 fn vec_znx_rsh_impl<R, A>(
226 module: &Module<B>,
227 base2k: usize,
228 k: usize,
229 res: &mut R,
230 res_col: usize,
231 a: &A,
232 a_col: usize,
233 scratch: &mut Scratch<B>,
234 ) where
235 R: VecZnxToMut,
236 A: VecZnxToRef;
237}
238
239/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
240/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
241/// * See [crate::api::VecZnxLshTmpBytes] for corresponding public API.
242/// # Safety [crate::doc::backend_safety] for safety contract.
243pub unsafe trait VecZnxLshTmpBytesImpl<B: Backend> {
244 fn vec_znx_lsh_tmp_bytes_impl(module: &Module<B>) -> usize;
245}
246
247/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
248/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
249/// * See [crate::api::VecZnxLsh] for corresponding public API.
250/// # Safety [crate::doc::backend_safety] for safety contract.
251pub unsafe trait VecZnxLshImpl<B: Backend> {
252 #[allow(clippy::too_many_arguments)]
253 fn vec_znx_lsh_impl<R, A>(
254 module: &Module<B>,
255 base2k: usize,
256 k: usize,
257 res: &mut R,
258 res_col: usize,
259 a: &A,
260 a_col: usize,
261 scratch: &mut Scratch<B>,
262 ) where
263 R: VecZnxToMut,
264 A: VecZnxToRef;
265}
266
267/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
268/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
269/// * See [crate::api::VecZnxRshInplace] for corresponding public API.
270/// # Safety [crate::doc::backend_safety] for safety contract.
271pub unsafe trait VecZnxRshInplaceImpl<B: Backend> {
272 fn vec_znx_rsh_inplace_impl<R>(
273 module: &Module<B>,
274 base2k: usize,
275 k: usize,
276 res: &mut R,
277 res_col: usize,
278 scratch: &mut Scratch<B>,
279 ) where
280 R: VecZnxToMut;
281}
282
283/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
284/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
285/// * See [crate::api::VecZnxLshInplace] for corresponding public API.
286/// # Safety [crate::doc::backend_safety] for safety contract.
287pub unsafe trait VecZnxLshInplaceImpl<B: Backend> {
288 fn vec_znx_lsh_inplace_impl<R>(
289 module: &Module<B>,
290 base2k: usize,
291 k: usize,
292 res: &mut R,
293 res_col: usize,
294 scratch: &mut Scratch<B>,
295 ) where
296 R: VecZnxToMut;
297}
298
299/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
300/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
301/// * See [crate::api::VecZnxRotate] for corresponding public API.
302/// # Safety [crate::doc::backend_safety] for safety contract.
303pub unsafe trait VecZnxRotateImpl<B: Backend> {
304 fn vec_znx_rotate_impl<R, A>(module: &Module<B>, k: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
305 where
306 R: VecZnxToMut,
307 A: VecZnxToRef;
308}
309
310/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
311/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
312/// * See [crate::api::VecZnxRotateInplaceTmpBytes] for corresponding public API.
313/// # Safety [crate::doc::backend_safety] for safety contract.
314pub unsafe trait VecZnxRotateInplaceTmpBytesImpl<B: Backend> {
315 fn vec_znx_rotate_inplace_tmp_bytes_impl(module: &Module<B>) -> usize;
316}
317
318/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
319/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
320/// * See [crate::api::VecZnxRotateInplace] for corresponding public API.
321/// # Safety [crate::doc::backend_safety] for safety contract.
322pub unsafe trait VecZnxRotateInplaceImpl<B: Backend> {
323 fn vec_znx_rotate_inplace_impl<A>(module: &Module<B>, k: i64, a: &mut A, a_col: usize, scratch: &mut Scratch<B>)
324 where
325 A: VecZnxToMut;
326}
327
328/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
329/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
330/// * See [crate::api::VecZnxAutomorphism] for corresponding public API.
331/// # Safety [crate::doc::backend_safety] for safety contract.
332pub unsafe trait VecZnxAutomorphismImpl<B: Backend> {
333 fn vec_znx_automorphism_impl<R, A>(module: &Module<B>, p: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
334 where
335 R: VecZnxToMut,
336 A: VecZnxToRef;
337}
338
339/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
340/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
341/// * See [crate::api::VecZnxAutomorphismInplaceTmpBytes] for corresponding public API.
342/// # Safety [crate::doc::backend_safety] for safety contract.
343pub unsafe trait VecZnxAutomorphismInplaceTmpBytesImpl<B: Backend> {
344 fn vec_znx_automorphism_inplace_tmp_bytes_impl(module: &Module<B>) -> usize;
345}
346
347/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
348/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
349/// * See [crate::api::VecZnxAutomorphismInplace] for corresponding public API.
350/// # Safety [crate::doc::backend_safety] for safety contract.
351pub unsafe trait VecZnxAutomorphismInplaceImpl<B: Backend> {
352 fn vec_znx_automorphism_inplace_impl<R>(module: &Module<B>, k: i64, res: &mut R, res_col: usize, scratch: &mut Scratch<B>)
353 where
354 R: VecZnxToMut;
355}
356
357/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
358/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
359/// * See [crate::api::VecZnxMulXpMinusOne] for corresponding public API.
360/// # Safety [crate::doc::backend_safety] for safety contract.
361pub unsafe trait VecZnxMulXpMinusOneImpl<B: Backend> {
362 fn vec_znx_mul_xp_minus_one_impl<R, A>(module: &Module<B>, p: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
363 where
364 R: VecZnxToMut,
365 A: VecZnxToRef;
366}
367
368/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
369/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
370/// * See [crate::api::VecZnxMulXpMinusOneInplaceTmpBytes] for corresponding public API.
371/// # Safety [crate::doc::backend_safety] for safety contract.
372pub unsafe trait VecZnxMulXpMinusOneInplaceTmpBytesImpl<B: Backend> {
373 fn vec_znx_mul_xp_minus_one_inplace_tmp_bytes_impl(module: &Module<B>) -> usize;
374}
375
376/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
377/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
378/// * See [crate::api::VecZnxMulXpMinusOneInplace] for corresponding public API.
379/// # Safety [crate::doc::backend_safety] for safety contract.
380pub unsafe trait VecZnxMulXpMinusOneInplaceImpl<B: Backend> {
381 fn vec_znx_mul_xp_minus_one_inplace_impl<R>(
382 module: &Module<B>,
383 p: i64,
384 res: &mut R,
385 res_col: usize,
386 scratch: &mut Scratch<B>,
387 ) where
388 R: VecZnxToMut;
389}
390
391/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
392/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
393/// * See [crate::api::VecZnxSplitRingTmpBytes] for corresponding public API.
394/// # Safety [crate::doc::backend_safety] for safety contract.
395pub unsafe trait VecZnxSplitRingTmpBytesImpl<B: Backend> {
396 fn vec_znx_split_ring_tmp_bytes_impl(module: &Module<B>) -> usize;
397}
398
399/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
400/// * See [crate::cpu_spqlios::vec_znx::vec_znx_split_ref] for reference code.
401/// * See [crate::api::VecZnxSplitRing] for corresponding public API.
402/// # Safety [crate::doc::backend_safety] for safety contract.
403pub unsafe trait VecZnxSplitRingImpl<B: Backend> {
404 fn vec_znx_split_ring_impl<R, A>(
405 module: &Module<B>,
406 res: &mut [R],
407 res_col: usize,
408 a: &A,
409 a_col: usize,
410 scratch: &mut Scratch<B>,
411 ) where
412 R: VecZnxToMut,
413 A: VecZnxToRef;
414}
415
416/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
417/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
418/// * See [crate::api::VecZnxMergeRingsTmpBytes] for corresponding public API.
419/// # Safety [crate::doc::backend_safety] for safety contract.
420pub unsafe trait VecZnxMergeRingsTmpBytesImpl<B: Backend> {
421 fn vec_znx_merge_rings_tmp_bytes_impl(module: &Module<B>) -> usize;
422}
423
424/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
425/// * See [crate::cpu_spqlios::vec_znx::vec_znx_merge_ref] for reference code.
426/// * See [crate::api::VecZnxMerge] for corresponding public API.
427/// # Safety [crate::doc::backend_safety] for safety contract.
428pub unsafe trait VecZnxMergeRingsImpl<B: Backend> {
429 fn vec_znx_merge_rings_impl<R, A>(
430 module: &Module<B>,
431 res: &mut R,
432 res_col: usize,
433 a: &[A],
434 a_col: usize,
435 scratch: &mut Scratch<B>,
436 ) where
437 R: VecZnxToMut,
438 A: VecZnxToRef;
439}
440
441/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
442/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
443/// * See [crate::api::VecZnxSwithcDegree] for corresponding public API.
444/// # Safety [crate::doc::backend_safety] for safety contract.
445pub unsafe trait VecZnxSwitchRingImpl<B: Backend> {
446 fn vec_znx_switch_ring_impl<R: VecZnxToMut, A: VecZnxToRef>(
447 module: &Module<B>,
448 res: &mut R,
449 res_col: usize,
450 a: &A,
451 a_col: usize,
452 );
453}
454
455/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
456/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
457/// * See [crate::api::VecZnxCopy] for corresponding public API.
458/// # Safety [crate::doc::backend_safety] for safety contract.
459pub unsafe trait VecZnxCopyImpl<B: Backend> {
460 fn vec_znx_copy_impl<R, A>(module: &Module<B>, res: &mut R, res_col: usize, a: &A, a_col: usize)
461 where
462 R: VecZnxToMut,
463 A: VecZnxToRef;
464}
465
466/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
467/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
468/// * See [crate::api::VecZnxFillUniform] for corresponding public API.
469/// # Safety [crate::doc::backend_safety] for safety contract.
470pub unsafe trait VecZnxFillUniformImpl<B: Backend> {
471 fn vec_znx_fill_uniform_impl<R>(module: &Module<B>, base2k: usize, res: &mut R, res_col: usize, source: &mut Source)
472 where
473 R: VecZnxToMut;
474}
475
476#[allow(clippy::too_many_arguments)]
477/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
478/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
479/// * See [crate::api::VecZnxFillNormal] for corresponding public API.
480/// # Safety [crate::doc::backend_safety] for safety contract.
481pub unsafe trait VecZnxFillNormalImpl<B: Backend> {
482 fn vec_znx_fill_normal_impl<R>(
483 module: &Module<B>,
484 base2k: usize,
485 res: &mut R,
486 res_col: usize,
487 k: usize,
488 source: &mut Source,
489 sigma: f64,
490 bound: f64,
491 ) where
492 R: VecZnxToMut;
493}
494
495#[allow(clippy::too_many_arguments)]
496/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
497/// * See [poulpy-backend/src/cpu_fft64_ref/vec_znx.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/vec_znx.rs) for reference implementation.
498/// * See [crate::api::VecZnxAddNormal] for corresponding public API.
499/// # Safety [crate::doc::backend_safety] for safety contract.
500pub unsafe trait VecZnxAddNormalImpl<B: Backend> {
501 fn vec_znx_add_normal_impl<R>(
502 module: &Module<B>,
503 base2k: usize,
504 res: &mut R,
505 res_col: usize,
506 k: usize,
507 source: &mut Source,
508 sigma: f64,
509 bound: f64,
510 ) where
511 R: VecZnxToMut;
512}