# davidson_ss Derived Type

## Components

Type Visibility Attributes Name Initial
integer, public :: space_size
integer, public :: space_size_this_proc
integer(kind=MPIArg), public, allocatable :: sizes(:)
integer(kind=MPIArg), public, allocatable :: displs(:)
real(kind=dp), public, allocatable, dimension(:, :) :: basis_vectors
real(kind=dp), public, allocatable :: multiplied_basis_vectors(:,:)
real(kind=dp), public, allocatable :: davidson_eigenvector(:)
real(kind=dp), public, allocatable :: eigenvector_proj(:)
real(kind=dp), public, allocatable :: residual(:)
real(kind=dp), public :: residual_norm
real(kind=dp), public :: davidson_eigenvalue
real(kind=dp), public, allocatable :: projected_hamil(:,:)
real(kind=dp), public, allocatable :: projected_hamil_work(:,:)
real(kind=dp), public, allocatable :: full_vector(:)
integer, public :: run

### Source Code

    type davidson_ss
! Total space size.
integer :: space_size
! Space size on this process.
integer :: space_size_this_proc
! Sizes on each process.
integer(MPIArg), allocatable :: sizes(:)
! Displacements of each section of the vector across processes
integer(MPIArg), allocatable :: displs(:)
! All algorithms for solving large eigenproblems involve a unitary rotation of the
! Hamiltonian into a smaller basis. basis_vectors(:,i) is the ith such unit vector
HElement_t(dp), allocatable, dimension(:, :) :: basis_vectors
! This array stores the basis vectors multiplied by H in its columns, i.e.
! multiplied_basis_vectors(:,1) = H*basis_vector(:,1).
real(dp), allocatable :: multiplied_basis_vectors(:, :)
! By diagonalising the projected Hamiltonian we get an estimate at the ground state in
! the basis of those basis vectors stored in the basis_vectors array. davidson_eigenvector
! stores this same state, but in the *original* basis set. It therefore has a dimension
! the same size as the vector space.
real(dp), allocatable :: davidson_eigenvector(:)
! This array holds the components of davidson_eigenvector in the basis of Krylov vectors.
real(dp), allocatable :: eigenvector_proj(:)
! The residual is defined as r = H*v - E*v, where H is the Hamiltonian matrix, v is the
! ground state estimate (stored in davidson_eigenvector) and E is the corresponding
! energy eigenvalue. If v is an exact eigenstate then all the components of the residual
! are zero.
real(dp), allocatable :: residual(:)
! As noted above, if davidson_eigenvector holds an exact eigenstate then the residual
! will have all zero components and this norm (the standard Euclidean norm) will be zero.
! Hence it is a measure of how converged the solution is.
real(dp) :: residual_norm
real(dp) :: davidson_eigenvalue
! the hamiltonian projected into basis_vectors
real(dp), allocatable :: projected_hamil(:, :)
! we'll usually need some working space for diagonalisation of H in the small basis
real(dp), allocatable :: projected_hamil_work(:, :)
! Temporary space vector which has the same dimension as the *entire* space, rather
! than just the space belonging to this process.
real(dp), allocatable :: full_vector(:)

! On which replica is the semi-stochastic space operating?
integer :: run
end type davidson_ss