Template Struct matrix_continued_fraction

Struct Documentation

template<typename T>
struct matrix_continued_fraction

Matrix-valued Jacobi continued fraction.

Template parameter T is the field of the Lanczos matrices A and B (double for a real Hamiltonian, Complex for a complex one). The weight matrix W and the Green function G(z) are always complex.

Public Functions

inline matrix_continued_fraction()

Default constructor.

inline matrix_continued_fraction(const vector<matrix<T>> &_A, const vector<matrix<T>> &_B)

Constructor from block Lanczos output with orthonormal starting block (W = I).

Parameters:
  • _A – Diagonal blocks from blockLanczos.

  • _B – Off-diagonal QR blocks from blockLanczos.

inline matrix_continued_fraction(const vector<matrix<T>> &_A, const vector<matrix<T>> &_B, double e0, const matrix<T> &_W, bool create)

Constructor analogous to continued_fraction(a, b, e0, norm, create).

Applies an energy shift to the diagonal blocks (for electron/hole components of the Green function, matching the scalar continued_fraction constructor convention) and stores an initial weight matrix W.

Parameters:
  • _A – Diagonal blocks from blockLanczos.

  • _B – Off-diagonal QR blocks from blockLanczos.

  • e0 – Ground-state energy used to shift A[j].

  • _W – p×p weight matrix arising from initial-block normalisation. Pass the identity for an orthonormal starting block.

  • create – If true (creation/electron sector): A[j] -= e0*I. If false (annihilation/hole sector): A[j] = e0*I - A[j].

inline matrix_continued_fraction(const vector<matrix<T>> &_A, const vector<matrix<T>> &_B, const matrix<Complex> &_W)

Constructor from pre-processed matrices and explicit complex weight.

Used when the MCF coefficients have been constructed externally (e.g., after periodization in the lattice model), so no additional energy shift is needed.

Parameters:
  • _A – Diagonal blocks, already energy-shifted.

  • _B – Off-diagonal QR blocks.

  • _W – Weight matrix (p×p, complex); G(z) = W^H F_0(z) W.

inline matrix<Complex> evaluate(Complex z) const

Evaluate the matrix continued fraction at complex frequency z.

Returns G(z) = W^H F_0(z) W where F_M = 0, F_j = (zI - A_j - B_j^H F_{j+1} B_j)^{-1}, j = M-1 … 0. B[M-1] (the last element) is the truncation residual and is not used.

inline vector<T> apply(const vector<T> &x) const

Apply the block-tridiagonal Lanczos matrix T to a vector and return T*x.

The input vector x must have size M*p (M = A.size(), p = block size). T is block-tridiagonal with diagonal blocks A[j], sub-diagonal blocks B[j-1] (at block row j, column j-1), and super-diagonal blocks B[j]^H (at block row j, column j+1). B[M-1] is the truncation residual and is NOT applied.

(T x)_j = B[j-1] x_{j-1} + A[j] x_j + B[j]^H x_{j+1}

with the boundary terms B[-1] = B[M-1] = 0.

inline matrix_continued_fraction<double> real() const

Returns a real-valued copy by taking the real part of every matrix.

Converts this MCF to a matrix_continued_fraction<double> by extracting the real part of each A[j], B[j], and W. Useful when the Hamiltonian is known to be real and the imaginary parts are negligible numerical noise.

inline int floors() const

Number of levels (= A.size()).

Public Members

int p

block size

vector<matrix<T>> A

diagonal blocks (partial denominators)

vector<matrix<T>> B

off-diagonal QR blocks (partial numerator factors)

matrix<Complex> W

initial weight (default: identity, always complex)