Sun, 26 Jul 2026 17:30:51 -0500
Add maximum iteration setting for scaling heuristic
|
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 | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
7 | use super::{InsertionConfig, ProxPenalty, ProxTerm, StepLengthBound, StepLengthBoundPD}; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
8 | use crate::dataterm::QuadraticDataTerm; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
9 | use crate::forward_model::ForwardModel; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
10 | use crate::measures::merging::SpikeMerging; |
|
63
7a8a55fd41c0
Subproblem solver and sliding adjustments/improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
61
diff
changeset
|
11 | use crate::measures::{DiscreteMeasure, Radon}; |
|
7a8a55fd41c0
Subproblem solver and sliding adjustments/improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
61
diff
changeset
|
12 | use crate::regularisation::RadonSquaredRegTerm; |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
13 | use crate::types::*; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
14 | use alg_tools::bounds::MinMaxMapping; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
15 | use alg_tools::error::DynResult; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
16 | use alg_tools::instance::{Instance, Space}; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
17 | use alg_tools::iterate::{AlgIterator, AlgIteratorIteration}; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
18 | use alg_tools::linops::BoundedLinear; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
19 | use alg_tools::nalgebra_support::ToNalgebraRealField; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
20 | use alg_tools::norms::{Norm, L2}; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
21 | use numeric_literals::replace_float_literals; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
22 | use serde::{Deserialize, Serialize}; |
|
37
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 | /// Radon-norm squared proximal penalty |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
25 | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
26 | #[derive(Copy, Clone, Serialize, Deserialize)] |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
27 | pub struct RadonSquared; |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
28 | |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
29 | #[replace_float_literals(F::cast_from(literal))] |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
30 | impl<Domain, F, M, Reg> ProxPenalty<Domain, M, Reg, F> for RadonSquared |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
31 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
32 | Domain: Space + Clone + PartialEq + 'static, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
33 | for<'a> &'a Domain: Instance<Domain>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
34 | F: Float + ToNalgebraRealField, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
35 | M: MinMaxMapping<Domain, F>, |
|
63
7a8a55fd41c0
Subproblem solver and sliding adjustments/improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
61
diff
changeset
|
36 | Reg: RadonSquaredRegTerm<Domain, F>, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
37 | DiscreteMeasure<Domain, F>: SpikeMerging<F>, |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
38 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
39 | type ReturnMapping = M; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
40 | |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
41 | fn prox_type() -> ProxTerm { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
42 | ProxTerm::RadonSquared |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
43 | } |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
44 | |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
45 | fn insert_and_reweigh<I>( |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
46 | &self, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
47 | μ: &mut DiscreteMeasure<Domain, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
48 | τv: &mut M, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
49 | τ: F, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
50 | ε: F, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
51 | config: &InsertionConfig<F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
52 | reg: &Reg, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
53 | _state: &AlgIteratorIteration<I>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
54 | stats: &mut IterInfo<F>, |
|
75
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
55 | ) -> DynResult<bool> |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
56 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
57 | I: AlgIterator, |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
58 | { |
|
72
e9a460a0e638
New simplified sliding a posteriori rule. Enable scaling heuristic from fixed `measure` crate. “Fast” spread Lipschitz factor fixes, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
63
diff
changeset
|
59 | // If no merging heuristic is used, let's be more conservative about spike insertion, |
|
e9a460a0e638
New simplified sliding a posteriori rule. Enable scaling heuristic from fixed `measure` crate. “Fast” spread Lipschitz factor fixes, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
63
diff
changeset
|
60 | // and skip it after first round. If merging is done, being more greedy about spike |
|
e9a460a0e638
New simplified sliding a posteriori rule. Enable scaling heuristic from fixed `measure` crate. “Fast” spread Lipschitz factor fixes, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
63
diff
changeset
|
61 | // insertion also seems to improve performance. |
|
e9a460a0e638
New simplified sliding a posteriori rule. Enable scaling heuristic from fixed `measure` crate. “Fast” spread Lipschitz factor fixes, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
63
diff
changeset
|
62 | let skip_by_rough_check = !config.merging.enabled; |
|
e9a460a0e638
New simplified sliding a posteriori rule. Enable scaling heuristic from fixed `measure` crate. “Fast” spread Lipschitz factor fixes, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
63
diff
changeset
|
63 | let violation = reg.find_tolerance_violation(τv, τ, ε, skip_by_rough_check, config); |
|
63
7a8a55fd41c0
Subproblem solver and sliding adjustments/improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
61
diff
changeset
|
64 | reg.solve_oc_radonsq(μ, τv, τ, ε, violation, config, stats); |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
65 | |
|
75
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
66 | Ok(true) |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
67 | } |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
68 | |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
69 | fn reweigh<I>( |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
70 | &self, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
71 | μ: &mut DiscreteMeasure<Domain, F>, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
72 | τv: &mut M, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
73 | τ: F, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
74 | ε: F, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
75 | config: &InsertionConfig<F>, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
76 | reg: &Reg, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
77 | _state: &AlgIteratorIteration<I>, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
78 | stats: &mut IterInfo<F>, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
79 | ) -> DynResult<()> |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
80 | where |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
81 | I: AlgIterator, |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
82 | { |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
83 | reg.solve_oc_radonsq(μ, τv, τ, ε, None, config, stats); |
|
677a5fd1b014
Added an extra step heuristic
Tuomo Valkonen <tuomov@iki.fi>
parents:
72
diff
changeset
|
84 | Ok(()) |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
85 | } |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
86 | |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
87 | fn merge_spikes( |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
88 | &self, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
89 | μ: &mut DiscreteMeasure<Domain, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
90 | τv: &mut M, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
91 | μ_base: &DiscreteMeasure<Domain, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
92 | τ: F, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
93 | ε: F, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
94 | config: &InsertionConfig<F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
95 | reg: &Reg, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
96 | fitness: Option<impl Fn(&DiscreteMeasure<Domain, F>) -> F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
97 | ) -> usize { |
|
39
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
98 | if config.fitness_merging { |
|
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
99 | if let Some(f) = fitness { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
100 | return μ.merge_spikes_fitness(config.merging, f, |&v| v).1; |
|
39
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
101 | } |
|
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
102 | } |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
103 | μ.merge_spikes(config.merging, |μ_candidate| { |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
104 | // Important: μ_candidate's new points are afterwards, |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
105 | // and do not conflict with μ_base. |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
106 | // TODO: could simplify to requiring μ_base instead of μ_radon. |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
107 | // 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
|
108 | // after μ_candidate's extra points. |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
109 | // 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
|
110 | // Although that doesn't seem to make sense. |
|
63
7a8a55fd41c0
Subproblem solver and sliding adjustments/improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
61
diff
changeset
|
111 | let μ_radon = μ_candidate.sub_matching(μ_base); |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
112 | reg.verify_merge_candidate_radonsq(τv, μ_candidate, τ, ε, &config, &μ_radon) |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
113 | //let n = μ_candidate.dist_matching(μ_base); |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
114 | //reg.find_tolerance_violation_slack(τv, τ, ε, false, config, n).is_none() |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
115 | }) |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
116 | } |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
117 | } |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
118 | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
119 | #[replace_float_literals(F::cast_from(literal))] |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
120 | impl<'a, F, A, Domain> StepLengthBound<F, QuadraticDataTerm<F, Domain, A>> for RadonSquared |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
121 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
122 | F: Float + ToNalgebraRealField, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
123 | Domain: Space + Norm<Radon, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
124 | A: ForwardModel<Domain, F> + BoundedLinear<Domain, Radon, L2, F>, |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
125 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
126 | fn step_length_bound(&self, f: &QuadraticDataTerm<F, Domain, A>) -> DynResult<F> { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
127 | // TODO: direct squared calculation |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
128 | Ok(f.operator().opnorm_bound(Radon, L2)?.powi(2)) |
|
37
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 | } |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
131 | |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
132 | #[replace_float_literals(F::cast_from(literal))] |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
133 | impl<'a, F, A, Domain> StepLengthBoundPD<F, A, DiscreteMeasure<Domain, F>> for RadonSquared |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
134 | where |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
135 | Domain: Space + Clone + PartialEq + 'static, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
136 | F: Float + ToNalgebraRealField, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
137 | A: BoundedLinear<DiscreteMeasure<Domain, F>, Radon, L2, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
138 | { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
139 | fn step_length_bound_pd(&self, opA: &A) -> DynResult<F> { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
140 | opA.opnorm_bound(Radon, L2) |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
141 | } |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
39
diff
changeset
|
142 | } |