MaxMulAlgebra

Struct MaxMulAlgebra 

Source
pub struct MaxMulAlgebra;
Expand description

Algebra marker for the max-times tropical semiring (⊕ = max, ⊗ = ×).

§Examples

use tenferro_tropical::MaxMulAlgebra;
use tenferro_prims::{CpuBackend, TensorPrims};

let has_contract = CpuBackend::has_extension_for::<f64>(
    tenferro_prims::Extension::Contract,
);

Trait Implementations§

Source§

impl Semiring for MaxMulAlgebra

Max-times semiring over MaxMul<f64>.

  • zero() = MaxMul(0.0)
  • one() = MaxMul(1.0)
  • add(a, b) = max(a, b)
  • mul(a, b) = a × b (ordinary multiplication)
Source§

type Scalar = MaxMul<f64>

The scalar type for this semiring.
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 TensorPrims<MaxMulAlgebra> for CpuBackend

Source§

fn has_extension_for<T: ScalarBase>(_ext: Extension) -> bool

Tropical backends do not support extended operations.

Source§

type Plan<T: ScalarBase> = TropicalPlan<T>

Backend-specific plan type (no type erasure).
Source§

fn plan<T: ScalarBase>( _desc: &PrimDescriptor, _shapes: &[&[usize]], ) -> Result<TropicalPlan<T>>

Create an execution plan from an operation descriptor. Read more
Source§

fn execute<T: ScalarBase>( _plan: &TropicalPlan<T>, _alpha: T, _inputs: &[&StridedView<'_, T>], _beta: T, _output: &mut StridedViewMut<'_, T>, ) -> Result<()>

Execute a plan with the given scaling factors and tensor views. Read more

Auto Trait Implementations§

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
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, 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.