Skip to main content

hermitian_exponential_first_column

Function hermitian_exponential_first_column 

Source
pub fn hermitian_exponential_first_column<T>(
    matrix: &Matrix<T>,
    exponent: Complex64,
    hermitian_tol: f64,
) -> Result<Vec<Complex64>, HermitianEigenError>
Expand description

Compute the first column of exp(exponent * A) for a small Hermitian matrix.

Krylov exponential routines use this for the projected matrix action on the first basis vector. The returned coefficients are complex even when A is real because real-time evolution has complex phases.

§Arguments

  • matrix - Square Hermitian matrix in column-major Matrix layout.

  • exponent - Scalar multiplier in exp(exponent * A).

  • hermitian_tol - Relative tolerance for checking A = A†; accepted

    roundoff is symmetrized before eigensolving.

§Returns

The first column of the matrix exponential.

§Errors

Returns HermitianEigenError if Hermitian validation or eigensolving fails.

§Examples

use num_complex::Complex64;
use tensor4all_tensorbackend::{hermitian_exponential_first_column, Matrix};

let matrix = Matrix::from_col_major_vec(2, 2, vec![1.0, 0.0, 0.0, 2.0]);
let column = hermitian_exponential_first_column(
    &matrix,
    Complex64::new(0.0, -0.5),
    1.0e-12,
).unwrap();
let expected = Complex64::new(0.5_f64.cos(), -0.5_f64.sin());
assert!((column[0] - expected).norm() < 1.0e-12);
assert!(column[1].norm() < 1.0e-12);