Skip to main content

lowest_hermitian_eigenpair

Function lowest_hermitian_eigenpair 

Source
pub fn lowest_hermitian_eigenpair<T>(
    matrix: &Matrix<T>,
    hermitian_tol: f64,
) -> Result<HermitianEigenpair<T>, HermitianEigenError>
Expand description

Compute the smallest eigenpair of a small Hermitian projected matrix.

This function validates that matrix is square, non-empty, and Hermitian within hermitian_tol, symmetrizes accepted roundoff as (A + A†) / 2, then calls tenferro’s Hermitian eigendecomposition. It is intended for Rayleigh-Ritz projected Krylov matrices, whose dimension is bounded by the Krylov subspace size. It must not be used to materialize a full tensor-network effective Hamiltonian.

§Arguments

  • matrix - Small dense Hermitian matrix in column-major Matrix layout.

  • hermitian_tol - Relative tolerance for A[i, j] = conj(A[j, i]),

    applied as hermitian_tol * max(1, |A[i,j]|, |A[j,i]|). Typical values are 1e-12 for f64/Complex64 projected matrices.

§Returns

The smallest real eigenvalue and the corresponding normalized eigenvector coefficients.

§Errors

Returns HermitianEigenError if the matrix is empty, non-square, non-Hermitian within hermitian_tol, or if the backend eigendecomposition fails or returns an unexpected dtype/shape.

§Examples

use tensor4all_tensorbackend::{lowest_hermitian_eigenpair, Matrix};

let matrix = Matrix::from_col_major_vec(2, 2, vec![2.0_f64, 1.0, 1.0, 2.0]);
let pair = lowest_hermitian_eigenpair(&matrix, 1.0e-12).unwrap();

assert!((pair.eigenvalue - 1.0).abs() < 1.0e-12);
assert_eq!(pair.eigenvector.len(), 2);