diff -r 759634edb536 -r 8f1e57821d76 src/fb.rs --- a/src/fb.rs Tue Aug 04 20:11:10 2026 -0500 +++ b/src/fb.rs Thu Aug 06 11:14:15 2026 -0500 @@ -79,7 +79,7 @@ use crate::domain::{AdmissibleDomain, FullSpace}; use crate::measures::merging::SpikeMerging; -use crate::measures::{DiscreteMeasure, RNDM}; +use crate::measures::DiscreteMeasure; use crate::plot::Plotter; pub use crate::prox_penalty::{InsertionConfig, ProxPenalty, StepLengthBound}; use crate::regularisation::RegTerm; @@ -87,6 +87,7 @@ use alg_tools::error::DynResult; use alg_tools::instance::Instance; use alg_tools::iterate::AlgIteratorFactory; +use alg_tools::linops::Space; use alg_tools::mapping::DifferentiableMapping; use alg_tools::nalgebra_support::ToNalgebraRealField; use colored::Colorize; @@ -113,8 +114,8 @@ } } -pub(crate) fn prune_with_stats( - μ: &mut RNDM, +pub(crate) fn prune_with_stats( + μ: &mut DiscreteMeasure, until: usize, ) -> usize { let n_before_prune = μ.len(); @@ -124,14 +125,16 @@ } #[replace_float_literals(F::cast_from(literal))] -pub(crate) fn postprocess) -> F, const N: usize>( - mut μ: RNDM, +pub(crate) fn postprocess( + mut μ: DiscreteMeasure, config: &InsertionConfig, f: Dat, -) -> DynResult> +) -> DynResult> where - RNDM: SpikeMerging, - for<'a> &'a RNDM: Instance>, + Dat: Fn(&DiscreteMeasure) -> F, + U: Space + Clone, + DiscreteMeasure: SpikeMerging, + for<'a> &'a DiscreteMeasure: Instance>, { //μ.merge_spikes_fitness(config.final_merging_method(), |μ̃| f.apply(μ̃), |&v| v); μ.merge_spikes_fitness(config.final_merging_method(), f, |&v| v); @@ -151,25 +154,26 @@ /// /// Returns the final iterate. #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_fb_dom( +pub fn pointsource_fb_dom( f: &Dat, reg: &Reg, prox_penalty: &P, fbconfig: &FBConfig, iterator: I, mut plotter: Plot, - μ0: Option>, - domain: &mut impl AdmissibleDomain>, -) -> DynResult> + μ0: Option>, + domain: &mut impl AdmissibleDomain, +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - RNDM: SpikeMerging, - Dat: DifferentiableMapping, Codomain = F>, + DiscreteMeasure: SpikeMerging, + Dat: DifferentiableMapping, Codomain = F>, Dat::DerivativeDomain: ClosedMul, - Reg: RegTerm, F>, - P: ProxPenalty, Dat::DerivativeDomain, Reg, F> + StepLengthBound, - Plot: Plotter>, + Reg: RegTerm, + P: ProxPenalty + StepLengthBound, + Plot: Plotter>, { // Set up parameters let config = &fbconfig.insertion; @@ -183,7 +187,7 @@ let mut μ = μ0.unwrap_or_else(|| DiscreteMeasure::new()); // Statistics - let full_stats = |μ: &RNDM, ε, stats| IterInfo { + let full_stats = |μ: &DiscreteMeasure, ε, stats| IterInfo { value: f.apply(μ) + reg.apply(μ), n_spikes: μ.len(), ε, @@ -219,7 +223,7 @@ ε, ins, ®, - Some(|μ̃: &RNDM| f.apply(μ̃) + reg.apply(μ̃)), + Some(|μ̃: &DiscreteMeasure| f.apply(μ̃) + reg.apply(μ̃)), ); // Prune. Do not prune new insertions on first round. @@ -267,24 +271,25 @@ } #[deprecated] -pub fn pointsource_fb_reg( +pub fn pointsource_fb_reg( f: &Dat, reg: &Reg, prox_penalty: &P, fbconfig: &FBConfig, iterator: I, plotter: Plot, - μ0: Option>, -) -> DynResult> + μ0: Option>, +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - RNDM: SpikeMerging, - Dat: DifferentiableMapping, Codomain = F>, + DiscreteMeasure: SpikeMerging, + Dat: DifferentiableMapping, Codomain = F>, Dat::DerivativeDomain: ClosedMul, - Reg: RegTerm, F>, - P: ProxPenalty, Dat::DerivativeDomain, Reg, F> + StepLengthBound, - Plot: Plotter>, + Reg: RegTerm, + P: ProxPenalty + StepLengthBound, + Plot: Plotter>, { pointsource_fb_dom( f, @@ -310,24 +315,25 @@ /// /// Returns the final iterate. #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_fista_reg( +pub fn pointsource_fista_reg( f: &Dat, reg: &Reg, prox_penalty: &P, fbconfig: &FBConfig, iterator: I, mut plotter: Plot, - μ0: Option>, -) -> DynResult> + μ0: Option>, +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - RNDM: SpikeMerging, - Dat: DifferentiableMapping, Codomain = F>, + DiscreteMeasure: SpikeMerging, + Dat: DifferentiableMapping, Codomain = F>, Dat::DerivativeDomain: ClosedMul, - Reg: RegTerm, F>, - P: ProxPenalty, Dat::DerivativeDomain, Reg, F> + StepLengthBound, - Plot: Plotter>, + Reg: RegTerm, + P: ProxPenalty + StepLengthBound, + Plot: Plotter>, { // Set up parameters let config = &fbconfig.insertion; @@ -344,7 +350,7 @@ let mut warned_merging = false; // Statistics - let full_stats = |ν: &RNDM, ε, stats| IterInfo { + let full_stats = |ν: &DiscreteMeasure, ε, stats| IterInfo { value: f.apply(ν) + reg.apply(ν), n_spikes: ν.len(), ε,