pub struct TropicalEigenvalueComputer {
pub matrix: Vec<Vec<f64>>,
}Expand description
Computes an approximation to the max-plus (tropical) eigenvalue of a square matrix using the Karp algorithm (max-cycle-mean via repeated multiplication).
The matrix is interpreted with max-plus arithmetic:
(A ⊗ B)[i][j] = max_k(A[i][k] + B[k][j]).
Returns None if the matrix is empty.
Fields§
§matrix: Vec<Vec<f64>>The n × n matrix (finite entries; use f64::NEG_INFINITY for −∞).
Implementations§
Source§impl TropicalEigenvalueComputer
impl TropicalEigenvalueComputer
Sourcepub fn new(matrix: Vec<Vec<f64>>) -> Self
pub fn new(matrix: Vec<Vec<f64>>) -> Self
Creates a new eigenvalue computer for the given square matrix.
Sourcepub fn compute_eigenvalue(&self) -> Option<f64>
pub fn compute_eigenvalue(&self) -> Option<f64>
Karp’s algorithm: λ* = max_i min_{k=0..n-1} (Aⁿ[j][i] − Aᵏ[j][i]) / (n − k).
Returns the max-plus eigenvalue (spectral radius) of the matrix,
or None if the matrix is empty or has no finite entry.
Auto Trait Implementations§
impl Freeze for TropicalEigenvalueComputer
impl RefUnwindSafe for TropicalEigenvalueComputer
impl Send for TropicalEigenvalueComputer
impl Sync for TropicalEigenvalueComputer
impl Unpin for TropicalEigenvalueComputer
impl UnsafeUnpin for TropicalEigenvalueComputer
impl UnwindSafe for TropicalEigenvalueComputer
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