#[repr(transparent)]pub struct MinPlus<T>(pub T);Expand description
Min-plus tropical scalar: ⊕ = min, ⊗ = +.
Used for shortest-path problems (Dijkstra, Bellman–Ford).
§Examples
use tenferro_ext_tropical::MinPlus;
let a = MinPlus(3.0_f64);
let b = MinPlus(5.0_f64);
// Tropical addition = min
let c = a + b;
assert_eq!(c, MinPlus(3.0));
// Tropical multiplication = ordinary addition
let d = a * b;
assert_eq!(d, MinPlus(8.0));Tuple Fields§
§0: TTrait Implementations§
Source§impl HasAlgebra for MinPlus<f32>
impl HasAlgebra for MinPlus<f32>
Source§type Algebra = MinPlusAlgebra<f32>
type Algebra = MinPlusAlgebra<f32>
The algebra associated with this scalar type.
Source§impl HasAlgebra for MinPlus<f64>
impl HasAlgebra for MinPlus<f64>
Source§type Algebra = MinPlusAlgebra<f64>
type Algebra = MinPlusAlgebra<f64>
The algebra associated with this scalar type.
Source§impl<T: PartialOrd> PartialOrd for MinPlus<T>
impl<T: PartialOrd> PartialOrd for MinPlus<T>
Source§impl TropicalScalar for MinPlus<f32>
impl TropicalScalar for MinPlus<f32>
Source§impl TropicalScalar for MinPlus<f64>
impl TropicalScalar for MinPlus<f64>
impl<T: Copy> Copy for MinPlus<T>
impl<T> StructuralPartialEq for MinPlus<T>
Auto Trait Implementations§
impl<T> Freeze for MinPlus<T>where
T: Freeze,
impl<T> RefUnwindSafe for MinPlus<T>where
T: RefUnwindSafe,
impl<T> Send for MinPlus<T>where
T: Send,
impl<T> Sync for MinPlus<T>where
T: Sync,
impl<T> Unpin for MinPlus<T>where
T: Unpin,
impl<T> UnwindSafe for MinPlus<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