1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
//! Error and solution types for eigenvalue problems. use ndarray::prelude::*; use ndarray::{Ix1, Ix2}; /// Errors from an eigenvalue problem. #[derive(Debug, Clone, PartialEq, Eq)] pub enum EigenError { /// The input matrix is not square. NotSquare, /// The input matrix does not have a conforming layout. BadLayout, /// The parameter to the LAPACKE method was invalid. /// /// This error should not occur in user-facing code. IllegalParameter(i32), /// Eigenvalues could not be found. Failed, } /// Solution to an eigenvalue problem. /// /// Contains thte eigenvalues and, optionally, the left and/or right /// eigenvectors of the solution. For symmetric problems, the /// eigenvectors are placed in `right_eigenvectors`. pub struct Solution<IV, EV> { /// Eigenvalues of the matrix. pub values: Array<EV, Ix1>, /// Eigenvectors for the left-eigenvalue problem ($x^H A = \lambda x^H$) pub left_vectors: Option<Array<IV, Ix2>>, /// Eigenvectors for the right-eigenvalue problem ($Ax = \lambda x$) /// /// For symmetric eigenvalue problems, the eigenvectors will be stored /// in `right_vectors`. pub right_vectors: Option<Array<IV, Ix2>>, }