Thu, 23 Jan 2025 23:35:28 +0100
Generic proximal penalty support
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 | Proximal penalty abstraction |
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 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
5 | use numeric_literals::replace_float_literals; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
6 | use alg_tools::types::*; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
7 | use serde::{Serialize, Deserialize}; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
8 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
9 | use alg_tools::mapping::RealMapping; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
10 | use alg_tools::nalgebra_support::ToNalgebraRealField; |
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 crate::measures::{ |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
16 | RNDM, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
17 | }; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
18 | use crate::types::{ |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
19 | RefinementSettings, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
20 | IterInfo, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
21 | }; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
22 | use crate::subproblem::{ |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
23 | InnerSettings, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
24 | InnerMethod, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
25 | }; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
26 | use crate::tolerance::Tolerance; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
27 | use crate::measures::merging::SpikeMergingMethod; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
28 | use crate::regularisation::RegTerm; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
29 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
30 | pub mod wave; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
31 | pub mod radon_squared; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
32 | pub use radon_squared::RadonSquared; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
33 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
34 | /// Settings for the solution of the stepwise optimality condition. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
35 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
36 | #[serde(default)] |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
37 | pub struct FBGenericConfig<F : Float> { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
38 | /// Tolerance for point insertion. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
39 | pub tolerance : Tolerance<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
40 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
41 | /// Stop looking for predual maximum (where to isert a new point) below |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
42 | /// `tolerance` multiplied by this factor. |
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 | /// Not used by [`super::radon_fb`]. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
45 | pub insertion_cutoff_factor : F, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
46 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
47 | /// Settings for branch and bound refinement when looking for predual maxima |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
48 | pub refinement : RefinementSettings<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
49 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
50 | /// Maximum insertions within each outer iteration |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
51 | /// |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
52 | /// Not used by [`super::radon_fb`]. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
53 | pub max_insertions : usize, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
54 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
55 | /// Pair `(n, m)` for maximum insertions `m` on first `n` iterations. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
56 | /// |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
57 | /// Not used by [`super::radon_fb`]. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
58 | pub bootstrap_insertions : Option<(usize, usize)>, |
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 | /// Inner method settings |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
61 | pub inner : InnerSettings<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
62 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
63 | /// Spike merging method |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
64 | pub merging : SpikeMergingMethod<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
65 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
66 | /// Tolerance multiplier for merges |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
67 | pub merge_tolerance_mult : F, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
68 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
69 | /// Spike merging method after the last step |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
70 | pub final_merging : SpikeMergingMethod<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
71 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
72 | /// Iterations between merging heuristic tries |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
73 | pub merge_every : usize, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
74 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
75 | // /// Save $μ$ for postprocessing optimisation |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
76 | // pub postprocessing : bool |
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 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
79 | #[replace_float_literals(F::cast_from(literal))] |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
80 | impl<F : Float> Default for FBGenericConfig<F> { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
81 | fn default() -> Self { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
82 | FBGenericConfig { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
83 | tolerance : Default::default(), |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
84 | insertion_cutoff_factor : 1.0, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
85 | refinement : Default::default(), |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
86 | max_insertions : 100, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
87 | //bootstrap_insertions : None, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
88 | bootstrap_insertions : Some((10, 1)), |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
89 | inner : InnerSettings { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
90 | method : InnerMethod::Default, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
91 | .. Default::default() |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
92 | }, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
93 | merging : SpikeMergingMethod::None, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
94 | //merging : Default::default(), |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
95 | final_merging : Default::default(), |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
96 | merge_every : 10, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
97 | merge_tolerance_mult : 2.0, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
98 | // postprocessing : false, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
99 | } |
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 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
103 | impl<F : Float> FBGenericConfig<F> { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
104 | /// Check if merging should be attempted this iteration |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
105 | pub fn merge_now<I : AlgIterator>(&self, state : &AlgIteratorIteration<I>) -> bool { |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
106 | state.iteration() % self.merge_every == 0 |
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 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
110 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
111 | /// Trait for proximal penalties |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
112 | pub trait ProxPenalty<F, PreadjointCodomain, Reg, const N : usize> |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
113 | where |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
114 | F : Float + ToNalgebraRealField, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
115 | Reg : RegTerm<F, N>, |
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 | type ReturnMapping : RealMapping<F, N>; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
118 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
119 | /// Insert new spikes into `μ` to approximately satisfy optimality conditions |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
120 | /// with the forward step term fixed to `τv`. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
121 | /// |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
122 | /// May return `τv + w` for `w` a subdifferential of the regularisation term `reg`, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
123 | /// as well as an indication of whether the tolerance bounds `ε` are satisfied. |
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 | /// `μ_base + ν_delta` is the base point, where `μ` and `μ_base` are assumed to have the same |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
126 | /// spike locations, while `ν_delta` may have different locations. |
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 | /// `τv` is mutable to allow [`alg_tools::bisection_tree::btfn::BTFN`] refinement. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
129 | /// Actual values of `τv` are not supposed to be mutated. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
130 | fn insert_and_reweigh<I>( |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
131 | &self, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
132 | μ : &mut RNDM<F, N>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
133 | τv : &mut PreadjointCodomain, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
134 | μ_base : &RNDM<F, N>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
135 | ν_delta: Option<&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 | state : &AlgIteratorIteration<I>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
141 | stats : &mut IterInfo<F, N>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
142 | ) -> (Option<Self::ReturnMapping>, bool) |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
143 | where |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
144 | I : AlgIterator; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
145 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
146 | |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
147 | /// Merge spikes, if possible. |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
148 | fn merge_spikes( |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
149 | &self, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
150 | μ : &mut RNDM<F, N>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
151 | τv : &mut PreadjointCodomain, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
152 | μ_base : &RNDM<F, N>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
153 | τ : F, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
154 | ε : F, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
155 | config : &FBGenericConfig<F>, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
156 | reg : &Reg, |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
157 | ) -> usize; |
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
158 | } |