diff -r 759634edb536 -r 8f1e57821d76 src/forward_pdps.rs --- a/src/forward_pdps.rs Tue Aug 04 20:11:10 2026 -0500 +++ b/src/forward_pdps.rs Thu Aug 06 11:14:15 2026 -0500 @@ -6,7 +6,7 @@ use crate::domain::{AdmissibleDomain, FullSpace}; use crate::fb::*; use crate::measures::merging::SpikeMerging; -use crate::measures::{DiscreteMeasure, RNDM}; +use crate::measures::DiscreteMeasure; use crate::plot::Plotter; use crate::prox_penalty::{ProxPenalty, StepLengthBoundPair}; use crate::regularisation::RegTerm; @@ -16,8 +16,8 @@ use alg_tools::error::DynResult; use alg_tools::euclidean::ClosedEuclidean; use alg_tools::iterate::AlgIteratorFactory; -use alg_tools::linops::{BoundedLinear, IdOp, SimplyAdjointable, ZeroOp, AXPY, GEMV}; -use alg_tools::mapping::{DifferentiableMapping, DifferentiableRealMapping, Instance}; +use alg_tools::linops::{BoundedLinear, IdOp, SimplyAdjointable, Space, ZeroOp, AXPY, GEMV}; +use alg_tools::mapping::{DifferentiableMapping, Instance}; use alg_tools::nalgebra_support::ToNalgebraRealField; use alg_tools::norms::L2; use anyhow::ensure; @@ -48,7 +48,7 @@ } } -type MeasureZ = Pair, Z>; +type MeasureZ = Pair, Z>; /// Iteratively solve the pointsource localisation with an additional variable /// using primal-dual proximal splitting with a forward step. @@ -89,6 +89,7 @@ #[replace_float_literals(F::cast_from(literal))] pub fn pointsource_forward_pdps_pair_dom< F, + U, I, S, Dat, @@ -100,7 +101,6 @@ /*KOpM, */ KOpZ, H, Plot, - const N: usize, >( f: &Dat, reg: &Reg, @@ -108,22 +108,23 @@ config: &ForwardPDPSConfig, iterator: I, mut plotter: Plot, - (μ0, mut z, mut y): (Option>, Z, Y), + (μ0, mut z, mut y): (Option>, Z, Y), //opKμ : KOpM, opKz: &KOpZ, fnR: &R, fnH: &H, - domain: &mut impl AdmissibleDomain>, -) -> DynResult> + domain: &mut impl AdmissibleDomain, +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, //Pair: ClosedMul, // Doesn't really need to be closed, if make this signature more complex… - S: DifferentiableRealMapping + ClosedMul, - RNDM: SpikeMerging, - Reg: RegTerm, F>, - P: ProxPenalty, S, Reg, F>, + S: ClosedMul, + DiscreteMeasure: SpikeMerging, + Reg: RegTerm, + P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, KOpZ: BoundedLinear + GEMV @@ -136,7 +137,7 @@ R: Prox, H: Conjugable, for<'b> H::Conjugate<'b>: Prox, - Plot: Plotter>, + Plot: Plotter>, { // Check parameters ensure!( @@ -188,7 +189,7 @@ let starH = fnH.conjugate(); // Statistics - let full_stats = |μ: &RNDM, z: &Z, ε, stats| IterInfo { + let full_stats = |μ: &DiscreteMeasure, z: &Z, ε, stats| IterInfo { value: f.apply(Pair(μ, z)) + fnR.apply(z) + reg.apply(μ) @@ -250,7 +251,7 @@ ε, ins, ®, - Some(|μ̃: &RNDM| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), + Some(|μ̃: &DiscreteMeasure| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), ); // Prune. Do not prune new insertions on first round. stats.pruned += prune_with_stats(&mut μ, μ_base_len); @@ -310,7 +311,7 @@ ε = tolerance.update(ε, iter); } - let fit = |μ̃: &RNDM| { + let fit = |μ̃: &DiscreteMeasure| { f.apply(Pair(μ̃, &z)) /*+ fnR.apply(z) + reg.apply(μ)*/ + fnH.apply(/* opKμ.apply(&μ̃) + */ opKz.apply(&z)) + reg.apply(μ̃) @@ -324,6 +325,7 @@ #[deprecated] pub fn pointsource_forward_pdps_pair< F, + U, I, S, Dat, @@ -335,7 +337,6 @@ /*KOpM, */ KOpZ, H, Plot, - const N: usize, >( f: &Dat, reg: &Reg, @@ -343,21 +344,22 @@ config: &ForwardPDPSConfig, iterator: I, plotter: Plot, - init: (Option>, Z, Y), + init: (Option>, Z, Y), //opKμ : KOpM, opKz: &KOpZ, fnR: &R, fnH: &H, -) -> DynResult> +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, //Pair: ClosedMul, // Doesn't really need to be closed, if make this signature more complex… - S: DifferentiableRealMapping + ClosedMul, - RNDM: SpikeMerging, - Reg: RegTerm, F>, - P: ProxPenalty, S, Reg, F>, + S: ClosedMul, + DiscreteMeasure: SpikeMerging, + Reg: RegTerm, + P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, KOpZ: BoundedLinear + GEMV @@ -370,7 +372,7 @@ R: Prox, H: Conjugable, for<'b> H::Conjugate<'b>: Prox, - Plot: Plotter>, + Plot: Plotter>, { pointsource_forward_pdps_pair_dom( f, @@ -393,31 +395,32 @@ /// The implementation uses [`pointsource_forward_pdps_pair`] with appropriate dummy /// variables, operators, and functions. #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_fb_pair_dom( +pub fn pointsource_fb_pair_dom( f: &Dat, reg: &Reg, prox_penalty: &P, config: &FBConfig, iterator: I, plotter: Plot, - (μ0, z): (Option>, Z), + (μ0, z): (Option>, Z), //opKμ : KOpM, fnR: &R, - domain: &mut impl AdmissibleDomain>, -) -> DynResult> + domain: &mut impl AdmissibleDomain, +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, - S: DifferentiableRealMapping + ClosedMul, - RNDM: SpikeMerging, - Reg: RegTerm, F>, - P: ProxPenalty, S, Reg, F>, + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, + S: ClosedMul, + DiscreteMeasure: SpikeMerging, + Reg: RegTerm, + P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, Z: ClosedEuclidean + AXPY + Clone, for<'b> &'b Z: Instance, R: Prox, - Plot: Plotter>, + Plot: Plotter>, // We should not need to explicitly require this: for<'b> &'b Loc<0, F>: Instance>, { @@ -445,30 +448,31 @@ #[deprecated] #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_fb_pair( +pub fn pointsource_fb_pair( f: &Dat, reg: &Reg, prox_penalty: &P, config: &FBConfig, iterator: I, plotter: Plot, - init: (Option>, Z), + init: (Option>, Z), //opKμ : KOpM, fnR: &R, -) -> DynResult> +) -> DynResult> where + U: Space + Clone, F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, - S: DifferentiableRealMapping + ClosedMul, - RNDM: SpikeMerging, - Reg: RegTerm, F>, - P: ProxPenalty, S, Reg, F>, + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, + S: DifferentiableMapping + ClosedMul, + DiscreteMeasure: SpikeMerging, + Reg: RegTerm, + P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, Z: ClosedEuclidean + AXPY + Clone, for<'b> &'b Z: Instance, R: Prox, - Plot: Plotter>, + Plot: Plotter>, // We should not need to explicitly require this: for<'b> &'b Loc<0, F>: Instance>, {