#[repr(transparent)]pub struct TropicalBitwise<T: BitwiseScalar>(pub T);Expand description
TropicalBitwise semiring: (uint, |, &, 0, ~0) — bit-packed boolean.
Each bit-lane of the wrapped word is an independent boolean problem
(bit-slicing): one GEMM computes 32 (u32) or 64 (u64) boolean matmuls at
once. ⊕ = |, ⊗ = &, zero = 0, one = !0.
CPU dispatch uses AVX2 or NEON where available, with a portable fallback.
There is no single argmax index for a packed word: each bit lane can have a
different winner. Per-lane argmax is not implemented, so this type does not
implement TropicalWithArgmax.
This is for many independent dense boolean problems. For a single large (sparse) boolean graph, use a sparse GraphBLAS tool (GraphBLAST / cuBool / Bit-GraphBLAS) — that is out of scope for this dense library.
Tuple Fields§
§0: TImplementations§
Source§impl<T: BitwiseScalar> TropicalBitwise<T>
impl<T: BitwiseScalar> TropicalBitwise<T>
Trait Implementations§
Source§impl<T: BitwiseScalar> Add for TropicalBitwise<T>
impl<T: BitwiseScalar> Add for TropicalBitwise<T>
Source§impl<T: Clone + BitwiseScalar> Clone for TropicalBitwise<T>
impl<T: Clone + BitwiseScalar> Clone for TropicalBitwise<T>
Source§fn clone(&self) -> TropicalBitwise<T>
fn clone(&self) -> TropicalBitwise<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 + BitwiseScalar> Copy for TropicalBitwise<T>
Source§impl<T: BitwiseScalar> Debug for TropicalBitwise<T>
impl<T: BitwiseScalar> Debug for TropicalBitwise<T>
Source§impl<T: BitwiseScalar> Default for TropicalBitwise<T>
impl<T: BitwiseScalar> Default for TropicalBitwise<T>
Source§impl<T: BitwiseScalar> Display for TropicalBitwise<T>
impl<T: BitwiseScalar> Display for TropicalBitwise<T>
impl<T: Eq + BitwiseScalar> Eq for TropicalBitwise<T>
Source§impl<T: BitwiseScalar> From<T> for TropicalBitwise<T>
impl<T: BitwiseScalar> From<T> for TropicalBitwise<T>
Source§impl KernelDispatch for TropicalBitwise<u32>
impl KernelDispatch for TropicalBitwise<u32>
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 u32,
lda: usize,
trans_a: Transpose,
b: *const u32,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<u32>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const u32, lda: usize, trans_a: Transpose, b: *const u32, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<u32>, )
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 TropicalBitwise<u64>
impl KernelDispatch for TropicalBitwise<u64>
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 u64,
lda: usize,
trans_a: Transpose,
b: *const u64,
ldb: usize,
trans_b: Transpose,
c: *mut Self,
ldc: usize,
workspace: &mut GemmWorkspace<u64>,
)
unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const u64, lda: usize, trans_a: Transpose, b: *const u64, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, workspace: &mut GemmWorkspace<u64>, )
Dispatch using reusable packing storage. Custom implementations retain
their existing dispatch unless they override this method to use workspace. Read more
Source§impl<T: BitwiseScalar> Mul for TropicalBitwise<T>
impl<T: BitwiseScalar> Mul for TropicalBitwise<T>
Source§impl<T: PartialEq + BitwiseScalar> PartialEq for TropicalBitwise<T>
impl<T: PartialEq + BitwiseScalar> PartialEq for TropicalBitwise<T>
Source§fn eq(&self, other: &TropicalBitwise<T>) -> bool
fn eq(&self, other: &TropicalBitwise<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T: BitwiseScalar> SimdTropical for TropicalBitwise<T>
impl<T: BitwiseScalar> SimdTropical for TropicalBitwise<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
const SIMD_WIDTH: usize
The SIMD width in elements.
impl<T: PartialEq + BitwiseScalar> StructuralPartialEq for TropicalBitwise<T>
Source§impl<T: BitwiseScalar> TropicalSemiring for TropicalBitwise<T>
impl<T: BitwiseScalar> TropicalSemiring for TropicalBitwise<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.
Auto Trait Implementations§
impl<T> Freeze for TropicalBitwise<T>where
T: Freeze,
impl<T> RefUnwindSafe for TropicalBitwise<T>where
T: RefUnwindSafe,
impl<T> Send for TropicalBitwise<T>
impl<T> Sync for TropicalBitwise<T>
impl<T> Unpin for TropicalBitwise<T>where
T: Unpin,
impl<T> UnsafeUnpin for TropicalBitwise<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TropicalBitwise<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