MinPlusAlgebra

Struct MinPlusAlgebra 

Source
pub struct MinPlusAlgebra<T>(/* private fields */);
Expand description

Algebra marker for the min-plus tropical semiring (⊕ = min, ⊗ = +).

§Examples

use tenferro_algebra::Semiring;
use tenferro_ext_tropical::{MinPlus, MinPlusAlgebra};

let z = <MinPlusAlgebra<f64> as Semiring>::zero();
assert_eq!(z, MinPlus(f64::INFINITY));

Trait Implementations§

Source§

impl Algebra for MinPlusAlgebra<f32>

Source§

type Scalar = MinPlus<f32>

The scalar element type for tensors under this algebra.
Source§

impl Algebra for MinPlusAlgebra<f64>

Source§

type Scalar = MinPlus<f64>

The scalar element type for tensors under this algebra.
Source§

impl<T: Clone> Clone for MinPlusAlgebra<T>

Source§

fn clone(&self) -> MinPlusAlgebra<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for MinPlusAlgebra<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Semiring for MinPlusAlgebra<f32>

Source§

fn zero() -> Self::Scalar

Additive identity element.
Source§

fn one() -> Self::Scalar

Multiplicative identity element.
Source§

fn add(a: Self::Scalar, b: Self::Scalar) -> Self::Scalar

Semiring addition.
Source§

fn mul(a: Self::Scalar, b: Self::Scalar) -> Self::Scalar

Semiring multiplication.
Source§

impl Semiring for MinPlusAlgebra<f64>

Source§

fn zero() -> Self::Scalar

Additive identity element.
Source§

fn one() -> Self::Scalar

Multiplicative identity element.
Source§

fn add(a: Self::Scalar, b: Self::Scalar) -> Self::Scalar

Semiring addition.
Source§

fn mul(a: Self::Scalar, b: Self::Scalar) -> Self::Scalar

Semiring multiplication.
Source§

impl<S: Scalar + Float> TensorSemiringCore<MinPlusAlgebra<S>> for CpuBackend
where MinPlusAlgebra<S>: Algebra<Scalar = MinPlus<S>> + Semiring<Scalar = MinPlus<S>>, MinPlus<S>: Scalar + TropicalGemmDispatch,

Source§

type Plan = TropicalPlan<MinPlus<S>>

Backend-specific plan type.
Source§

type Context = CpuContext

Backend-specific execution context.
Source§

fn plan( _ctx: &mut CpuContext, desc: &SemiringCoreDescriptor, shapes: &[&[usize]], ) -> Result<TropicalPlan<MinPlus<S>>>

Plan a semiring-core operation.
Source§

fn execute( _ctx: &mut CpuContext, plan: &TropicalPlan<MinPlus<S>>, alpha: MinPlus<S>, inputs: &[&Tensor<MinPlus<S>>], beta: MinPlus<S>, output: &mut Tensor<MinPlus<S>>, ) -> Result<()>

Execute a semiring-core operation.
Source§

impl<S: Scalar + Float> TensorSemiringFastPath<MinPlusAlgebra<S>> for CpuBackend
where MinPlusAlgebra<S>: Algebra<Scalar = MinPlus<S>> + Semiring<Scalar = MinPlus<S>>, MinPlus<S>: Scalar,

Source§

type Plan = TropicalPlan<MinPlus<S>>

Backend-specific plan type.
Source§

type Context = CpuContext

Backend-specific execution context.
Source§

fn plan( _ctx: &mut CpuContext, _desc: &SemiringFastPathDescriptor, _shapes: &[&[usize]], ) -> Result<TropicalPlan<MinPlus<S>>>

Plan an optional semiring fast path.
Source§

fn execute( _ctx: &mut CpuContext, _plan: &TropicalPlan<MinPlus<S>>, _alpha: MinPlus<S>, _inputs: &[&Tensor<MinPlus<S>>], _beta: MinPlus<S>, _output: &mut Tensor<MinPlus<S>>, ) -> Result<()>

Execute an optional semiring fast path.
Source§

fn has_fast_path(_desc: SemiringFastPathDescriptor) -> bool

Query whether the optional path is available.
Source§

impl<T: Copy> Copy for MinPlusAlgebra<T>

Auto Trait Implementations§

§

impl<T> Freeze for MinPlusAlgebra<T>

§

impl<T> RefUnwindSafe for MinPlusAlgebra<T>
where T: RefUnwindSafe,

§

impl<T> Send for MinPlusAlgebra<T>
where T: Send,

§

impl<T> Sync for MinPlusAlgebra<T>
where T: Sync,

§

impl<T> Unpin for MinPlusAlgebra<T>
where T: Unpin,

§

impl<T> UnwindSafe for MinPlusAlgebra<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DistributionExt for T
where T: ?Sized,

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> MaybeSend for T

§

impl<T> MaybeSendSync for T

§

impl<T> MaybeSync for T