pub trait EigenValues: VectorSpace {
type EigenValues;
// Required method
fn eigenvalues(self) -> Self::EigenValues;
}Expand description
extension for eigen values
Required Associated Types§
Sourcetype EigenValues
type EigenValues
the type of the array of eigen values
Required Methods§
Sourcefn eigenvalues(self) -> Self::EigenValues
fn eigenvalues(self) -> Self::EigenValues
calculate eigen values.
§Examples
use cgmath::*;
use matext4cgmath::*;
use num_complex::Complex;
const EPS: f64 = 1.0e-10;
let mat = Matrix2::new(4.0, -2.0, 3.0, -1.0);
let mut eigens = mat.eigenvalues();
// Even in the case of real solutions, the order in the array is not guaranteed.
eigens.sort_by(|x, y| x.re.partial_cmp(&y.re).unwrap());
assert!(Complex::norm(eigens[0] - 1.0) < EPS);
assert!(Complex::norm(eigens[1] - 2.0) < EPS);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.