# HG changeset patch # User Tuomo Valkonen # Date 1786044797 18000 # Node ID 5ba25d740dfcdcb1fe6ca28daf1282eee1582a46 # Parent d9318317ccaccfa58cab5a8cc2bf46d28f28fb98 attempt to reduce trait bounds diff -r d9318317ccac -r 5ba25d740dfc src/forward_pdps.rs --- a/src/forward_pdps.rs Wed Aug 05 17:50:38 2026 -0500 +++ b/src/forward_pdps.rs Thu Aug 06 14:33:17 2026 -0500 @@ -16,7 +16,10 @@ use alg_tools::error::DynResult; use alg_tools::euclidean::ClosedEuclidean; use alg_tools::iterate::AlgIteratorFactory; -use alg_tools::linops::{BoundedLinear, IdOp, SimplyAdjointable, Space, ZeroOp, AXPY, GEMV}; +use alg_tools::linops::{ + BoundedLinear, IdOp, SimplyAdjointable, Space, StaticEuclideanOriginGenerator, ZeroOp, AXPY, + GEMV, +}; use alg_tools::mapping::{DifferentiableMapping, Instance}; use alg_tools::nalgebra_support::ToNalgebraRealField; use alg_tools::norms::L2; @@ -116,20 +119,19 @@ domain: &mut impl AdmissibleDomain, ) -> DynResult> where + F: Float + ToNalgebraRealField, U: Space + Clone, - F: Float + ToNalgebraRealField, I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, - //Pair: ClosedMul, // Doesn't really need to be closed, if make this signature more complex… S: ClosedMul, + for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, DiscreteMeasure: SpikeMerging, Reg: RegTerm, P: ProxPenalty, - for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, KOpZ: BoundedLinear - + GEMV - + SimplyAdjointable, - KOpZ::SimpleAdjoint: GEMV, + + GEMV + + SimplyAdjointable, + KOpZ::SimpleAdjoint: GEMV, Y: ClosedEuclidean, for<'b> &'b Y: Instance, Z: ClosedEuclidean + AXPY, @@ -347,20 +349,21 @@ fnH: &H, ) -> DynResult> where + F: Float + ToNalgebraRealField, U: Space + Clone, - F: Float + ToNalgebraRealField, + //for<'a> &'a U: Instance, I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, - //Pair: ClosedMul, // Doesn't really need to be closed, if make this signature more complex… S: ClosedMul, + for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, + //Pair: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: RegTerm, P: ProxPenalty, - for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, KOpZ: BoundedLinear - + GEMV - + SimplyAdjointable, - KOpZ::SimpleAdjoint: GEMV, + + GEMV + + SimplyAdjointable, + KOpZ::SimpleAdjoint: GEMV, Y: ClosedEuclidean, for<'b> &'b Y: Instance, Z: ClosedEuclidean + AXPY, @@ -404,8 +407,9 @@ domain: &mut impl AdmissibleDomain, ) -> DynResult> where + F: Float + ToNalgebraRealField, U: Space + Clone, - F: Float + ToNalgebraRealField, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, S: ClosedMul, @@ -413,14 +417,13 @@ Reg: RegTerm, P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, - Z: ClosedEuclidean + AXPY + Clone, + Z: ClosedEuclidean + AXPY + Clone, for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, { - let opKz = ZeroOp::new_dualisable(Loc([]), z.dual_origin()); + let opKz: ZeroOp, _, _, F> = + ZeroOp::new_dualisable(StaticEuclideanOriginGenerator, z.dual_origin()); let fnH = Zero::new(); // Convert config. We don't implement From (that could be done with the o2o crate), as σd0 // needs to be chosen in a general case; for the problem of this fucntion, anything is valid. @@ -456,21 +459,20 @@ fnR: &R, ) -> DynResult> where + F: Float + ToNalgebraRealField, U: Space + Clone, - F: Float + ToNalgebraRealField, + for<'a> &'a U: Instance, I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair>, - S: DifferentiableMapping + ClosedMul, + S: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: RegTerm, P: ProxPenalty, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, - Z: ClosedEuclidean + AXPY + Clone, + Z: ClosedEuclidean + AXPY + Clone, for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, { pointsource_fb_pair_dom( f, diff -r d9318317ccac -r 5ba25d740dfc src/run.rs --- a/src/run.rs Wed Aug 05 17:50:38 2026 -0500 +++ b/src/run.rs Thu Aug 06 14:33:17 2026 -0500 @@ -1412,8 +1412,8 @@ (Option>, Z, Y), String, ), - ) -> DynResult, Z>>, -) -> DynResult, Z>> + ) -> DynResult>, +) -> DynResult> where F: Float + ToNalgebraRealField, U: Space + Clone + Dist, @@ -1421,7 +1421,7 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, //Pair: ClosedMul, DiscreteMeasure: SpikeMerging, @@ -1476,8 +1476,8 @@ (Option>, Z, Y), String, ), - ) -> DynResult, Z>>, -) -> DynResult, Z>> + ) -> DynResult>, +) -> DynResult> where F: Float + ToNalgebraRealField, U: Space + Clone + Dist, @@ -1485,7 +1485,7 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, //Pair: ClosedMul, DiscreteMeasure: SpikeMerging, @@ -1563,8 +1563,8 @@ (Option>, Z), String, ), - ) -> DynResult, Z>>, -) -> DynResult, Z>> + ) -> DynResult>, +) -> DynResult> where F: Float + ToNalgebraRealField, U: Space + Clone + Dist, @@ -1572,7 +1572,7 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: SlidingRegTerm, P: TransportProxPenalty, @@ -1581,8 +1581,6 @@ for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, { run_fb_pair_dom(f, reg, prox_penalty, fnR, init, &mut FullSpace, cont) } @@ -1608,8 +1606,8 @@ (Option>, Z), String, ), - ) -> DynResult, Z>>, -) -> DynResult, Z>> + ) -> DynResult>, +) -> DynResult> where F: Float + ToNalgebraRealField, U: Space + Clone + Dist, @@ -1617,7 +1615,7 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: SlidingRegTerm, P: TransportProxPenalty, @@ -1626,8 +1624,6 @@ for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, { let pt = P::prox_type(); diff -r d9318317ccac -r 5ba25d740dfc src/sliding_pdps.rs --- a/src/sliding_pdps.rs Wed Aug 05 17:50:38 2026 -0500 +++ b/src/sliding_pdps.rs Thu Aug 06 14:33:17 2026 -0500 @@ -108,9 +108,8 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, - //Pair: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: SlidingRegTerm, P: TransportProxPenalty, @@ -420,7 +419,7 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: SlidingRegTerm, P: TransportProxPenalty, @@ -429,15 +428,10 @@ for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, - // Loc<0, F>: StaticEuclidean> - // + Instance> - // + VectorSpace, { let opKz: ZeroOp, _, _, F> = ZeroOp::new_dualisable(StaticEuclideanOriginGenerator, z.dual_origin()); - let fnH = Zero::new(); + let fnH = Zero::, F>::new(); // Convert config. We don't implement From (that could be done with the o2o crate), as σd0 // needs to be chosen in a general case; for the problem of this fucntion, anything is valid. let &SlidingFBConfig { τ0, σp0, insertion, transport, guess } = config; @@ -495,22 +489,11 @@ I: AlgIteratorFactory>, Dat: DifferentiableMapping, Codomain = F, DerivativeDomain = Pair> + BoundedCurvature, - S: DifferentiableMapping + ClosedMul + MinMaxMapping, + S: ClosedMul, for<'a> Pair<&'a P, &'a IdOp>: StepLengthBoundPair, - //Pair: ClosedMul, DiscreteMeasure: SpikeMerging, Reg: SlidingRegTerm, P: TransportProxPenalty, - // KOpM : Linear, Codomain=Y> - // + GEMV> - // + Preadjointable< - // DiscreteMeasure, Y, - // PreadjointCodomain = S, - // > - // + TransportLipschitz - // + 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 + GEMV + SimplyAdjointable, @@ -569,11 +552,6 @@ for<'b> &'b Z: Instance, R: Prox, Plot: Plotter>, - // We should not need to explicitly require this: - for<'b> &'b Loc<0, F>: Instance>, - // Loc<0, F>: StaticEuclidean> - // + Instance> - // + VectorSpace, { let opKz: ZeroOp, _, _, F> = ZeroOp::new_dualisable(StaticEuclideanOriginGenerator, z.dual_origin());