--- a/src/mapping.rs Mon Apr 28 16:52:15 2025 -0500 +++ b/src/mapping.rs Mon Apr 28 21:32:37 2025 -0500 @@ -294,3 +294,23 @@ /// Returns the Lipschitz factor of `self` with respect to the (semi)norm `D`. fn lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType>; } + +/// Helper trait for implementing [`Lipschitz`] for mappings that implement [`DifferentiableImpl`]. +pub trait LipschitzDifferentiableImpl<X: Space, M>: DifferentiableImpl<X> { + type FloatType: Float; + + /// Compute the lipschitz factor of the derivative of `f`. + fn diff_lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType>; +} + +impl<'b, M, X, A> Lipschitz<M> for Differential<'b, X, A> +where + X: Space, + A: LipschitzDifferentiableImpl<X, M> + Clone, +{ + type FloatType = A::FloatType; + + fn lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType> { + (*self.g).diff_lipschitz_factor(seminorm) + } +}