pub fn hermitian_lanczos_lowest_eigenpair<T, F>(
apply_a: F,
initial: &T,
options: &HermitianLanczosOptions,
) -> Result<HermitianLanczosResult<T>>Expand description
Compute the lowest eigenpair of a Hermitian matrix-free operator.
The operator is supplied as apply_a, which maps a vector to A * vector.
The algorithm builds an orthonormal Krylov basis using modified
Gram-Schmidt with a second reorthogonalization pass, forms the small
projected matrix V^dagger A V, and solves that small Hermitian problem via
tensorbackend. The full operator matrix is never materialized.
§Arguments
apply_a- Matrix-free Hermitian operator application.initial- Nonzero initial vector that defines the starting Krylov vector.options- Krylov dimension, convergence tolerances, and Hermitian validation settings.
§Returns
The lowest Ritz eigenpair and the true residual norm.
§Errors
Returns an error if the initial vector is zero, a vector-space operation
fails, apply_a fails, the projected operator is not Hermitian, or the small
projected eigensolver fails.
§Examples
use tensor4all_core::{DynIndex, TensorDynLen, TensorVectorSpace};
use tensor4all_core::krylov::{hermitian_lanczos_lowest_eigenpair, HermitianLanczosOptions};
let i = DynIndex::new_dyn(2);
let initial = TensorDynLen::from_dense(vec![i.clone()], vec![1.0_f64, 1.0]).unwrap();
let result = hermitian_lanczos_lowest_eigenpair(
|x: &TensorDynLen| Ok(x.clone()),
&initial,
&HermitianLanczosOptions::default(),
).unwrap();
assert!(result.converged);
assert!((result.eigenvalue - 1.0).abs() < 1.0e-12);