diff -r edb95d2b83cc -r d2acaaddd9af src/bisection_tree/either.rs
--- a/src/bisection_tree/either.rs Sun Nov 10 09:02:57 2024 -0500
+++ b/src/bisection_tree/either.rs Tue Dec 31 09:12:43 2024 -0500
@@ -29,12 +29,18 @@
Right(B),
}
+impl HasScalarField for EitherSupport
+where A : HasScalarField,
+ B : HasScalarField {
+ type Field = F;
+}
+
// We need type alias bounds to access associate types.
#[allow(type_alias_bounds)]
type BothAllDataIter<
- 'a, F,
- G1 : SupportGenerator,
- G2 : SupportGenerator,
+ 'a,
+ G1 : SupportGenerator,
+ G2 : SupportGenerator,
const N : usize
> = Chain<
MapF, (usize, EitherSupport)>,
@@ -46,8 +52,8 @@
#[inline]
fn map_left((d, support) : (G1::Id, G1::SupportType))
-> (usize, EitherSupport)
- where G1 : SupportGenerator,
- G2 : SupportGenerator {
+ where G1 : SupportGenerator,
+ G2 : SupportGenerator {
let id : usize = d.into();
(id.into(), EitherSupport::Left(support))
@@ -57,8 +63,8 @@
#[inline]
fn map_right(n0 : &usize, (d, support) : (G2::Id, G2::SupportType))
-> (usize, EitherSupport)
- where G1 : SupportGenerator,
- G2 : SupportGenerator {
+ where G1 : SupportGenerator,
+ G2 : SupportGenerator {
let id : usize = d.into();
((n0+id).into(), EitherSupport::Right(support))
@@ -70,8 +76,8 @@
#[inline]
pub(super) fn all_left_data(&self)
-> MapF, (usize, EitherSupport)>
- where G1 : SupportGenerator,
- G2 : SupportGenerator {
+ where G1 : SupportGenerator,
+ G2 : SupportGenerator {
self.0.all_data().mapF(Self::map_left)
}
@@ -81,22 +87,29 @@
#[inline]
pub(super) fn all_right_data(&self)
-> MapZ, usize, (usize, EitherSupport)>
- where G1 : SupportGenerator,
- G2 : SupportGenerator {
+ where G1 : SupportGenerator,
+ G2 : SupportGenerator {
let n0 = self.0.support_count();
self.1.all_data().mapZ(n0, Self::map_right)
}
}
+impl HasScalarField for BothGenerators
+where G1 : HasScalarField,
+ G2 : HasScalarField {
+ type Field = F;
+}
+
impl
-SupportGenerator
+SupportGenerator
for BothGenerators
-where G1 : SupportGenerator,
- G2 : SupportGenerator {
+where G1 : SupportGenerator + HasRealField,
+ G2 : SupportGenerator + HasRealField,
+ Self : HasRealField {
type Id = usize;
type SupportType = EitherSupport;
- type AllDataIter<'a> = BothAllDataIter<'a, F, G1, G2, N> where G1 : 'a, G2 : 'a;
+ type AllDataIter<'a> = BothAllDataIter<'a, G1, G2, N> where G1 : 'a, G2 : 'a;
#[inline]
fn support_for(&self, id : Self::Id)
@@ -120,9 +133,9 @@
}
}
-impl Support for EitherSupport
-where S1 : Support,
- S2 : Support {
+impl Support for EitherSupport
+where S1 : Support,
+ S2 : Support {
#[inline]
fn support_hint(&self) -> Cube {
@@ -149,10 +162,11 @@
}
}
-impl LocalAnalysis for EitherSupport
+impl LocalAnalysis>
+for EitherSupport
where A : Aggregator,
- S1 : LocalAnalysis,
- S2 : LocalAnalysis, {
+ S1 : LocalAnalysis>,
+ S2 : LocalAnalysis> {
#[inline]
fn local_analysis(&self, cube : &Cube) -> A {
@@ -163,10 +177,10 @@
}
}
-impl GlobalAnalysis for EitherSupport
+impl GlobalAnalysis for EitherSupport
where A : Aggregator,
- S1 : GlobalAnalysis,
- S2 : GlobalAnalysis, {
+ S1 : GlobalAnalysis,
+ S2 : GlobalAnalysis, {
#[inline]
fn global_analysis(&self) -> A {
@@ -190,9 +204,9 @@
}
}
-impl Differentiable for EitherSupport
-where S1 : Differentiable,
- S2 : Differentiable {
+impl Differentiable for EitherSupport
+where S1 : Differentiable,
+ S2 : Differentiable {
type Derivative = F;
#[inline]
fn differential(&self, x : X) -> F {