TropicalSemiring

Trait TropicalSemiring 

Source
pub trait TropicalSemiring:
    Copy
    + Clone
    + Send
    + Sync
    + Debug
    + PartialEq
    + 'static {
    type Scalar: TropicalScalar;

    // Required methods
    fn tropical_zero() -> Self;
    fn tropical_one() -> Self;
    fn tropical_add(self, rhs: Self) -> Self;
    fn tropical_mul(self, rhs: Self) -> Self;
    fn value(&self) -> Self::Scalar;
    fn from_scalar(s: Self::Scalar) -> Self;
}
Expand description

Core trait for tropical semiring operations.

A semiring (S, ⊕, ⊗) satisfies:

  • (S, ⊕) is a commutative monoid with identity tropical_zero
  • (S, ⊗) is a monoid with identity tropical_one
  • ⊗ distributes over ⊕
  • tropical_zero is absorbing: a ⊗ 0 = 0 ⊗ a = 0

Required Associated Types§

Source

type Scalar: TropicalScalar

The underlying scalar type.

Required Methods§

Source

fn tropical_zero() -> Self

Returns the additive identity (zero element for ⊕).

Source

fn tropical_one() -> Self

Returns the multiplicative identity (one element for ⊗).

Source

fn tropical_add(self, rhs: Self) -> Self

Tropical addition (⊕).

Source

fn tropical_mul(self, rhs: Self) -> Self

Tropical multiplication (⊗).

Source

fn value(&self) -> Self::Scalar

Get the underlying scalar value.

Source

fn from_scalar(s: Self::Scalar) -> Self

Create from a scalar value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§