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_zerois absorbing: a ⊗ 0 = 0 ⊗ a = 0
Required Associated Types§
Sourcetype Scalar: TropicalScalar
type Scalar: TropicalScalar
The underlying scalar type.
Required Methods§
Sourcefn tropical_zero() -> Self
fn tropical_zero() -> Self
Returns the additive identity (zero element for ⊕).
Sourcefn tropical_one() -> Self
fn tropical_one() -> Self
Returns the multiplicative identity (one element for ⊗).
Sourcefn tropical_add(self, rhs: Self) -> Self
fn tropical_add(self, rhs: Self) -> Self
Tropical addition (⊕).
Sourcefn tropical_mul(self, rhs: Self) -> Self
fn tropical_mul(self, rhs: Self) -> Self
Tropical multiplication (⊗).
Sourcefn from_scalar(s: Self::Scalar) -> Self
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.