Tue, 04 Aug 2026 19:41:34 -0500
Do not prune new insertions on first round
| src/fb.rs | file | annotate | diff | comparison | revisions | |
| src/forward_pdps.rs | file | annotate | diff | comparison | revisions | |
| src/pdps.rs | file | annotate | diff | comparison | revisions | |
| src/sliding_fb.rs | file | annotate | diff | comparison | revisions |
--- a/src/fb.rs Tue Aug 04 19:24:55 2026 -0500 +++ b/src/fb.rs Tue Aug 04 19:41:34 2026 -0500 @@ -113,9 +113,12 @@ } } -pub(crate) fn prune_with_stats<F: Float, const N: usize>(μ: &mut RNDM<N, F>) -> usize { +pub(crate) fn prune_with_stats<F: Float, const N: usize>( + μ: &mut RNDM<N, F>, + until: usize, +) -> usize { let n_before_prune = μ.len(); - μ.prune(); + μ.prune_until(until); debug_assert!(μ.len() <= n_before_prune); n_before_prune - μ.len() } @@ -218,7 +221,9 @@ ®, Some(|μ̃: &RNDM<N, F>| f.apply(μ̃) + reg.apply(μ̃)), ); - stats.pruned += prune_with_stats(&mut μ); + + // Prune. Do not prune new insertions on first round. + stats.pruned += prune_with_stats(&mut μ, μ_base_len); if config.random_insertions { if let Some(x) = domain.random_point() { @@ -240,7 +245,8 @@ }; if did_merge.is_none() { - stats.pruned += prune_with_stats(&mut μ); + // Prune. Do not prune new insertions on first round. + stats.pruned += prune_with_stats(&mut μ, μ_base_len); } let iter = state.iteration();
--- a/src/forward_pdps.rs Tue Aug 04 19:24:55 2026 -0500 +++ b/src/forward_pdps.rs Tue Aug 04 19:41:34 2026 -0500 @@ -220,6 +220,7 @@ let Pair(v, z_tmp) = f.differential(Pair(&μ, &z)); let mut τv = v * τ; let μ_base = μ.clone(); + let μ_base_len = μ_base.len(); // Construct μ^{k+1} by solving finite-dimensional subproblems and insert new spikes. prox_penalty.insert_and_reweigh( @@ -251,7 +252,8 @@ ®, Some(|μ̃: &RNDM<N, F>| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), ); - stats.pruned += prune_with_stats(&mut μ); + // Prune. Do not prune new insertions on first round. + stats.pruned += prune_with_stats(&mut μ, μ_base_len); if config.insertion.random_insertions { if let Some(x) = domain.random_point() { @@ -288,7 +290,8 @@ })?; if did_merge.is_none() { - stats.pruned += prune_with_stats(&mut μ); + // Prune. Do not prune new insertions on first round. + stats.pruned += prune_with_stats(&mut μ, μ_base_len); } // Update step length parameters
--- a/src/pdps.rs Tue Aug 04 19:24:55 2026 -0500 +++ b/src/pdps.rs Tue Aug 04 19:41:34 2026 -0500 @@ -215,7 +215,8 @@ Ok(()) })?; stats.inserted += μ.len() - μ_base.len(); - stats.pruned += prune_with_stats(&mut μ); + // Prune. Do not prune new insertions on first round. + stats.pruned += prune_with_stats(&mut μ, μ_base.len()); // Update step length parameters let ω = pdpsconfig.acceleration.accelerate(&mut τ, &mut σ, γ);
--- a/src/sliding_fb.rs Tue Aug 04 19:24:55 2026 -0500 +++ b/src/sliding_fb.rs Tue Aug 04 19:41:34 2026 -0500 @@ -733,9 +733,10 @@ assert!(self.vec.len() <= μ.len()); let old_len = μ.len(); for (ρ, δ) in self.vec.iter_mut().zip(μ.iter_spikes()) { - ρ.retain = δ.α.abs() > F::EPSILON; + ρ.retain = δ.α != F::ZERO; } - μ.prune_by(|δ| δ.α.abs() > F::EPSILON); + // Do not prune new insertions on first round. + μ.prune_until(self.vec.len()); stats.pruned += old_len - μ.len(); self.vec.retain(|ρ| ρ.retain); assert!(self.vec.len() <= μ.len()); @@ -1115,6 +1116,7 @@ ®, Some(|μ̃: &RNDM<N, F>| f.apply(μ̃) + reg.apply(μ̃)), ); + // Prune. Do not prune new insertions on first round. γ.prune_compat(&mut μ, &mut stats); if config.insertion.random_insertions { @@ -1142,6 +1144,7 @@ })?; if did_merge.is_none() { + // Prune. Do not prune new insertions on first round. γ.prune_compat(&mut μ, &mut stats); }