#[repr(transparent)]pub struct TropicalMaxMul<T: TropicalScalar>(pub T);Expand description
TropicalMaxMul semiring: (ℝ⁺, max, ×)
- Addition (⊕) = max
- Multiplication (⊗) = ×
- Zero = 0
- One = 1
This is used for:
- Probability computations (non-log space)
- Fuzzy logic with product t-norm
Tuple Fields§
§0: TImplementations§
Source§impl<T: TropicalScalar> TropicalMaxMul<T>
impl<T: TropicalScalar> TropicalMaxMul<T>
Trait Implementations§
Source§impl<T: TropicalScalar> Add for TropicalMaxMul<T>
impl<T: TropicalScalar> Add for TropicalMaxMul<T>
Source§impl<T: Clone + TropicalScalar> Clone for TropicalMaxMul<T>
impl<T: Clone + TropicalScalar> Clone for TropicalMaxMul<T>
Source§fn clone(&self) -> TropicalMaxMul<T>
fn clone(&self) -> TropicalMaxMul<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy + TropicalScalar> Copy for TropicalMaxMul<T>
Source§impl<T: TropicalScalar> Debug for TropicalMaxMul<T>
impl<T: TropicalScalar> Debug for TropicalMaxMul<T>
Source§impl<T: TropicalScalar> Default for TropicalMaxMul<T>
impl<T: TropicalScalar> Default for TropicalMaxMul<T>
Source§impl<T: TropicalScalar> Display for TropicalMaxMul<T>
impl<T: TropicalScalar> Display for TropicalMaxMul<T>
Source§impl<T: TropicalScalar> From<T> for TropicalMaxMul<T>
impl<T: TropicalScalar> From<T> for TropicalMaxMul<T>
Source§impl KernelDispatch for TropicalMaxMul<f32>
impl KernelDispatch for TropicalMaxMul<f32>
Source§unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const f32,
lda: usize,
trans_a: Transpose,
b: *const f32,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)
unsafe fn dispatch_gemm_with_argmax( m: usize, n: usize, k: usize, a: *const f32, lda: usize, trans_a: Transpose, b: *const f32, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, )
Dispatch argmax, defaulting to the portable kernel for custom types. Read more
Source§unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const f32,
lda: usize,
trans_a: Transpose,
b: *const f32,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_argmax_with_workspace( m: usize, n: usize, k: usize, a: *const f32, lda: usize, trans_a: Transpose, b: *const f32, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch argmax using reusable packing storage. Read more
Source§unsafe fn dispatch_gemm(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
)
unsafe fn dispatch_gemm( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, )
Dispatch to the appropriate kernel based on CPU features.
Source§unsafe fn dispatch_gemm_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const f32,
lda: usize,
trans_a: Transpose,
b: *const f32,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const f32, lda: usize, trans_a: Transpose, b: *const f32, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch using reusable packing storage. Custom implementations retain
their existing dispatch unless they override this method to use workspace. Read more
Source§impl KernelDispatch for TropicalMaxMul<f64>
impl KernelDispatch for TropicalMaxMul<f64>
Source§unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const f64,
lda: usize,
trans_a: Transpose,
b: *const f64,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)
unsafe fn dispatch_gemm_with_argmax( m: usize, n: usize, k: usize, a: *const f64, lda: usize, trans_a: Transpose, b: *const f64, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, )
Dispatch argmax, defaulting to the portable kernel for custom types. Read more
Source§unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const f64,
lda: usize,
trans_a: Transpose,
b: *const f64,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_argmax_with_workspace( m: usize, n: usize, k: usize, a: *const f64, lda: usize, trans_a: Transpose, b: *const f64, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch argmax using reusable packing storage. Read more
Source§unsafe fn dispatch_gemm(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
)
unsafe fn dispatch_gemm( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, )
Dispatch to the appropriate kernel based on CPU features.
Source§unsafe fn dispatch_gemm_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const f64,
lda: usize,
trans_a: Transpose,
b: *const f64,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const f64, lda: usize, trans_a: Transpose, b: *const f64, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch using reusable packing storage. Custom implementations retain
their existing dispatch unless they override this method to use workspace. Read more
Source§impl KernelDispatch for TropicalMaxMul<i32>
impl KernelDispatch for TropicalMaxMul<i32>
Source§unsafe fn dispatch_gemm(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
)
unsafe fn dispatch_gemm( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, )
Dispatch to the appropriate kernel based on CPU features.
Source§unsafe fn dispatch_gemm_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch using reusable packing storage. Custom implementations retain
their existing dispatch unless they override this method to use workspace. Read more
Source§unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)where
Self: TropicalWithArgmax<Index = u32>,
unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)where
Self: TropicalWithArgmax<Index = u32>,
Dispatch argmax, defaulting to the portable kernel for custom types. Read more
Source§unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)where
Self: TropicalWithArgmax<Index = u32>,
unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)where
Self: TropicalWithArgmax<Index = u32>,
Dispatch argmax using reusable packing storage. Read more
Source§impl KernelDispatch for TropicalMaxMul<i64>
impl KernelDispatch for TropicalMaxMul<i64>
Source§unsafe fn dispatch_gemm(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
)
unsafe fn dispatch_gemm( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, )
Dispatch to the appropriate kernel based on CPU features.
Source§unsafe fn dispatch_gemm_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<Self::Scalar>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<Self::Scalar>, )
Dispatch using reusable packing storage. Custom implementations retain
their existing dispatch unless they override this method to use workspace. Read more
Source§unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)where
Self: TropicalWithArgmax<Index = u32>,
unsafe fn dispatch_gemm_with_argmax(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
)where
Self: TropicalWithArgmax<Index = u32>,
Dispatch argmax, defaulting to the portable kernel for custom types. Read more
Source§unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)where
Self: TropicalWithArgmax<Index = u32>,
unsafe fn dispatch_gemm_with_argmax_with_workspace(
m: usize,
n: usize,
k: usize,
a: *const Self::Scalar,
lda: usize,
trans_a: Transpose,
b: *const Self::Scalar,
ldb: usize,
trans_b: Transpose,
result: &mut GemmWithArgmax<Self>,
workspace: &mut GemmWorkspace<Self::Scalar>,
)where
Self: TropicalWithArgmax<Index = u32>,
Dispatch argmax using reusable packing storage. Read more
Source§impl Microkernel<TropicalMaxMul<f32>> for Avx2MaxMulF32Kernel
impl Microkernel<TropicalMaxMul<f32>> for Avx2MaxMulF32Kernel
Source§impl<T: TropicalScalar> Mul for TropicalMaxMul<T>
impl<T: TropicalScalar> Mul for TropicalMaxMul<T>
Source§impl<T: PartialEq + TropicalScalar> PartialEq for TropicalMaxMul<T>
impl<T: PartialEq + TropicalScalar> PartialEq for TropicalMaxMul<T>
Source§fn eq(&self, other: &TropicalMaxMul<T>) -> bool
fn eq(&self, other: &TropicalMaxMul<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T: TropicalScalar> SimdTropical for TropicalMaxMul<T>
impl<T: TropicalScalar> SimdTropical for TropicalMaxMul<T>
Source§const SIMD_AVAILABLE: bool = true
const SIMD_AVAILABLE: bool = true
Whether SIMD operations are available for this type.
Source§const SIMD_WIDTH: usize = 8
const SIMD_WIDTH: usize = 8
The SIMD width in elements.
impl<T: PartialEq + TropicalScalar> StructuralPartialEq for TropicalMaxMul<T>
Source§impl<T: TropicalScalar> TropicalSemiring for TropicalMaxMul<T>
impl<T: TropicalScalar> TropicalSemiring for TropicalMaxMul<T>
Source§fn scalar_slice(values: &[Self]) -> Option<&[Self::Scalar]>
fn scalar_slice(values: &[Self]) -> Option<&[Self::Scalar]>
Borrow scalar storage when the representation permits it.
The default uses a cached value projection in owned matrix views.
Source§fn tropical_zero() -> Self
fn tropical_zero() -> Self
Returns the additive identity (zero element for ⊕).
Source§fn tropical_one() -> Self
fn tropical_one() -> Self
Returns the multiplicative identity (one element for ⊗).
Source§fn tropical_add(self, rhs: Self) -> Self
fn tropical_add(self, rhs: Self) -> Self
Tropical addition (⊕).
Source§fn tropical_mul(self, rhs: Self) -> Self
fn tropical_mul(self, rhs: Self) -> Self
Tropical multiplication (⊗).
Source§fn from_scalar(s: T) -> Self
fn from_scalar(s: T) -> Self
Create from a scalar value.
Source§impl<T: TropicalScalar> TropicalWithArgmax for TropicalMaxMul<T>
impl<T: TropicalScalar> TropicalWithArgmax for TropicalMaxMul<T>
Source§fn tropical_add_argmax(
self,
self_idx: u32,
rhs: Self,
rhs_idx: u32,
) -> (Self, u32)
fn tropical_add_argmax( self, self_idx: u32, rhs: Self, rhs_idx: u32, ) -> (Self, u32)
Tropical addition with argmax tracking. Read more
Source§fn is_no_contribution(&self) -> bool
fn is_no_contribution(&self) -> bool
Whether this (output) value is a tropical-zero “no contribution” cell
whose argmax index should be canonicalized at GEMM write-back. Read more
Auto Trait Implementations§
impl<T> Freeze for TropicalMaxMul<T>where
T: Freeze,
impl<T> RefUnwindSafe for TropicalMaxMul<T>where
T: RefUnwindSafe,
impl<T> Send for TropicalMaxMul<T>
impl<T> Sync for TropicalMaxMul<T>
impl<T> Unpin for TropicalMaxMul<T>where
T: Unpin,
impl<T> UnsafeUnpin for TropicalMaxMul<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TropicalMaxMul<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,
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