Skip to main content

arnoldi

Function arnoldi 

Source
pub fn arnoldi(
    a: &CsrMatrix,
    b0: &[f64],
    k: usize,
) -> (Vec<Vec<f64>>, Vec<Vec<f64>>)
Expand description

Arnoldi iteration: build an orthonormal Krylov basis for A.

Starting from initial vector b0, computes k basis vectors Q = [q_0, q_1, ..., q_{k-1}] (each of length n) and the upper Hessenberg matrix H (stored row-major as Vec<Vecf64> of size (k+1) × k).

The Arnoldi relation holds: A Q_k = Q_{k+1} H_{k+1,k}.

§Arguments

  • a – input sparse matrix (n × n)
  • b0 – starting vector (length n)
  • k – number of Arnoldi steps to perform

§Returns

(Q, H) where Q[i] is the i-th Krylov basis vector and H[i][j] is the Hessenberg coefficient.