diff -r 759634edb536 -r 8f1e57821d76 src/sliding_pdps.rs --- a/src/sliding_pdps.rs Tue Aug 04 20:11:10 2026 -0500 +++ b/src/sliding_pdps.rs Thu Aug 06 11:14:15 2026 -0500 @@ -7,7 +7,7 @@ use crate::fb::*; use crate::forward_model::{BoundedCurvature, BoundedCurvatureGuess}; use crate::measures::merging::SpikeMerging; -use crate::measures::{DiscreteMeasure, RNDM}; +use crate::measures::DiscreteMeasure; use crate::plot::Plotter; use crate::prox_penalty::StepLengthBoundPair; use crate::regularisation::SlidingRegTerm; @@ -18,13 +18,14 @@ use alg_tools::direct_product::Pair; use alg_tools::error::DynResult; use alg_tools::euclidean::ClosedEuclidean; +use alg_tools::instance::{Instance, Space}; use alg_tools::iterate::AlgIteratorFactory; use alg_tools::linops::{ BoundedLinear, IdOp, SimplyAdjointable, StaticEuclideanOriginGenerator, ZeroOp, AXPY, GEMV, }; -use alg_tools::mapping::{DifferentiableMapping, DifferentiableRealMapping, Instance}; +use alg_tools::mapping::DifferentiableMapping; use alg_tools::nalgebra_support::ToNalgebraRealField; -use alg_tools::norms::L2; +use alg_tools::norms::{Dist, L2}; use anyhow::ensure; use measures::DeltaMeasure; use numeric_literals::replace_float_literals; @@ -64,7 +65,7 @@ } } -type MeasureZ = Pair, Z>; +type MeasureZ = Pair, Z>; /// Iteratively solve the pointsource localisation with an additional variable /// using sliding primal-dual proximal splitting @@ -85,7 +86,7 @@ Plot, /*KOpM, */ KOpZ, H, - const N: usize, + U, >( f: &Dat, reg: &Reg, @@ -93,32 +94,34 @@ config: &SlidingPDPSConfig, 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 F: Float + ToNalgebraRealField, + U: Space + Clone + Dist, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableRealMapping + ClosedMul + MinMaxMapping, F>, + S: DifferentiableMapping + ClosedMul + MinMaxMapping, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, //Pair: ClosedMul, - RNDM: SpikeMerging, - Reg: SlidingRegTerm, F>, - P: TransportProxPenalty, S, Reg, F>, - // KOpM : Linear, Codomain=Y> - // + GEMV> + DiscreteMeasure: SpikeMerging, + Reg: SlidingRegTerm, + P: TransportProxPenalty, + // KOpM : Linear, Codomain=Y> + // + GEMV> // + Preadjointable< - // RNDM, Y, + // DiscreteMeasure, Y, // PreadjointCodomain = S, // > // + TransportLipschitz - // + AdjointProductBoundedBy, 𝒟, FloatType=F>, + // + AdjointProductBoundedBy, 𝒟, FloatType=F>, // for<'b> KOpM::Preadjoint<'b> : GEMV, // Since Z is Hilbert, we may just as well use adjoints for K_z. KOpZ: BoundedLinear @@ -132,7 +135,7 @@ R: Prox, H: Conjugable, for<'b> H::Conjugate<'b>: Prox, - Plot: Plotter>, + Plot: Plotter>, { // Check parameters /*ensure!( @@ -206,7 +209,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(μ) @@ -317,7 +320,7 @@ ε, ins, ®, - Some(|μ̃: &RNDM| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), + Some(|μ̃: &DiscreteMeasure| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), ); γ.prune_compat(&mut μ, &mut stats); @@ -375,7 +378,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(μ̃) @@ -392,32 +395,34 @@ /// The implementation uses [`pointsource_sliding_pdps_pair`] with appropriate dummy /// variables, operators, and functions. #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_sliding_fb_pair_dom( +pub fn pointsource_sliding_fb_pair_dom( f: &Dat, reg: &Reg, prox_penalty: &P, config: &SlidingFBConfig, 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 F: Float + ToNalgebraRealField, + U: Space + Clone + Dist, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableRealMapping + ClosedMul + MinMaxMapping, F>, - RNDM: SpikeMerging, - Reg: SlidingRegTerm, F>, - P: TransportProxPenalty, S, Reg, F>, + S: DifferentiableMapping + ClosedMul + MinMaxMapping, + DiscreteMeasure: SpikeMerging, + Reg: SlidingRegTerm, + P: TransportProxPenalty, 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>, // Loc<0, F>: StaticEuclidean> @@ -463,7 +468,7 @@ Plot, /*KOpM, */ KOpZ, H, - const N: usize, + U, >( f: &Dat, reg: &Reg, @@ -471,31 +476,33 @@ config: &SlidingPDPSConfig, iterator: I, plotter: Plot, - init: (Option>, Z, Y), + init: (Option>, Z, Y), //opKμ : KOpM, opKz: &KOpZ, fnR: &R, fnH: &H, -) -> DynResult> +) -> DynResult> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableRealMapping + ClosedMul + MinMaxMapping, F>, + S: DifferentiableMapping + ClosedMul + MinMaxMapping, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, //Pair: ClosedMul, - RNDM: SpikeMerging, - Reg: SlidingRegTerm, F>, - P: TransportProxPenalty, S, Reg, F>, - // KOpM : Linear, Codomain=Y> - // + GEMV> + DiscreteMeasure: SpikeMerging, + Reg: SlidingRegTerm, + P: TransportProxPenalty, + // KOpM : Linear, Codomain=Y> + // + GEMV> // + Preadjointable< - // RNDM, Y, + // DiscreteMeasure, Y, // PreadjointCodomain = S, // > // + TransportLipschitz - // + AdjointProductBoundedBy, 𝒟, FloatType=F>, + // + AdjointProductBoundedBy, 𝒟, FloatType=F>, // for<'b> KOpM::Preadjoint<'b> : GEMV, // Since Z is Hilbert, we may just as well use adjoints for K_z. KOpZ: BoundedLinear @@ -509,7 +516,7 @@ R: Prox, H: Conjugable, for<'b> H::Conjugate<'b>: Prox, - Plot: Plotter>, + Plot: Plotter>, { pointsource_sliding_pdps_pair_dom( f, @@ -529,31 +536,33 @@ #[deprecated] /// Version of [`pointsource_sliding_fb_pair_dom`] without domain specification #[replace_float_literals(F::cast_from(literal))] -pub fn pointsource_sliding_fb_pair( +pub fn pointsource_sliding_fb_pair( f: &Dat, reg: &Reg, prox_penalty: &P, config: &SlidingFBConfig, iterator: I, plotter: Plot, - (μ0, z): (Option>, Z), + (μ0, z): (Option>, Z), //opKμ : KOpM, fnR: &R, -) -> DynResult> +) -> DynResult> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, - Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableRealMapping + ClosedMul + MinMaxMapping, F>, - RNDM: SpikeMerging, - Reg: SlidingRegTerm, F>, - P: TransportProxPenalty, S, Reg, F>, + S: DifferentiableMapping + ClosedMul + MinMaxMapping, + DiscreteMeasure: SpikeMerging, + Reg: SlidingRegTerm, + P: TransportProxPenalty, 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>, // Loc<0, F>: StaticEuclidean>