1use rand_distr::Distribution;
2
3use crate::{
4 layouts::{Backend, Scratch, ZnToMut},
5 source::Source,
6};
7
8pub trait ZnNormalizeInplace<B: Backend> {
9 fn zn_normalize_inplace<A>(&self, n: usize, basek: usize, a: &mut A, a_col: usize, scratch: &mut Scratch<B>)
11 where
12 A: ZnToMut;
13}
14
15pub trait ZnFillUniform {
16 fn zn_fill_uniform<R>(&self, n: usize, basek: usize, res: &mut R, res_col: usize, k: usize, source: &mut Source)
18 where
19 R: ZnToMut;
20}
21
22#[allow(clippy::too_many_arguments)]
23pub trait ZnFillDistF64 {
24 fn zn_fill_dist_f64<R, D: Distribution<f64>>(
25 &self,
26 n: usize,
27 basek: usize,
28 res: &mut R,
29 res_col: usize,
30 k: usize,
31 source: &mut Source,
32 dist: D,
33 bound: f64,
34 ) where
35 R: ZnToMut;
36}
37
38#[allow(clippy::too_many_arguments)]
39pub trait ZnAddDistF64 {
40 fn zn_add_dist_f64<R, D: Distribution<f64>>(
42 &self,
43 n: usize,
44 basek: usize,
45 res: &mut R,
46 res_col: usize,
47 k: usize,
48 source: &mut Source,
49 dist: D,
50 bound: f64,
51 ) where
52 R: ZnToMut;
53}
54
55#[allow(clippy::too_many_arguments)]
56pub trait ZnFillNormal {
57 fn zn_fill_normal<R>(
58 &self,
59 n: usize,
60 basek: usize,
61 res: &mut R,
62 res_col: usize,
63 k: usize,
64 source: &mut Source,
65 sigma: f64,
66 bound: f64,
67 ) where
68 R: ZnToMut;
69}
70
71#[allow(clippy::too_many_arguments)]
72pub trait ZnAddNormal {
73 fn zn_add_normal<R>(
75 &self,
76 n: usize,
77 basek: usize,
78 res: &mut R,
79 res_col: usize,
80 k: usize,
81 source: &mut Source,
82 sigma: f64,
83 bound: f64,
84 ) where
85 R: ZnToMut;
86}