Template Function bandLanczos

Function Documentation

template<typename TYPE, typename HilbertField>
bool bandLanczos(TYPE &H, vector<vector<HilbertField>> &phi, vector<double> &evalues, matrix<HilbertField> &evec_red, matrix<HilbertField> &P0, int &M0, bool verb = false)

Implementation of the band Lanczos method for the Green function.

band Lanczos method. See the chapter by Freund in the SIAM book www.cs.utk.edu/~dongarra/etemplates

  • steps indicated in comments refer to Freund’s algorithm in the SIAM book

  • indices start from 0 here, contrary to Freund’s text where they start from 1. Adjustements are therefore brought to some formula of his algorithm

  • Also, Freund’s text does not treat memory management.

This is used to calculate the Lehmann representation of the Green function of a Hamiltonian

WARNING : this routine allocates memory (for evalues, evec_red, P0) without liberating it. This memory must be freed by the routines calling this one. This is necessary as the size of these arrays depends on the proceeding of this routine.

Parameters:
  • H – pointer (cast to void) to the struct object to which the multiply-add routine belongs

  • phi – Initial vectors (provided on input. Not modified by the routine except if eigenvectors_flag=true).

  • evalues – Eigenvalues of the reduced Hamiltonian. Allocated inside the routine.

  • evec_red – Eigenvectors of the reduced Hamiltonian. Allocated inside the routine.

  • P0 – matrix of inner products <b[i]|v[j]> (returned on output). Allocated inside the routine.

  • M0 – Number of iterations