TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Solver::ArnoldiIterator Class Reference

Solves a Model using Arnoldi iteration. More...

#include <ArnoldiIterator.h>

Inheritance diagram for TBTK::Solver::ArnoldiIterator:
TBTK::Solver::Solver TBTK::Communicator

Public Types

enum  Mode { Normal, ShiftAndInvert }
 

Public Member Functions

 ArnoldiIterator ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
void setNumEigenValues (int numEigenValues)
 
int getNumEigenValues () const
 
void setCalculateEigenVectors (bool calculateEigenVectors)
 
bool getCalculateEigenVectors () const
 
void setNumLanczosVectors (int numLanczosVectors)
 
int getNumLanczosVectors () const
 
void setTolerance (double tolerance)
 
void setMaxIterations (int maxIterations)
 
void setCentralValue (double centralValue)
 
void run ()
 
const CArray< std::complex< double > > & getEigenValues () const
 
const double getEigenValue (int state) const
 
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
 

Additional Inherited Members

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

Detailed Description

Solves a Model using Arnoldi iteration.

The ArnoldiIterator calculates a selected number of eigenvalues and eigenvectors using Arnoldi iteration. Use the PropertyExtractor::ArnoldiIterator to extract Properties.

The ArnoldiIterator is particularly suited for large problems where information from a small energy interval is needed. Compared to the Diagonalizer, the ArnoldiIterator can treat much larger problems as long as only a few eigenvalues or eigenvectors are needed.

Normal mode:
In the normal mode, the ArnoldiIterator calculates eigenvalues and eigenvectors with extremal eigenvalues.

Shift-and-invert mode:
In the shift-and-invert mode, the ArnoldiIterator calculates the eigenvalues and eigenvectors closest to a given "central value".

Example

#include "TBTK/Model.h"
#include "TBTK/PropertyExtractor/ArnoldiIterator.h"
#include "TBTK/Solver/ArnoldiIterator.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
using namespace TBTK;
int main(){
Model model;
for(unsigned int x = 0; x < 200; x++)
model << HoppingAmplitude(1, {x+1}, {x}) + HC;
model.construct();
solver.setVerbose(true);
solver.setModel(model);
solver.setMode(Solver::ArnoldiIterator::Mode::ShiftAndInvert);
solver.setCentralValue(1.0);
solver.setNumEigenValues(10);
solver.setMaxIterations(100);
solver.run();
Streams::out << "----------------\n";
//Print the eigenvalues and the amplitude on site 50.
PropertyExtractor::ArnoldiIterator propertyExtractor(solver);
for(int n = 0; n < 10; n++){
<< propertyExtractor.getEigenValue(n) << "\t"
<< propertyExtractor.getAmplitude(n, {50}) << "\n";
}
}

Output

.......... .......... .......... .......... ..........
......
Number of accurately converged eigenvalues: 10
----------------
0.871769 (-0.0474405,-0.0232819)
0.899657 (0.017597,-0.0148148)
0.927327 (0.0611058,0.0592616)
0.954773 (0.0141037,-0.095402)
0.981988 (0.050148,0.00223721)
1.00897 (0.0149255,-0.0212923)
1.0357 (0.0244087,0.0831764)
1.06218 (-0.0327649,0.089842)
1.08841 (0.0467869,-0.00820977)
1.11437 (0.0259249,0.0129447)

Member Enumeration Documentation

◆ Mode

Enum class describing the different modes of operation.

Normal: Lanczos like iteration for finding extreme eigenvalues and corresponding eigen vectors.

ShiftAndInvert: Shift and invert iteration for finding eigen values around a given value and the corresponding eigen vectors.

Constructor & Destructor Documentation

◆ ArnoldiIterator()

TBTK::Solver::ArnoldiIterator::ArnoldiIterator ( )

Constructs a Solver::ArnoldiIterator.

Member Function Documentation

◆ getAmplitude()

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

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

Parameters
stateEigen state number \(n\).
indexPhysical index \(\).

◆ getCalculateEigenVectors()

bool TBTK::Solver::ArnoldiIterator::getCalculateEigenVectors ( ) const
inline

Get wether eigen vectors are calculated or not.

Returns
True if eigenvectors are set to be calculated.

◆ getEigenValue()

const double TBTK::Solver::ArnoldiIterator::getEigenValue ( int  state) const
inline

Get eigen value.

◆ getEigenValues()

const CArray< std::complex< double > > & TBTK::Solver::ArnoldiIterator::getEigenValues ( ) const
inline

Get eigenValues.

◆ getMode()

ArnoldiIterator::Mode TBTK::Solver::ArnoldiIterator::getMode ( ) const
inline

Get mode of operation.

Returns
The mode of operation.

◆ getNumEigenValues()

int TBTK::Solver::ArnoldiIterator::getNumEigenValues ( ) const
inline

Get number of eigenvalues.

Returns
The number of eigenvalues that are calculated.

◆ getNumLanczosVectors()

int TBTK::Solver::ArnoldiIterator::getNumLanczosVectors ( ) const
inline

Get the number of Lanczos vectors to use. (Dimension of the Krylov space).

Returns
The dimension of the Krylov space used.

◆ run()

void TBTK::Solver::ArnoldiIterator::run ( )

Run the implicitly restarted Arnoldi algorithm.

◆ setCalculateEigenVectors()

void TBTK::Solver::ArnoldiIterator::setCalculateEigenVectors ( bool  calculateEigenVectors)
inline

Set whether eigen vectors should be calculated.

Parameters
calculateEigenVectorsTrue to enable the calculation of eigenvectors.

◆ setCentralValue()

void TBTK::Solver::ArnoldiIterator::setCentralValue ( double  centralValue)
inline

Set amount by which eigenvalues will be shifted during calculations. I.e. the calculation is caried out on \(H -\sigma I\) rather than \(H\). Eigenvalues are shifted back, so this does not affect the eigenvalues. However, since Arnoldi iteration calculates extreme eigenvalues in the normal mode and eigenvalues closest to zero in shift-and-invert mode, it does affect which eigenvalues that are calculated.

Note: The shift is not yet implemented in for the normal mode.

Parameters
centralValueThe value \(\sigma\) by which the Hamiltonian is shifted.

◆ setMaxIterations()

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

Set the maixmum number of iterations in the implicitly restarted Arnoldi algorithm.

Parameters
maxIterationsThe maximum number of iterations performed in the implicitly restarted Arnoldi algorithm.

◆ setMode()

void TBTK::Solver::ArnoldiIterator::setMode ( Mode  mode)
inline

Set mode of operation.

Parameters
modeThe mode of operation to use.

◆ setNumEigenValues()

void TBTK::Solver::ArnoldiIterator::setNumEigenValues ( int  numEigenValues)
inline

Set the number of eigenvalues to calculate.

Parameters
numEigenValuesThe number of eigenvalues to calculate.

◆ setNumLanczosVectors()

void TBTK::Solver::ArnoldiIterator::setNumLanczosVectors ( int  numLanczosVectors)
inline

Set the number of Lanczos vectors to use. (Dimension of the Krylov space).

Parameters
numLanczosVectorsThe dimension of the Krylov space used.

◆ setTolerance()

void TBTK::Solver::ArnoldiIterator::setTolerance ( double  tolerance)
inline

Set the accpeted tolerance. Passed to the ARPACK functions [d/z]naupd and [d/z]neupd. See the TOL parameter in the ARPACK documentation for more information.

Parameters
toleranceTolerance used by ARPACK.

The documentation for this class was generated from the following file:
TBTK::Model
Container of Model related information.
Definition: Model.h:57
Model.h
Container of Model related information.
TBTK::Solver::ArnoldiIterator::setMaxIterations
void setMaxIterations(int maxIterations)
Definition: ArnoldiIterator.h:299
Streams.h
Streams for TBTK output.
TBTK::Solver::ArnoldiIterator::setMode
void setMode(Mode mode)
Definition: ArnoldiIterator.h:263
TBTK::Solver::ArnoldiIterator::run
void run()
TBTK::Solver::ArnoldiIterator
Solves a Model using Arnoldi iteration.
Definition: ArnoldiIterator.h:60
TBTK::Initialize
void Initialize()
TBTK::Solver::Solver::setModel
virtual void setModel(Model &model)
Definition: Solver.h:69
TBTK::Solver::ArnoldiIterator::setCentralValue
void setCentralValue(double centralValue)
Definition: ArnoldiIterator.h:303
TBTK::Solver::ArnoldiIterator::setCalculateEigenVectors
void setCalculateEigenVectors(bool calculateEigenVectors)
Definition: ArnoldiIterator.h:279
TBTK::Solver::ArnoldiIterator::setNumLanczosVectors
void setNumLanczosVectors(int numLanczosVectors)
Definition: ArnoldiIterator.h:287
TBTK::HoppingAmplitude
Hopping amplitude from state 'from' to state 'to'.
Definition: HoppingAmplitude.h:53
TBTK::Solver::ArnoldiIterator::setNumEigenValues
void setNumEigenValues(int numEigenValues)
Definition: ArnoldiIterator.h:271
TBTK::Streams::out
static std::ostream out
Definition: Streams.h:70
TBTK::PropertyExtractor::ArnoldiIterator
Extracts physical properties from the Solver::ArnoldiIterator.
Definition: ArnoldiIterator.h:53
TBTK::Communicator::setVerbose
void setVerbose(bool verbose)
Definition: Communicator.h:98
TBTK::Solver::ArnoldiIterator::ArnoldiIterator
ArnoldiIterator()
TBTK.h
TBTK initialization.
TBTK::Model::construct
void construct()