TBTK
TBTK::Solver::Diagonalizer Class Reference

Solves a Model using diagonalization. More...

#include <Diagonalizer.h>

Inheritance diagram for TBTK::Solver::Diagonalizer:

## Public Member Functions

Diagonalizer ()

virtual ~Diagonalizer ()

void setSelfConsistencyCallback (bool(*selfConsistencyCallback)(Diagonalizer &diagonalizer))

void setMaxIterations (int maxIterations)

void run ()

const double * getEigenValues ()

double * getEigenValuesRW ()

const std::complex< double > * getEigenVectors ()

std::complex< double > * getEigenVectorsRW ()

const double getEigenValue (int state)

const std::complex< double > getAmplitude (int state, const Index &index)

Public Member Functions inherited from TBTK::Solver::Solver
Solver ()

virtual ~Solver ()

virtual void setModel (Model &model)

ModelgetModel ()

const ModelgetModel () const

Public Member Functions inherited from TBTK::Communicator
Communicator (bool verbose)

void setVerbose (bool verbose)

bool getVerbose () const

Static Public Member Functions inherited from TBTK::Communicator
static void setGlobalVerbose (bool globalVerbose)

static bool getGlobalVerbose ()

## Detailed Description

Solves a Model using diagonalization.

Solves a given model by Diagonalizing the Hamiltonian. The eigenvalues and eigenvectors can then either be directly extracted and used to calculate custom physical quantities, or the PropertyExtractor can be used to extract common properties. Scales as $$O(n^3)$$ with the dimension of the Hilbert space.

## Constructor & Destructor Documentation

 TBTK::Solver::Diagonalizer::Diagonalizer ( )

Constructs a Solver::Diagonalizer.

 virtual TBTK::Solver::Diagonalizer::~Diagonalizer ( )
virtual

Destructor.

## Member Function Documentation

 const std::complex< double > TBTK::Solver::Diagonalizer::getAmplitude ( int state, const Index & index )
inline

Get amplitude for given eigenvector $$n$$ and physical index $$x$$: $$\Psi_{n}(x)$$.

Parameters
 state Eigenstate number $$n$$. index Physical index $$x$$.
Returns
The amplitude $$\Psi_{n}(x)$$.
 const double TBTK::Solver::Diagonalizer::getEigenValue ( int state )
inline

Get eigenvalue for a specific state.

Parameters
 state The state number, ordered in accending order.
Returns
The eigenvalue for the given state.
 const double * TBTK::Solver::Diagonalizer::getEigenValues ( )
inline

Get eigenvalues. Eigenvalues are ordered in accending order.

Returns
A pointer to the internal storage for the eigenvalues.
 double * TBTK::Solver::Diagonalizer::getEigenValuesRW ( )
inline

Get eigenvalues. Eigenvalues are ordered in accending order. Same as getEigenValues(), but with write access. Use with caution.

Returns
A pointer to the internal storage for the eigenvalues.
 const std::complex< double > * TBTK::Solver::Diagonalizer::getEigenVectors ( )
inline

Get eigenvectors. The eigenvectors are stored successively in memory, with the eigenvector corresponding to the smallest eigenvalue occupying the 'basisSize' first positions, the second occupying the next 'basisSize' elements, and so forth, where 'basisSize' is the basis size of the Model.

Returns
A pointer to the internal storage for the eigenvectors.
 std::complex< double > * TBTK::Solver::Diagonalizer::getEigenVectorsRW ( )
inline

Get eigenvectors. The eigenvectors are stored successively in memory, with the eigenvector corresponding to the smallest eigenvalue occupying the 'basisSize' first positions, the second occupying the next 'basisSize' elements, and so forth, where 'basisSize' is the basis size of the Model. Same as getEigenVectors(), but with write access. Use with caution.

Returns
A pointer to the internal storage for the eigenvectors.
 void TBTK::Solver::Diagonalizer::run ( )

Run calculations. Diagonalizes ones if no self-consistency callback have been set, or otherwise multiple times until self-consistencey or maximum number of iterations has been reached.

 void TBTK::Solver::Diagonalizer::setMaxIterations ( int maxIterations )
inline

Set the maximum number of iterations for the self-consistency loop. Only used if Diagonalizer::setSelfConsistencyCallback() has been called with a non-nullptr argument. If the self-consistency callback does not return true, maxIterations determines the maximum number of times it is called.

Parameters
 maxIterations Maximum number of iterations to use in a self-consistent callculation.
 void TBTK::Solver::Diagonalizer::setSelfConsistencyCallback ( bool(*)(Diagonalizer &diagonalizer) selfConsistencyCallback )
inline

Set self-consistency callback. If set to nullptr or never called, the self-consistency loop will not be run.

Parameters
 selfConsistencyCallback A callback function that will be called after the Model has been diagonalized. The function should calculate relevant quantities, modify the Model if necessary, and return false if further iteration is necessary. If true is returned, self-consistency is considered to be reached and the iteration stops.

The documentation for this class was generated from the following file: