## Documentation for module cp_fm_diag

used for collecting some of the diagonalization shemes available for cp_fm_type. cp_fm_power also moved here as it is very related

source: cp_fm_diag.F

#### public Subroutines/Functions:

Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small systems
...
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B
General Eigenvalue Problem AX = BXE Use canonical diagonalization : U*s**(-1/2)
...
Computes all eigenvalues and vectors of a real symmetric matrix significantly faster than syevx, scales also much better. Needs workspace to allocate all the eigenvectors
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack. If eigenvectors are required this routine will replicate a full matrix on each CPU... if more than a handful of vectors are needed, use cp_fm_syevd instead
Setup the diagonalization library to be used Check of availability not yet fully implemented It should change library to Scalapack if others are not available

#### SUBROUTINEchoose_eigv_solver(matrix, eigenvectors, eigenvalues, info)^

Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small systems

##### Arguments:
 TYPE(cp_fm_type), POINTER :: matrix ... TYPE(cp_fm_type), POINTER :: eigenvectors ... REAL(dp), INTENT(out) :: eigenvalues(:) ... INTEGER, INTENT(out), OPTIONAL :: info ...

#### SUBROUTINEcp_fm_block_jacobi(matrix, eigenvectors, eigval, thresh, start_sec_block)^

...

##### Arguments:
 TYPE(cp_fm_type), POINTER :: matrix ... TYPE(cp_fm_type), POINTER :: eigenvectors ... REAL(dp), INTENT(in) :: eigval(:) ... REAL(dp), INTENT(in) :: thresh ... INTEGER, INTENT(in) :: start_sec_block ...

#### SUBROUTINEcp_fm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work)^

General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B

##### Arguments:
 TYPE(cp_fm_type), POINTER :: amatrix ... TYPE(cp_fm_type), POINTER :: bmatrix ... TYPE(cp_fm_type), POINTER :: eigenvectors ... REAL(dp) :: eigenvalues(:) ... TYPE(cp_fm_type), POINTER :: work ...

#### SUBROUTINEcp_fm_geeig_canon(amatrix, bmatrix, eigenvectors, eigenvalues, work, epseig)^

General Eigenvalue Problem AX = BXE Use canonical diagonalization : U*s**(-1/2)

##### Arguments:
 TYPE(cp_fm_type), POINTER :: amatrix ... TYPE(cp_fm_type), POINTER :: bmatrix ... TYPE(cp_fm_type), POINTER :: eigenvectors ... REAL(dp) :: eigenvalues(:) ... TYPE(cp_fm_type), POINTER :: work ... REAL(dp), INTENT(in) :: epseig ...

#### SUBROUTINEcp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)^

...

##### Arguments:
 TYPE(cp_fm_type), POINTER :: matrix ... TYPE(cp_fm_type), POINTER :: work ... REAL(dp), INTENT(in) :: exponent ... REAL(dp), INTENT(in) :: threshold ... INTEGER, INTENT(out) :: n_dependent ... LOGICAL, INTENT(in), OPTIONAL :: verbose ... REAL(dp), INTENT(out), OPTIONAL :: eigvals(2) ...

#### SUBROUTINEcp_fm_syevd(matrix, eigenvectors, eigenvalues, info)^

Computes all eigenvalues and vectors of a real symmetric matrix significantly faster than syevx, scales also much better. Needs workspace to allocate all the eigenvectors

##### Arguments:
 TYPE(cp_fm_type), POINTER :: matrix ... TYPE(cp_fm_type), POINTER :: eigenvectors ... REAL(dp), INTENT(out) :: eigenvalues(:) ... INTEGER, INTENT(out), OPTIONAL :: info ...

#### SUBROUTINEcp_fm_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx)^

compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack. If eigenvectors are required this routine will replicate a full matrix on each CPU... if more than a handful of vectors are needed, use cp_fm_syevd instead

##### Arguments:
 TYPE(cp_fm_type), POINTER :: matrix ... TYPE(cp_fm_type), POINTER, OPTIONAL :: eigenvectors ... REAL(dp), INTENT(out) :: eigenvalues(:) ... INTEGER, INTENT(in), OPTIONAL :: neig ... REAL(dp), INTENT(in), OPTIONAL :: work_syevx ...

#### SUBROUTINEdiag_init(diag_lib, switched, k_elpa, elpa_qr, elpa_print, elpa_qr_unsafe)^

Setup the diagonalization library to be used Check of availability not yet fully implemented It should change library to Scalapack if others are not available

##### Arguments:
 CHARACTER(*), INTENT(in) :: diag_lib diag_library flag from GLOBAL section in input LOGICAL, INTENT(inout) :: switched ... INTEGER, INTENT(in) :: k_elpa integer that determines which ELPA kernel to use for diagonalization LOGICAL, INTENT(in) :: elpa_qr logical that determines if ELPA should try to use QR to accelerate the diagonalization procedure of suitably sized matrices LOGICAL, INTENT(in) :: elpa_print logical that determines if information about the ELPA diagonalization should be printed LOGICAL, INTENT(in) :: elpa_qr_unsafe logical that enables potentially unsafe ELPA options