src/prox_penalty/radon_squared.rs

Mon, 06 Jan 2025 21:37:03 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Mon, 06 Jan 2025 21:37:03 -0500
branch
dev
changeset 38
0f59c0d02e13
parent 37
c5d8bd1a7728
child 39
6316d68b58af
permissions
-rw-r--r--

Attempt to do more Serialize / Deserialize but run into csv problems

37
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 /*!
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 Solver for the point source localisation problem using a simplified forward-backward splitting method.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 Instead of the $𝒟$-norm of `fb.rs`, this uses a standard Radon norm for the proximal map.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 */
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 use numeric_literals::replace_float_literals;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 use serde::{Serialize, Deserialize};
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9 use nalgebra::DVector;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 use alg_tools::iterate::{
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12 AlgIteratorIteration,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 AlgIterator
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15 use alg_tools::norms::L2;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 use alg_tools::linops::Mapping;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
17 use alg_tools::bisection_tree::{
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
18 BTFN,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
19 Bounds,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
20 BTSearch,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
21 SupportGenerator,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
22 LocalAnalysis,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
23 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
24 use alg_tools::mapping::RealMapping;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
25 use alg_tools::nalgebra_support::ToNalgebraRealField;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
26
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
27 use crate::types::*;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
28 use crate::measures::{
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
29 RNDM,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
30 DeltaMeasure,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
31 Radon,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
32 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
33 use crate::measures::merging::SpikeMerging;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
34 use crate::regularisation::RegTerm;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
35 use crate::forward_model::{
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
36 ForwardModel,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
37 AdjointProductBoundedBy
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
38 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
39 use super::{
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
40 FBGenericConfig,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
41 ProxPenalty,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
42 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
43
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
44 /// Radon-norm squared proximal penalty
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
45
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
46 #[derive(Copy,Clone,Serialize,Deserialize)]
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
47 pub struct RadonSquared;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
48
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
49 #[replace_float_literals(F::cast_from(literal))]
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
50 impl<F, GA, BTA, S, Reg, const N : usize>
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
51 ProxPenalty<F, BTFN<F, GA, BTA, N>, Reg, N> for RadonSquared
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
52 where
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
53 F : Float + ToNalgebraRealField,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
54 GA : SupportGenerator<F, N, SupportType = S, Id = usize> + Clone,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
55 BTA : BTSearch<F, N, Data=usize, Agg=Bounds<F>>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
56 S: RealMapping<F, N> + LocalAnalysis<F, Bounds<F>, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
57 Reg : RegTerm<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
58 RNDM<F, N> : SpikeMerging<F>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
59 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
60 type ReturnMapping = BTFN<F, GA, BTA, N>;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
61
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
62 fn insert_and_reweigh<I>(
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
63 &self,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
64 μ : &mut RNDM<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
65 τv : &mut BTFN<F, GA, BTA, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
66 μ_base : &RNDM<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
67 ν_delta: Option<&RNDM<F, N>>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
68 τ : F,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
69 ε : F,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
70 config : &FBGenericConfig<F>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
71 reg : &Reg,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
72 _state : &AlgIteratorIteration<I>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
73 stats : &mut IterInfo<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
74 ) -> (Option<Self::ReturnMapping>, bool)
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
75 where
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
76 I : AlgIterator
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
77 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
78 assert!(ν_delta.is_none(), "Transport not implemented for Radon-squared prox term");
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
79
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
80 let mut y = μ_base.masses_vec();
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
81
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
82 'i_and_w: for i in 0..=1 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
83 // Optimise weights
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
84 if μ.len() > 0 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
85 // Form finite-dimensional subproblem. The subproblem references to the original μ^k
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
86 // from the beginning of the iteration are all contained in the immutable c and g.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
87 // TODO: observe negation of -τv after switch from minus_τv: finite-dimensional
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
88 // problems have not yet been updated to sign change.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
89 let g̃ = DVector::from_iterator(μ.len(),
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
90 μ.iter_locations()
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
91 .map(|ζ| - F::to_nalgebra_mixed(τv.apply(ζ))));
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
92 let mut x = μ.masses_dvector();
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
93 // Ugly hack because DVector::push doesn't push but copies.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
94 let yvec = DVector::from_column_slice(y.as_slice());
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
95 // Solve finite-dimensional subproblem.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
96 stats.inner_iters += reg.solve_findim_l1squared(&yvec, &g̃, τ, &mut x, ε, config);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
97
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
98 // Update masses of μ based on solution of finite-dimensional subproblem.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
99 μ.set_masses_dvector(&x);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
100 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
101
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
102 if i>0 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
103 // Simple debugging test to see if more inserts would be needed. Doesn't seem so.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
104 //let n = μ.dist_matching(μ_base);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
105 //println!("{:?}", reg.find_tolerance_violation_slack(τv, τ, ε, false, config, n));
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
106 break 'i_and_w
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
107 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
108
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
109 // Calculate ‖μ - μ_base‖_ℳ
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
110 let n = μ.dist_matching(μ_base);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
111
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
112 // Find a spike to insert, if needed.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
113 // This only check the overall tolerances, not tolerances on support of μ-μ_base or μ,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
114 // which are supposed to have been guaranteed by the finite-dimensional weight optimisation.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
115 match reg.find_tolerance_violation_slack(τv, τ, ε, false, config, n) {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
116 None => { break 'i_and_w },
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
117 Some((ξ, _v_ξ, _in_bounds)) => {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
118 // Weight is found out by running the finite-dimensional optimisation algorithm
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
119 // above
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
120 *μ += DeltaMeasure { x : ξ, α : 0.0 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
121 //*μ_base += DeltaMeasure { x : ξ, α : 0.0 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
122 y.push(0.0.to_nalgebra_mixed());
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
123 stats.inserted += 1;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
124 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
125 };
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
126 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
127
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
128 (None, true)
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
129 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
130
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
131 fn merge_spikes(
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
132 &self,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
133 μ : &mut RNDM<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
134 τv : &mut BTFN<F, GA, BTA, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
135 μ_base : &RNDM<F, N>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
136 τ : F,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
137 ε : F,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
138 config : &FBGenericConfig<F>,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
139 reg : &Reg,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
140 ) -> usize
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
141 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
142 μ.merge_spikes(config.merging, |μ_candidate| {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
143 // Important: μ_candidate's new points are afterwards,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
144 // and do not conflict with μ_base.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
145 // TODO: could simplify to requiring μ_base instead of μ_radon.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
146 // but may complicate with sliding base's exgtra points that need to be
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
147 // after μ_candidate's extra points.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
148 // TODO: doesn't seem to work, maybe need to merge μ_base as well?
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
149 // Although that doesn't seem to make sense.
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
150 let μ_radon = μ_candidate.sub_matching(μ_base);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
151 reg.verify_merge_candidate_radonsq(τv, μ_candidate, τ, ε, &config, &μ_radon)
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
152 //let n = μ_candidate.dist_matching(μ_base);
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
153 //reg.find_tolerance_violation_slack(τv, τ, ε, false, config, n).is_none()
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
154 })
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
155 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
156 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
157
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
158
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
159 impl<F, A, const N : usize> AdjointProductBoundedBy<RNDM<F, N>, RadonSquared>
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
160 for A
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
161 where
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
162 F : Float,
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
163 A : ForwardModel<RNDM<F, N>, F>
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
164 {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
165 type FloatType = F;
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
166
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
167 fn adjoint_product_bound(&self, _ : &RadonSquared) -> Option<Self::FloatType> {
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
168 self.opnorm_bound(Radon, L2).powi(2).into()
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
169 }
c5d8bd1a7728 Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
170 }

mercurial