| 292 type FloatType: Float; |
292 type FloatType: Float; |
| 293 |
293 |
| 294 /// Returns the Lipschitz factor of `self` with respect to the (semi)norm `D`. |
294 /// Returns the Lipschitz factor of `self` with respect to the (semi)norm `D`. |
| 295 fn lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType>; |
295 fn lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType>; |
| 296 } |
296 } |
| |
297 |
| |
298 /// Helper trait for implementing [`Lipschitz`] for mappings that implement [`DifferentiableImpl`]. |
| |
299 pub trait LipschitzDifferentiableImpl<X: Space, M>: DifferentiableImpl<X> { |
| |
300 type FloatType: Float; |
| |
301 |
| |
302 /// Compute the lipschitz factor of the derivative of `f`. |
| |
303 fn diff_lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType>; |
| |
304 } |
| |
305 |
| |
306 impl<'b, M, X, A> Lipschitz<M> for Differential<'b, X, A> |
| |
307 where |
| |
308 X: Space, |
| |
309 A: LipschitzDifferentiableImpl<X, M> + Clone, |
| |
310 { |
| |
311 type FloatType = A::FloatType; |
| |
312 |
| |
313 fn lipschitz_factor(&self, seminorm: M) -> Option<Self::FloatType> { |
| |
314 (*self.g).diff_lipschitz_factor(seminorm) |
| |
315 } |
| |
316 } |