pub struct TropicalMatrix {
pub n: usize,
pub data: Vec<TropicalNumber>,
}Expand description
A square tropical matrix with min-plus arithmetic.
Entries are TropicalNumber values; matrix multiplication uses
tropical arithmetic: (A ⊗ B)[i][j] = min_k(A[i][k] ⊗ B[k][j]).
Fields§
§n: usizeNumber of rows/columns.
data: Vec<TropicalNumber>Entries stored in row-major order: entry (i, j) is at index i * n + j.
Implementations§
Source§impl TropicalMatrix
impl TropicalMatrix
Sourcepub fn identity(n: usize) -> Self
pub fn identity(n: usize) -> Self
Creates the tropical identity matrix (0 on diagonal, +∞ elsewhere).
Sourcepub fn get(&self, i: usize, j: usize) -> &TropicalNumber
pub fn get(&self, i: usize, j: usize) -> &TropicalNumber
Gets entry (i, j).
Sourcepub fn set(&mut self, i: usize, j: usize, v: TropicalNumber)
pub fn set(&mut self, i: usize, j: usize, v: TropicalNumber)
Sets entry (i, j) to v.
Trait Implementations§
Source§impl Clone for TropicalMatrix
impl Clone for TropicalMatrix
Source§fn clone(&self) -> TropicalMatrix
fn clone(&self) -> TropicalMatrix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TropicalMatrix
impl RefUnwindSafe for TropicalMatrix
impl Send for TropicalMatrix
impl Sync for TropicalMatrix
impl Unpin for TropicalMatrix
impl UnsafeUnpin for TropicalMatrix
impl UnwindSafe for TropicalMatrix
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