pub struct MaxPlusAlgebra<T>(/* private fields */);Expand description
Algebra marker for the max-plus tropical semiring (⊕ = max, ⊗ = +).
Generic over the inner scalar type T (typically f32 or f64).
Used as the algebra parameter Alg in semiring-family execution traits
such as
TensorSemiringCore<MaxPlusAlgebra<T>>.
§Examples
use tenferro_algebra::Semiring;
use tenferro_ext_tropical::{MaxPlus, MaxPlusAlgebra};
let z = <MaxPlusAlgebra<f64> as Semiring>::zero();
assert_eq!(z, MaxPlus(f64::NEG_INFINITY));
let z32 = <MaxPlusAlgebra<f32> as Semiring>::zero();
assert_eq!(z32, MaxPlus(f32::NEG_INFINITY));Trait Implementations§
Source§impl Algebra for MaxPlusAlgebra<f32>
impl Algebra for MaxPlusAlgebra<f32>
Source§impl Algebra for MaxPlusAlgebra<f64>
impl Algebra for MaxPlusAlgebra<f64>
Source§impl<T: Clone> Clone for MaxPlusAlgebra<T>
impl<T: Clone> Clone for MaxPlusAlgebra<T>
Source§fn clone(&self) -> MaxPlusAlgebra<T>
fn clone(&self) -> MaxPlusAlgebra<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for MaxPlusAlgebra<T>
impl<T: Debug> Debug for MaxPlusAlgebra<T>
Source§impl Semiring for MaxPlusAlgebra<f32>
impl Semiring for MaxPlusAlgebra<f32>
Source§impl Semiring for MaxPlusAlgebra<f64>
impl Semiring for MaxPlusAlgebra<f64>
Source§impl<S: Scalar + Float> TensorSemiringCore<MaxPlusAlgebra<S>> for CpuBackend
impl<S: Scalar + Float> TensorSemiringCore<MaxPlusAlgebra<S>> for CpuBackend
Source§type Plan = TropicalPlan<MaxPlus<S>>
type Plan = TropicalPlan<MaxPlus<S>>
Backend-specific plan type.
Source§type Context = CpuContext
type Context = CpuContext
Backend-specific execution context.
Source§fn plan(
_ctx: &mut CpuContext,
desc: &SemiringCoreDescriptor,
shapes: &[&[usize]],
) -> Result<TropicalPlan<MaxPlus<S>>>
fn plan( _ctx: &mut CpuContext, desc: &SemiringCoreDescriptor, shapes: &[&[usize]], ) -> Result<TropicalPlan<MaxPlus<S>>>
Plan a semiring-core operation.
Source§impl<S: Scalar + Float> TensorSemiringFastPath<MaxPlusAlgebra<S>> for CpuBackend
impl<S: Scalar + Float> TensorSemiringFastPath<MaxPlusAlgebra<S>> for CpuBackend
Source§type Plan = TropicalPlan<MaxPlus<S>>
type Plan = TropicalPlan<MaxPlus<S>>
Backend-specific plan type.
Source§type Context = CpuContext
type Context = CpuContext
Backend-specific execution context.
Source§fn plan(
_ctx: &mut CpuContext,
_desc: &SemiringFastPathDescriptor,
_shapes: &[&[usize]],
) -> Result<TropicalPlan<MaxPlus<S>>>
fn plan( _ctx: &mut CpuContext, _desc: &SemiringFastPathDescriptor, _shapes: &[&[usize]], ) -> Result<TropicalPlan<MaxPlus<S>>>
Plan an optional semiring fast path.
Source§fn execute(
_ctx: &mut CpuContext,
_plan: &TropicalPlan<MaxPlus<S>>,
_alpha: MaxPlus<S>,
_inputs: &[&Tensor<MaxPlus<S>>],
_beta: MaxPlus<S>,
_output: &mut Tensor<MaxPlus<S>>,
) -> Result<()>
fn execute( _ctx: &mut CpuContext, _plan: &TropicalPlan<MaxPlus<S>>, _alpha: MaxPlus<S>, _inputs: &[&Tensor<MaxPlus<S>>], _beta: MaxPlus<S>, _output: &mut Tensor<MaxPlus<S>>, ) -> Result<()>
Execute an optional semiring fast path.
Source§fn has_fast_path(_desc: SemiringFastPathDescriptor) -> bool
fn has_fast_path(_desc: SemiringFastPathDescriptor) -> bool
Query whether the optional path is available.
impl<T: Copy> Copy for MaxPlusAlgebra<T>
Auto Trait Implementations§
impl<T> Freeze for MaxPlusAlgebra<T>
impl<T> RefUnwindSafe for MaxPlusAlgebra<T>where
T: RefUnwindSafe,
impl<T> Send for MaxPlusAlgebra<T>where
T: Send,
impl<T> Sync for MaxPlusAlgebra<T>where
T: Sync,
impl<T> Unpin for MaxPlusAlgebra<T>where
T: Unpin,
impl<T> UnwindSafe for MaxPlusAlgebra<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