pub fn hermitian_lanczos_lowest_eigenpair<T, F>(
apply_a: F,
initial: &T,
options: &HermitianLanczosOptions,
) -> Result<HermitianLanczosResult<T>, KrylovError>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 Hermitianvalidation settings.
§Returns
The lowest Ritz eigenpair and the true residual norm.
§Errors
Returns KrylovError::NonHermitian when the projected operator is not
Hermitian, KrylovError::InvalidOptions when an option is invalid,
KrylovError::ZeroInitialVector when initial is numerically zero, and
KrylovError::Operation when an operator application or backend call
fails. Non-convergence is reported through
HermitianLanczosResult::converged and does not produce an error.
§Examples
use tensor4all_core::{DynIndex, IdxTensor, TensorVectorSpace};
use tensor4all_core::krylov::{hermitian_lanczos_lowest_eigenpair, HermitianLanczosOptions};
let i = DynIndex::new_dyn(2);
let initial = IdxTensor::from_dense(vec![i.clone()], vec![1.0_f64, 1.0]).unwrap();
let result = hermitian_lanczos_lowest_eigenpair(
|x: &IdxTensor| Ok(x.clone()),
&initial,
&HermitianLanczosOptions::default(),
).unwrap();
assert!(result.converged);
assert!((result.eigenvalue - 1.0).abs() < 1.0e-12);