#[repr(transparent)]pub struct MaxPlus<T>(pub T);Expand description
Max-plus tropical scalar: ⊕ = max, ⊗ = +.
The most common tropical semiring, used for shortest-path and
optimal-alignment problems. Wraps any ordered numeric type T.
§Examples
use tenferro_ext_tropical::MaxPlus;
let a = MaxPlus(3.0_f64);
let b = MaxPlus(5.0_f64);
// Tropical addition = max
let c = a + b;
assert_eq!(c, MaxPlus(5.0));
// Tropical multiplication = ordinary addition
let d = a * b;
assert_eq!(d, MaxPlus(8.0));Tuple Fields§
§0: TTrait Implementations§
Source§impl HasAlgebra for MaxPlus<f32>
impl HasAlgebra for MaxPlus<f32>
Source§type Algebra = MaxPlusAlgebra<f32>
type Algebra = MaxPlusAlgebra<f32>
The algebra associated with this scalar type.
Source§impl HasAlgebra for MaxPlus<f64>
impl HasAlgebra for MaxPlus<f64>
Source§type Algebra = MaxPlusAlgebra<f64>
type Algebra = MaxPlusAlgebra<f64>
The algebra associated with this scalar type.
Source§impl<T: PartialOrd> PartialOrd for MaxPlus<T>
impl<T: PartialOrd> PartialOrd for MaxPlus<T>
Source§impl TropicalScalar for MaxPlus<f32>
impl TropicalScalar for MaxPlus<f32>
Source§impl TropicalScalar for MaxPlus<f64>
impl TropicalScalar for MaxPlus<f64>
impl<T: Copy> Copy for MaxPlus<T>
impl<T> StructuralPartialEq for MaxPlus<T>
Auto Trait Implementations§
impl<T> Freeze for MaxPlus<T>where
T: Freeze,
impl<T> RefUnwindSafe for MaxPlus<T>where
T: RefUnwindSafe,
impl<T> Send for MaxPlus<T>where
T: Send,
impl<T> Sync for MaxPlus<T>where
T: Sync,
impl<T> Unpin for MaxPlus<T>where
T: Unpin,
impl<T> UnwindSafe for MaxPlus<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more