pub fn eigen_matrix_symmetric(
a: &Matrix,
which: &EigenWhich,
algorithm: EigenAlgorithm,
options: &ArpackOptions,
) -> Result<SymmetricEigen>Expand description
Selected eigenvalues and eigenvectors of a real symmetric dense
matrix (igraph_eigen_matrix_symmetric), with LAPACK or ARPACK.
Only the upper triangle is used by LAPACK. options tunes ARPACK: only
its tol and mxiter are used (which, nev and ncv are derived
from which, and ARPACK starts from a random vector of the calling
thread’s RNG). Matrices of order at most 2 always use LAPACK.
Binds igraph_eigen_matrix_symmetric (see the
linear algebra chapter).
§Errors
If the matrix is not square or empty, the choice is invalid for the
matrix order, or not supported by the algorithm (e.g. Select with
ARPACK gives ErrorKind::Unimplemented).
§Examples
use igraph::{linalg::*, prelude::*};
// Eigenvalues of [[2, 1], [1, 2]] are 1 and 3.
let a = Matrix::from_rows(&[[2.0, 1.0], [1.0, 2.0]]).unwrap();
let e = eigen_matrix_symmetric(&a, &EigenWhich::All, EigenAlgorithm::Lapack, &ArpackOptions::default()).unwrap();
let mut values = e.values.clone();
values.sort_by(f64::total_cmp);
assert!((values[0] - 1.0).abs() < 1e-12 && (values[1] - 3.0).abs() < 1e-12);