1 |
1 |
2 //! Implementation of the indicator function of a ball with respect to various norms. |
2 //! Implementation of the indicator function of a ball with respect to various norms. |
3 use float_extras::f64::tgamma as gamma; |
3 use float_extras::f64::tgamma as gamma; |
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::norms::*; |
7 use alg_tools::norms::*; |
8 use alg_tools::loc::Loc; |
8 use alg_tools::loc::Loc; |
9 use alg_tools::sets::Cube; |
9 use alg_tools::sets::Cube; |
10 use alg_tools::bisection_tree::{ |
10 use alg_tools::bisection_tree::{ |
26 use crate::types::*; |
26 use crate::types::*; |
27 use super::base::*; |
27 use super::base::*; |
28 |
28 |
29 /// Representation of the indicator of the ball $𝔹_q = \\{ x ∈ ℝ^N \mid \\|x\\|\_q ≤ r \\}$, |
29 /// Representation of the indicator of the ball $𝔹_q = \\{ x ∈ ℝ^N \mid \\|x\\|\_q ≤ r \\}$, |
30 /// where $q$ is the `Exponent`, and $r$ is the radius [`Constant`] `C`. |
30 /// where $q$ is the `Exponent`, and $r$ is the radius [`Constant`] `C`. |
31 #[derive(Copy,Clone,Serialize,Debug,Eq,PartialEq)] |
31 #[derive(Copy,Clone,Serialize,Deserialize,Debug,Eq,PartialEq)] |
32 pub struct BallIndicator<C : Constant, Exponent : NormExponent, const N : usize> { |
32 pub struct BallIndicator<C : Constant, Exponent : NormExponent, const N : usize> { |
33 /// The radius of the ball. |
33 /// The radius of the ball. |
34 pub r : C, |
34 pub r : C, |
35 /// The exponent $q$ of the norm creating the ball |
35 /// The exponent $q$ of the norm creating the ball |
36 pub exponent : Exponent, |
36 pub exponent : Exponent, |