47 /// Transport step length $θ$ normalised to $(0, 1)$. |
47 /// Transport step length $θ$ normalised to $(0, 1)$. |
48 pub θ0 : F, |
48 pub θ0 : F, |
49 /// Factor in $(0, 1)$ for decreasing transport to adapt to tolerance. |
49 /// Factor in $(0, 1)$ for decreasing transport to adapt to tolerance. |
50 pub adaptation : F, |
50 pub adaptation : F, |
51 /// A posteriori transport tolerance multiplier (C_pos) |
51 /// A posteriori transport tolerance multiplier (C_pos) |
52 pub tolerance_mult_pos : F, |
52 pub tolerance_mult_con : F, |
53 } |
53 } |
54 |
54 |
55 #[replace_float_literals(F::cast_from(literal))] |
55 #[replace_float_literals(F::cast_from(literal))] |
56 impl <F : Float> TransportConfig<F> { |
56 impl <F : Float> TransportConfig<F> { |
57 /// Check that the parameters are ok. Panics if not. |
57 /// Check that the parameters are ok. Panics if not. |
58 pub fn check(&self) { |
58 pub fn check(&self) { |
59 assert!(self.θ0 > 0.0); |
59 assert!(self.θ0 > 0.0); |
60 assert!(0.0 < self.adaptation && self.adaptation < 1.0); |
60 assert!(0.0 < self.adaptation && self.adaptation < 1.0); |
61 assert!(self.tolerance_mult_pos > 0.0); |
61 assert!(self.tolerance_mult_con > 0.0); |
62 } |
62 } |
63 } |
63 } |
64 |
64 |
65 #[replace_float_literals(F::cast_from(literal))] |
65 #[replace_float_literals(F::cast_from(literal))] |
66 impl<F : Float> Default for TransportConfig<F> { |
66 impl<F : Float> Default for TransportConfig<F> { |
67 fn default() -> Self { |
67 fn default() -> Self { |
68 TransportConfig { |
68 TransportConfig { |
69 θ0 : 0.9, |
69 θ0 : 0.9, |
70 adaptation : 0.9, |
70 adaptation : 0.9, |
71 tolerance_mult_pos : 100.0, |
71 tolerance_mult_con : 100.0, |
72 } |
72 } |
73 } |
73 } |
74 } |
74 } |
75 |
75 |
76 /// Settings for [`pointsource_sliding_fb_reg`]. |
76 /// Settings for [`pointsource_sliding_fb_reg`]. |
235 // 2. Through bounding ∫ B_ω(y, z) dλ(x, y, z). |
235 // 2. Through bounding ∫ B_ω(y, z) dλ(x, y, z). |
236 // through the estimate ≤ C ‖Δ‖‖γ^{k+1}‖ for Δ := μ^{k+1}-μ^k-(π_♯^1-π_♯^0)γ^{k+1}, |
236 // through the estimate ≤ C ‖Δ‖‖γ^{k+1}‖ for Δ := μ^{k+1}-μ^k-(π_♯^1-π_♯^0)γ^{k+1}, |
237 // which holds for some some C if the convolution kernel in 𝒟 has Lipschitz gradient. |
237 // which holds for some some C if the convolution kernel in 𝒟 has Lipschitz gradient. |
238 let nγ = γ1.norm(Radon); |
238 let nγ = γ1.norm(Radon); |
239 let nΔ = μ_base_minus_γ0.norm(Radon) + μ.dist_matching(&γ1) + extra.unwrap_or(0.0); |
239 let nΔ = μ_base_minus_γ0.norm(Radon) + μ.dist_matching(&γ1) + extra.unwrap_or(0.0); |
240 let t = ε * tconfig.tolerance_mult_pos; |
240 let t = ε * tconfig.tolerance_mult_con; |
241 if nγ*nΔ > t { |
241 if nγ*nΔ > t { |
242 // Since t/(nγ*nΔ)<1, and the constant tconfig.adaptation < 1, |
242 // Since t/(nγ*nΔ)<1, and the constant tconfig.adaptation < 1, |
243 // this will guarantee that eventually ‖γ‖ decreases sufficiently that we |
243 // this will guarantee that eventually ‖γ‖ decreases sufficiently that we |
244 // will not enter here. |
244 // will not enter here. |
245 *γ1 *= tconfig.adaptation * t / ( nγ * nΔ ); |
245 *γ1 *= tconfig.adaptation * t / ( nγ * nΔ ); |