src/bounds.rs

branch
dev
changeset 124
6aa955ad8122
parent 97
4e80fb049dca
child 125
25b6c8b20d1b
--- a/src/bounds.rs	Thu May 01 08:40:33 2025 -0500
+++ b/src/bounds.rs	Thu May 01 13:06:58 2025 -0500
@@ -40,7 +40,7 @@
     /// As an example, in the case of `A` being [`Bounds`][super::aggregator::Bounds],
     /// this function will return upper and lower bounds within `cube` for the mapping
     /// represented by `self`.
-    fn local_analysis(&self, cube: &Cube<F, N>) -> A;
+    fn local_analysis(&self, cube: &Cube<N, F>) -> A;
 }
 
 /// Trait for determining the upper and lower bounds of an float-valued [`Mapping`].
@@ -59,12 +59,12 @@
 impl<F: Float, T: GlobalAnalysis<F, Bounds<F>>> Bounded<F> for T {}
 
 /// A [`RealMapping`] that provides rough bounds as well as minimisation and maximisation.
-pub trait MinMaxMapping<F: Float, const N: usize>: RealMapping<F, N> + Bounded<F> {
+pub trait MinMaxMapping<const N: usize, F: Float = f64>: RealMapping<N, F> + Bounded<F> {
     /// Maximise the mapping within stated value `tolerance`.
     ///
     /// At most `max_steps` refinement steps are taken.
     /// Returns the approximate maximiser and the corresponding function value.
-    fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F);
+    fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Loc<N, F>, F);
 
     /// Maximise the mapping within stated value `tolerance` subject to a lower bound.
     ///
@@ -76,13 +76,13 @@
         bound: F,
         tolerance: F,
         max_steps: usize,
-    ) -> Option<(Loc<F, N>, F)>;
+    ) -> Option<(Loc<N, F>, F)>;
 
     /// Minimise the mapping within stated value `tolerance`.
     ///
     /// At most `max_steps` refinement steps are taken.
     /// Returns the approximate minimiser and the corresponding function value.
-    fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F);
+    fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Loc<N, F>, F);
 
     /// Minimise the mapping within stated value `tolerance` subject to a lower bound.
     ///
@@ -94,7 +94,7 @@
         bound: F,
         tolerance: F,
         max_steps: usize,
-    ) -> Option<(Loc<F, N>, F)>;
+    ) -> Option<(Loc<N, F>, F)>;
 
     /// Verify that the mapping has a given upper `bound` within indicated `tolerance`.
     ///

mercurial