diff -r 997961aa6eee -r aead46a19767 src/mapping.rs --- 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; } + +/// Helper trait for implementing [`Lipschitz`] for mappings that implement [`DifferentiableImpl`]. +pub trait LipschitzDifferentiableImpl: DifferentiableImpl { + type FloatType: Float; + + /// Compute the lipschitz factor of the derivative of `f`. + fn diff_lipschitz_factor(&self, seminorm: M) -> Option; +} + +impl<'b, M, X, A> Lipschitz for Differential<'b, X, A> +where + X: Space, + A: LipschitzDifferentiableImpl + Clone, +{ + type FloatType = A::FloatType; + + fn lipschitz_factor(&self, seminorm: M) -> Option { + (*self.g).diff_lipschitz_factor(seminorm) + } +}