src/bounds.rs

branch
dev
changeset 197
1f301affeae3
parent 126
0ccad3ee8e95
equal deleted inserted replaced
196:3697375f4ee9 197:1f301affeae3
7 use crate::sets::{Cube, Set}; 7 use crate::sets::{Cube, Set};
8 use crate::types::{Float, Num}; 8 use crate::types::{Float, Num};
9 9
10 /// Trait for globally analysing a property `A` of a [`Mapping`]. 10 /// Trait for globally analysing a property `A` of a [`Mapping`].
11 /// 11 ///
12 /// Typically `A` is an [`Aggregator`][super::aggregator::Aggregator] such as 12 /// Typically `A` is an [`Aggregator`][super::bisection_tree::Aggregator]
13 /// [`Bounds`][super::aggregator::Bounds]. 13 /// such as [`Bounds`].
14 pub trait GlobalAnalysis<F: Num, A> { 14 pub trait GlobalAnalysis<F: Num, A> {
15 /// Perform global analysis of the property `A` of `Self`. 15 /// Perform global analysis of the property `A` of `Self`.
16 /// 16 ///
17 /// As an example, in the case of `A` being [`Bounds`][super::aggregator::Bounds], 17 /// As an example, in the case of `A` being [`Bounds`],
18 /// this function will return global upper and lower bounds for the mapping 18 /// this function will return global upper and lower bounds for the mapping
19 /// represented by `self`. 19 /// represented by `self`.
20 fn global_analysis(&self) -> A; 20 fn global_analysis(&self) -> A;
21 } 21 }
22 22
26 // fn global_analysis(&self) -> Bounds<F> { 26 // fn global_analysis(&self) -> Bounds<F> {
27 // self.local_analysis(&self.support_hint()) 27 // self.local_analysis(&self.support_hint())
28 // } 28 // }
29 // } 29 // }
30 30
31 /// Trait for locally analysing a property `A` of a [`Mapping`] (implementing [`Support`]) 31 /// Trait for locally analysing a property `A` of a [`Mapping`] (implementing [`super::bisection_tree::Support`])
32 /// within a [`Cube`]. 32 /// within a [`Cube`].
33 /// 33 ///
34 /// Typically `A` is an [`Aggregator`][super::aggregator::Aggregator] such as 34 /// Typically `A` is an [`Aggregator`][super::bisection_tree::Aggregator] such as [`Bounds`].
35 /// [`Bounds`][super::aggregator::Bounds].
36 pub trait LocalAnalysis<F: Num, A, const N: usize>: GlobalAnalysis<F, A> { 35 pub trait LocalAnalysis<F: Num, A, const N: usize>: GlobalAnalysis<F, A> {
37 /// Perform local analysis of the property `A` of `Self`. 36 /// Perform local analysis of the property `A` of `Self`.
38 /// 37 ///
39 /// As an example, in the case of `A` being [`Bounds`][super::aggregator::Bounds], 38 /// As an example, in the case of `A` being [`Bounds`],
40 /// this function will return upper and lower bounds within `cube` for the mapping 39 /// this function will return upper and lower bounds within `cube` for the mapping
41 /// represented by `self`. 40 /// represented by `self`.
42 fn local_analysis(&self, cube: &Cube<N, F>) -> A; 41 fn local_analysis(&self, cube: &Cube<N, F>) -> A;
43 } 42 }
44 43

mercurial