pub fn lapack_dgehrd(a: &Matrix, ilo: usize, ihi: usize) -> Result<Matrix>Expand description
Reduces a general square matrix to upper Hessenberg form by an
orthogonal similarity transformation (igraph_lapack_dgehrd): the
result H = Q' A Q has zeros below the first subdiagonal and the same
eigenvalues as A.
ilo and ihi are one-based, 1 <= ilo <= ihi <= n; use 1 and n
unless A is already upper triangular in rows and columns outside
ilo..=ihi (e.g. after balancing with lapack_dgeevx).
Binds igraph_lapack_dgehrd.
use igraph::{linalg::lapack_dgehrd, prelude::*};
let a = Matrix::from_rows(&[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 10.0]]).unwrap();
let h = lapack_dgehrd(&a, 1, 3).unwrap();
assert_eq!(h[(2, 0)], 0.0);
// The trace is preserved by similarity transformations.
assert!((h[(0, 0)] + h[(1, 1)] + h[(2, 2)] - 16.0).abs() < 1e-10);