503 |
503 |
504 /// Helper trait for performing approximate minimisation using P2 elements. |
504 /// Helper trait for performing approximate minimisation using P2 elements. |
505 /// |
505 /// |
506 /// `U` is the domain, generally [`Loc`]`<F, N>`, and `F` the type of floating point numbers. |
506 /// `U` is the domain, generally [`Loc`]`<F, N>`, and `F` the type of floating point numbers. |
507 /// `Self` is generally a set of `U`, for example, [`Cube`]`<F, N>`. |
507 /// `Self` is generally a set of `U`, for example, [`Cube`]`<F, N>`. |
508 pub trait P2Minimise<U, F : Float> : Set<U> { |
508 pub trait P2Minimise<U : Space, F : Float> : Set<U> { |
509 /// Minimise `g` over the set presented by `Self`. |
509 /// Minimise `g` over the set presented by `Self`. |
510 /// |
510 /// |
511 /// The function returns `(x, v)` where `x` is the minimiser `v` an approximation of `g(x)`. |
511 /// The function returns `(x, v)` where `x` is the minimiser `v` an approximation of `g(x)`. |
512 fn p2_minimise<G : Fn(&U) -> F>(&self, g : G) -> (U, F); |
512 fn p2_minimise<G : Fn(&U) -> F>(&self, g : G) -> (U, F); |
513 |
513 |