--- a/src/run.rs Tue Aug 04 20:11:10 2026 -0500 +++ b/src/run.rs Thu Aug 06 11:14:15 2026 -0500 @@ -55,7 +55,7 @@ }; use alg_tools::maputil::map3; use alg_tools::nalgebra_support::ToNalgebraRealField; -use alg_tools::norms::{NormExponent, L1, L2}; +use alg_tools::norms::{Dist, NormExponent, L1, L2}; use alg_tools::operator_arithmetic::Weighted; use alg_tools::sets::Cube; use alg_tools::sets::SetOrd; @@ -1086,30 +1086,36 @@ /// $L^2$-squared data term is enabled through the type signatures. /// /// `cont` gives a continuation attempt to find the algorithm matching the description `alg`. -pub fn run_fw<'a, F, A, Reg, I, Plot, const N: usize>( - f: &'a DataTerm<F, RNDM<N, F>, A, Norm222<F>>, +pub fn run_fw<'a, F, U, A, Reg, I, Plot>( + f: &'a DataTerm<F, DiscreteMeasure<U, F>, A, Norm222<F>>, reg: &Reg, (alg, iterator, plotter, μ0, running): ( &AlgorithmConfig<F>, I, Plot, - Option<RNDM<N, F>>, + Option<DiscreteMeasure<U, F>>, String, ), cont: impl FnOnce( - (&AlgorithmConfig<F>, I, Plot, Option<RNDM<N, F>>, String), - ) -> DynResult<RNDM<N, F>>, -) -> DynResult<RNDM<N, F>> + ( + &AlgorithmConfig<F>, + I, + Plot, + Option<DiscreteMeasure<U, F>>, + String, + ), + ) -> DynResult<DiscreteMeasure<U, F>>, +) -> DynResult<DiscreteMeasure<U, F>> where F: Float + ToNalgebraRealField, + U: Space + Clone + PartialEq, I: AlgIteratorFactory<IterInfo<F>>, - A: ForwardModel<RNDM<N, F>, F>, - A::PreadjointCodomain: MinMaxMapping<Loc<N, F>, F>, + A: ForwardModel<DiscreteMeasure<U, F>, F>, + A::PreadjointCodomain: MinMaxMapping<U, F>, for<'b> &'b A::PreadjointCodomain: Instance<A::PreadjointCodomain>, - Cube<N, F>: P2Minimise<Loc<N, F>, F>, - RNDM<N, F>: SpikeMerging<F>, - Reg: RegTermFW<F, A, ValueIteratorFactory<F, AlgIteratorOptions>, N>, - Plot: Plotter<A::PreadjointCodomain, A::PreadjointCodomain, RNDM<N, F>>, + DiscreteMeasure<U, F>: SpikeMerging<F>, + Reg: RegTermFW<F, U, A, ValueIteratorFactory<F, AlgIteratorOptions>>, + Plot: Plotter<A::PreadjointCodomain, A::PreadjointCodomain, DiscreteMeasure<U, F>>, { match alg { &AlgorithmConfig::FW(ref algconfig) => { @@ -1381,10 +1387,10 @@ } } -type MeasureZ<F, Z, const N: usize> = Pair<RNDM<N, F>, Z>; +type MeasureZ<F, Z, U> = Pair<DiscreteMeasure<U, F>, Z>; #[deprecated] -pub fn run_pdps_pair<F, S, Dat, Reg, Z, R, Y, KOpZ, H, P, I, Plot, const N: usize>( +pub fn run_pdps_pair<F, S, Dat, Reg, Z, R, Y, KOpZ, H, P, I, Plot, U>( f: &Dat, reg: &Reg, prox_penalty: &P, @@ -1395,7 +1401,7 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z, Y), + (Option<DiscreteMeasure<U, F>>, Z, Y), String, ), cont: impl FnOnce( @@ -1403,22 +1409,24 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z, Y), + (Option<DiscreteMeasure<U, F>>, Z, Y), String, ), - ) -> DynResult<Pair<RNDM<N, F>, Z>>, -) -> DynResult<Pair<RNDM<N, F>, Z>> + ) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>>, +) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist<L2, F>, + for<'a> &'a U: Instance<U>, I: AlgIteratorFactory<IterInfo<F>>, - Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>> + Dat: DifferentiableMapping<MeasureZ<F, Z, U>, Codomain = F, DerivativeDomain = Pair<S, Z>> + BoundedCurvature<F>, - S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>, + S: DifferentiableMapping<U, Codomain = F> + ClosedMul<F> + MinMaxMapping<U, F>, for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>, //Pair<S, Z>: ClosedMul<F>, - RNDM<N, F>: SpikeMerging<F>, - Reg: SlidingRegTerm<Loc<N, F>, F>, - P: TransportProxPenalty<Loc<N, F>, S, Reg, F>, + DiscreteMeasure<U, F>: SpikeMerging<F>, + Reg: SlidingRegTerm<U, F>, + P: TransportProxPenalty<U, S, Reg, F>, KOpZ: BoundedLinear<Z, L2, L2, F, Codomain = Y> + GEMV<F, Z> + SimplyAdjointable<Z, Y, AdjointCodomain = Z>, @@ -1430,7 +1438,7 @@ R: Prox<Z, Codomain = F>, H: Conjugable<Y, F, Codomain = F>, for<'b> H::Conjugate<'b>: Prox<Y>, - Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>, + Plot: Plotter<P::ReturnMapping, S, DiscreteMeasure<U, F>>, { run_pdps_pair_dom( f, @@ -1445,7 +1453,7 @@ ) } -pub fn run_pdps_pair_dom<F, S, Dat, Reg, Z, R, Y, KOpZ, H, P, I, Plot, const N: usize>( +pub fn run_pdps_pair_dom<F, S, Dat, Reg, Z, R, Y, KOpZ, H, P, I, Plot, U>( f: &Dat, reg: &Reg, prox_penalty: &P, @@ -1456,31 +1464,33 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z, Y), + (Option<DiscreteMeasure<U, F>>, Z, Y), String, ), - domain: &mut impl AdmissibleDomain<Loc<N, F>>, + domain: &mut impl AdmissibleDomain<U>, cont: impl FnOnce( ( &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z, Y), + (Option<DiscreteMeasure<U, F>>, Z, Y), String, ), - ) -> DynResult<Pair<RNDM<N, F>, Z>>, -) -> DynResult<Pair<RNDM<N, F>, Z>> + ) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>>, +) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist<L2, F>, + for<'a> &'a U: Instance<U>, I: AlgIteratorFactory<IterInfo<F>>, - Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>> + Dat: DifferentiableMapping<MeasureZ<F, Z, U>, Codomain = F, DerivativeDomain = Pair<S, Z>> + BoundedCurvature<F>, - S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>, + S: DifferentiableMapping<U, Codomain = F> + ClosedMul<F> + MinMaxMapping<U, F>, for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>, //Pair<S, Z>: ClosedMul<F>, - RNDM<N, F>: SpikeMerging<F>, - Reg: SlidingRegTerm<Loc<N, F>, F>, - P: TransportProxPenalty<Loc<N, F>, S, Reg, F>, + DiscreteMeasure<U, F>: SpikeMerging<F>, + Reg: SlidingRegTerm<U, F>, + P: TransportProxPenalty<U, S, Reg, F>, KOpZ: BoundedLinear<Z, L2, L2, F, Codomain = Y> + GEMV<F, Z> + SimplyAdjointable<Z, Y, AdjointCodomain = Z>, @@ -1492,7 +1502,7 @@ R: Prox<Z, Codomain = F>, H: Conjugable<Y, F, Codomain = F>, for<'b> H::Conjugate<'b>: Prox<Y>, - Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>, + Plot: Plotter<P::ReturnMapping, S, DiscreteMeasure<U, F>>, { let pt = P::prox_type(); @@ -1533,7 +1543,7 @@ } } -pub fn run_fb_pair<F, S, Dat, Reg, Z, R, P, I, Plot, const N: usize>( +pub fn run_fb_pair<F, S, Dat, Reg, Z, R, P, I, Plot, U>( f: &Dat, reg: &Reg, prox_penalty: &P, @@ -1542,7 +1552,7 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z), + (Option<DiscreteMeasure<U, F>>, Z), String, ), cont: impl FnOnce( @@ -1550,32 +1560,34 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z), + (Option<DiscreteMeasure<U, F>>, Z), String, ), - ) -> DynResult<Pair<RNDM<N, F>, Z>>, -) -> DynResult<Pair<RNDM<N, F>, Z>> + ) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>>, +) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist<L2, F>, + for<'a> &'a U: Instance<U>, I: AlgIteratorFactory<IterInfo<F>>, - Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>> + Dat: DifferentiableMapping<MeasureZ<F, Z, U>, Codomain = F, DerivativeDomain = Pair<S, Z>> + BoundedCurvature<F>, - S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>, - RNDM<N, F>: SpikeMerging<F>, - Reg: SlidingRegTerm<Loc<N, F>, F>, - P: TransportProxPenalty<Loc<N, F>, S, Reg, F>, + S: DifferentiableMapping<U, Codomain = F> + ClosedMul<F> + MinMaxMapping<U, F>, + DiscreteMeasure<U, F>: SpikeMerging<F>, + Reg: SlidingRegTerm<U, F>, + P: TransportProxPenalty<U, S, Reg, F>, for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>, Z: ClosedEuclidean<F> + AXPY + Clone, for<'b> &'b Z: Instance<Z>, R: Prox<Z, Codomain = F>, - Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>, + Plot: Plotter<P::ReturnMapping, S, DiscreteMeasure<U, F>>, // We should not need to explicitly require this: for<'b> &'b Loc<0, F>: Instance<Loc<0, F>>, { run_fb_pair_dom(f, reg, prox_penalty, fnR, init, &mut FullSpace, cont) } -pub fn run_fb_pair_dom<F, S, Dat, Reg, Z, R, P, I, Plot, const N: usize>( +pub fn run_fb_pair_dom<F, S, Dat, Reg, Z, R, P, I, Plot, U>( f: &Dat, reg: &Reg, prox_penalty: &P, @@ -1584,34 +1596,36 @@ &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z), + (Option<DiscreteMeasure<U, F>>, Z), String, ), - domain: &mut impl AdmissibleDomain<Loc<N, F>>, + domain: &mut impl AdmissibleDomain<U>, cont: impl FnOnce( ( &AlgorithmConfig<F>, I, Plot, - (Option<RNDM<N, F>>, Z), + (Option<DiscreteMeasure<U, F>>, Z), String, ), - ) -> DynResult<Pair<RNDM<N, F>, Z>>, -) -> DynResult<Pair<RNDM<N, F>, Z>> + ) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>>, +) -> DynResult<Pair<DiscreteMeasure<U, F>, Z>> where F: Float + ToNalgebraRealField, + U: Space + Clone + Dist<L2, F>, + for<'a> &'a U: Instance<U>, I: AlgIteratorFactory<IterInfo<F>>, - Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>> + Dat: DifferentiableMapping<MeasureZ<F, Z, U>, Codomain = F, DerivativeDomain = Pair<S, Z>> + BoundedCurvature<F>, - S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>, - RNDM<N, F>: SpikeMerging<F>, - Reg: SlidingRegTerm<Loc<N, F>, F>, - P: TransportProxPenalty<Loc<N, F>, S, Reg, F>, + S: DifferentiableMapping<U, Codomain = F> + ClosedMul<F> + MinMaxMapping<U, F>, + DiscreteMeasure<U, F>: SpikeMerging<F>, + Reg: SlidingRegTerm<U, F>, + P: TransportProxPenalty<U, S, Reg, F>, for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>, Z: ClosedEuclidean<F> + AXPY + Clone, for<'b> &'b Z: Instance<Z>, R: Prox<Z, Codomain = F>, - Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>, + Plot: Plotter<P::ReturnMapping, S, DiscreteMeasure<U, F>>, // We should not need to explicitly require this: for<'b> &'b Loc<0, F>: Instance<Loc<0, F>>, {