1 //! Implementation of the gaussian kernel. |
1 //! Implementation of the gaussian kernel. |
2 |
2 |
3 use float_extras::f64::erf; |
3 use float_extras::f64::erf; |
4 use numeric_literals::replace_float_literals; |
4 use numeric_literals::replace_float_literals; |
5 use serde::Serialize; |
5 use serde::{Serialize, Deserialize}; |
6 use alg_tools::types::*; |
6 use alg_tools::types::*; |
7 use alg_tools::euclidean::Euclidean; |
7 use alg_tools::euclidean::Euclidean; |
8 use alg_tools::norms::*; |
8 use alg_tools::norms::*; |
9 use alg_tools::loc::Loc; |
9 use alg_tools::loc::Loc; |
10 use alg_tools::sets::Cube; |
10 use alg_tools::sets::Cube; |
32 |
32 |
33 /// Storage presentation of the the anisotropic gaussian kernel of `variance` $σ^2$. |
33 /// Storage presentation of the the anisotropic gaussian kernel of `variance` $σ^2$. |
34 /// |
34 /// |
35 /// This is the function $f(x) = C e^{-\\|x\\|\_2^2/(2σ^2)}$ for $x ∈ ℝ^N$ |
35 /// This is the function $f(x) = C e^{-\\|x\\|\_2^2/(2σ^2)}$ for $x ∈ ℝ^N$ |
36 /// with $C=1/(2πσ^2)^{N/2}$. |
36 /// with $C=1/(2πσ^2)^{N/2}$. |
37 #[derive(Copy,Clone,Debug,Serialize,Eq)] |
37 #[derive(Copy,Clone,Debug,Serialize,Deserialize,Eq)] |
38 pub struct Gaussian<S : Constant, const N : usize> { |
38 pub struct Gaussian<S : Constant, const N : usize> { |
39 /// The variance $σ^2$. |
39 /// The variance $σ^2$. |
40 pub variance : S, |
40 pub variance : S, |
41 } |
41 } |
42 |
42 |