diff -r bea0c3841ced -r b4a47e8e80d1 src/convex.rs --- a/src/convex.rs Wed Sep 03 09:16:03 2025 -0500 +++ b/src/convex.rs Wed Sep 03 09:52:30 2025 -0500 @@ -17,7 +17,7 @@ /// /// TODO: should constrain `Mapping::Codomain` to implement a partial order, /// but this makes everything complicated with little benefit. -pub trait ConvexMapping, F: Num = f64>: Mapping { +pub trait ConvexMapping: Mapping { /// Returns (a lower estimate of) the factor of strong convexity in the norm of `Domain`. fn factor_of_strong_convexity(&self) -> F { F::ZERO @@ -42,7 +42,7 @@ /// but a `Preconjugable` mapping has to be convex. pub trait Preconjugable: ConvexMapping where - Domain: Normed, + Domain: Space, Predual: HasDual, { type Preconjugate<'a>: Mapping @@ -88,7 +88,7 @@ impl ConvexMapping for NormMapping where - Domain: Normed, + Domain: Space, E: NormExponent, F: Float, Self: Mapping, @@ -97,7 +97,8 @@ impl Mapping for NormConstraint where - Domain: Space + Norm, + Domain: Space, + Domain::OwnedSpace: Norm, F: Float, E: NormExponent, { @@ -114,7 +115,7 @@ impl ConvexMapping for NormConstraint where - Domain: Normed, + Domain: Space, E: NormExponent, F: Float, Self: Mapping, @@ -125,7 +126,8 @@ where E: HasDualExponent, F: Float, - Domain: HasDual + Norm + Normed, + Domain: HasDual, + Domain::OwnedSpace: Norm, >::DualSpace: Norm, { type Conjugate<'a> @@ -143,7 +145,8 @@ C: Constant, E: HasDualExponent, F: Float, - Domain: HasDual + Norm + Space, + Domain: HasDual, + Domain::OwnedSpace: Norm, >::DualSpace: Norm, { type Conjugate<'a> @@ -161,7 +164,8 @@ impl Prox for NormConstraint where - Domain: Space + Norm, + Domain: Space, + Domain::OwnedSpace: Norm, E: NormExponent, F: Float, NormProjection: Mapping, @@ -201,8 +205,8 @@ impl Mapping for NormProjection where - Domain: Normed + Projection, - Domain::OwnedSpace: ClosedSpace, + Domain: Space, + Domain::OwnedSpace: ClosedSpace + Projection, F: Float, E: NormExponent, { @@ -232,7 +236,7 @@ } } -impl, F: Float> ConvexMapping for Zero {} +impl ConvexMapping for Zero {} impl, F: Float> Conjugable for Zero { type Conjugate<'a> @@ -249,7 +253,7 @@ impl Preconjugable for Zero where Domain: Normed, - Predual: HasDual, + Predual: HasDual, { type Preconjugate<'a> = ZeroIndicator @@ -284,7 +288,12 @@ } } -impl, F: Float> Mapping for ZeroIndicator { +impl Mapping for ZeroIndicator +where + F: Float, + Domain: Space, + Domain::OwnedSpace: Normed, +{ type Codomain = F; /// Compute the value of `self` at `x`. @@ -293,13 +302,21 @@ } } -impl, F: Float> ConvexMapping for ZeroIndicator { +impl ConvexMapping for ZeroIndicator +where + Domain: Space, + Domain::OwnedSpace: Normed, +{ fn factor_of_strong_convexity(&self) -> F { F::INFINITY } } -impl, F: Float> Conjugable for ZeroIndicator { +impl Conjugable for ZeroIndicator +where + Domain: HasDual, + Domain::Owned: Normed, +{ type Conjugate<'a> = Zero where @@ -313,7 +330,8 @@ impl Preconjugable for ZeroIndicator where - Domain: Normed, + Domain: Space, + Domain::OwnedSpace: Normed, Predual: HasDual, { type Preconjugate<'a>