| 111 fn default() -> Self { |
111 fn default() -> Self { |
| 112 FBConfig { τ0: 0.99, σp0: 0.99, insertion: Default::default() } |
112 FBConfig { τ0: 0.99, σp0: 0.99, insertion: Default::default() } |
| 113 } |
113 } |
| 114 } |
114 } |
| 115 |
115 |
| 116 pub(crate) fn prune_with_stats<F: Float, const N: usize>(μ: &mut RNDM<N, F>) -> usize { |
116 pub(crate) fn prune_with_stats<F: Float, const N: usize>( |
| |
117 μ: &mut RNDM<N, F>, |
| |
118 until: usize, |
| |
119 ) -> usize { |
| 117 let n_before_prune = μ.len(); |
120 let n_before_prune = μ.len(); |
| 118 μ.prune(); |
121 μ.prune_until(until); |
| 119 debug_assert!(μ.len() <= n_before_prune); |
122 debug_assert!(μ.len() <= n_before_prune); |
| 120 n_before_prune - μ.len() |
123 n_before_prune - μ.len() |
| 121 } |
124 } |
| 122 |
125 |
| 123 #[replace_float_literals(F::cast_from(literal))] |
126 #[replace_float_literals(F::cast_from(literal))] |
| 216 ε, |
219 ε, |
| 217 ins, |
220 ins, |
| 218 ®, |
221 ®, |
| 219 Some(|μ̃: &RNDM<N, F>| f.apply(μ̃) + reg.apply(μ̃)), |
222 Some(|μ̃: &RNDM<N, F>| f.apply(μ̃) + reg.apply(μ̃)), |
| 220 ); |
223 ); |
| 221 stats.pruned += prune_with_stats(&mut μ); |
224 |
| |
225 // Prune. Do not prune new insertions on first round. |
| |
226 stats.pruned += prune_with_stats(&mut μ, μ_base_len); |
| 222 |
227 |
| 223 if config.random_insertions { |
228 if config.random_insertions { |
| 224 if let Some(x) = domain.random_point() { |
229 if let Some(x) = domain.random_point() { |
| 225 μ += DeltaMeasure { x, α: 0.0 }; |
230 μ += DeltaMeasure { x, α: 0.0 }; |
| 226 stats.inserted += 1; |
231 stats.inserted += 1; |