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