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