pub struct MatRef<'a, S: TropicalSemiring> { /* private fields */ }Expand description
Immutable view over scalar data interpreted as a tropical matrix.
This is a lightweight view type that can be copied freely. It references scalar data and interprets operations using the specified semiring type.
use tropical_gemm::{MatRef, MaxPlus};
let data = [1.0f32, 2.0, 3.0, 4.0, 5.0, 6.0];
let a = MatRef::<MaxPlus<f32>>::from_slice(&data, 2, 3);
assert_eq!(a.nrows(), 2);
assert_eq!(a.ncols(), 3);
assert_eq!(a.get(0, 0), 1.0);Implementations§
Source§impl<'a, S: TropicalSemiring> MatRef<'a, S>
impl<'a, S: TropicalSemiring> MatRef<'a, S>
Source§impl<'a, S: TropicalSemiring + KernelDispatch> MatRef<'a, S>
impl<'a, S: TropicalSemiring + KernelDispatch> MatRef<'a, S>
Source§impl<'a, S> MatRef<'a, S>
impl<'a, S> MatRef<'a, S>
Sourcepub fn matmul_argmax(&self, b: &MatRef<'_, S>) -> MatWithArgmax<S>
pub fn matmul_argmax(&self, b: &MatRef<'_, S>) -> MatWithArgmax<S>
Perform tropical matrix multiplication with argmax tracking.
Returns both the result matrix and the argmax indices indicating which k-index produced each optimal value.
§Panics
Panics if dimensions don’t match (self.ncols != b.nrows).
Trait Implementations§
Source§impl<'a, S: TropicalSemiring> Clone for MatRef<'a, S>
impl<'a, S: TropicalSemiring> Clone for MatRef<'a, S>
Source§impl<'a, 'b, S> Mul<&'b MatRef<'b, S>> for &'a MatRef<'a, S>where
S: TropicalSemiring + KernelDispatch,
impl<'a, 'b, S> Mul<&'b MatRef<'b, S>> for &'a MatRef<'a, S>where
S: TropicalSemiring + KernelDispatch,
Source§impl<'a, 'b, S> Mul<MatRef<'b, S>> for MatRef<'a, S>where
S: TropicalSemiring + KernelDispatch,
impl<'a, 'b, S> Mul<MatRef<'b, S>> for MatRef<'a, S>where
S: TropicalSemiring + KernelDispatch,
impl<'a, S: TropicalSemiring> Copy for MatRef<'a, S>
Auto Trait Implementations§
impl<'a, S> Freeze for MatRef<'a, S>
impl<'a, S> RefUnwindSafe for MatRef<'a, S>
impl<'a, S> Send for MatRef<'a, S>
impl<'a, S> Sync for MatRef<'a, S>
impl<'a, S> Unpin for MatRef<'a, S>where
S: Unpin,
impl<'a, S> UnwindSafe for MatRef<'a, S>
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