arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/poulpy-hal/src/oep/zn.rs
poulpy-hal/src/oep/zn.rsRaw
 1use crate::{
 2    layouts::{Backend, Scratch, ZnToMut},
 3    source::Source,
 4};
 5
 6/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
 7/// * See [poulpy-backend/src/cpu_fft64_ref/zn.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/zn.rs) for reference implementation.
 8/// * See [crate::api::ZnNormalizeTmpBytes] for corresponding public API.
 9/// # Safety [crate::doc::backend_safety] for safety contract.
10pub unsafe trait ZnNormalizeTmpBytesImpl<B: Backend> {
11    fn zn_normalize_tmp_bytes_impl(n: usize) -> usize;
12}
13
14/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
15/// * See [poulpy-backend/src/cpu_fft64_ref/zn.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/zn.rs) for reference implementation.
16/// * See [crate::api::ZnNormalizeInplace] for corresponding public API.
17/// # Safety [crate::doc::backend_safety] for safety contract.
18pub unsafe trait ZnNormalizeInplaceImpl<B: Backend> {
19    fn zn_normalize_inplace_impl<R>(n: usize, base2k: usize, res: &mut R, res_col: usize, scratch: &mut Scratch<B>)
20    where
21        R: ZnToMut;
22}
23
24/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
25/// * See [poulpy-backend/src/cpu_fft64_ref/zn.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/zn.rs) for reference implementation.
26/// * See [crate::api::ZnFillUniform] for corresponding public API.
27/// # Safety [crate::doc::backend_safety] for safety contract.
28pub unsafe trait ZnFillUniformImpl<B: Backend> {
29    fn zn_fill_uniform_impl<R>(n: usize, base2k: usize, res: &mut R, res_col: usize, source: &mut Source)
30    where
31        R: ZnToMut;
32}
33
34#[allow(clippy::too_many_arguments)]
35/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
36/// * See [poulpy-backend/src/cpu_fft64_ref/zn.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/zn.rs) for reference implementation.
37/// * See [crate::api::ZnFillNormal] for corresponding public API.
38/// # Safety [crate::doc::backend_safety] for safety contract.
39pub unsafe trait ZnFillNormalImpl<B: Backend> {
40    fn zn_fill_normal_impl<R>(
41        n: usize,
42        base2k: usize,
43        res: &mut R,
44        res_col: usize,
45        k: usize,
46        source: &mut Source,
47        sigma: f64,
48        bound: f64,
49    ) where
50        R: ZnToMut;
51}
52
53#[allow(clippy::too_many_arguments)]
54/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
55/// * See [poulpy-backend/src/cpu_fft64_ref/zn.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/zn.rs) for reference implementation.
56/// * See [crate::api::ZnAddNormal] for corresponding public API.
57/// # Safety [crate::doc::backend_safety] for safety contract.
58pub unsafe trait ZnAddNormalImpl<B: Backend> {
59    fn zn_add_normal_impl<R>(
60        n: usize,
61        base2k: usize,
62        res: &mut R,
63        res_col: usize,
64        k: usize,
65        source: &mut Source,
66        sigma: f64,
67        bound: f64,
68    ) where
69        R: ZnToMut;
70}