TBTK
Classes | Public Member Functions | Public Attributes | List of all members
TBTK::AmplitudeSet Class Reference

#include <AmplitudeSet.h>

Classes

class  Iterator
 

Public Member Functions

 AmplitudeSet ()
 
 ~AmplitudeSet ()
 
void addHA (HoppingAmplitude ha)
 
void addHAAndHC (HoppingAmplitude ha)
 
const std::vector< HoppingAmplitude > * getHAs (Index index) const
 
int getBasisIndex (const Index &index) const
 
int getBasisSize () const
 
bool isProperSubspace (const Index &subspace)
 
void construct ()
 
bool getIsConstructed () const
 
void sort ()
 
void constructCOO ()
 
void destructCOO ()
 
void reconstructCOO ()
 
int getNumMatrixElements () const
 
const int * getCOORowIndices () const
 
const int * getCOOColIndices () const
 
const std::complex< double > * getCOOValues () const
 
AmplitudeSet::Iterator getIterator () const
 
AmplitudeSet::Iterator getIterator (const Index &subspace) const
 
void print ()
 
void tabulate (std::complex< double > **amplitudes, int **indices, int *numHoppingAmplitudes, int *maxIndexSize) const
 

Public Attributes

TreeNode tree
 

Detailed Description

An AmplitudeSet is a container for HoppingAmplitudes . The structure contains the root node for the tree structure in which the HoppingAmplitudes are stored, as well as functions for adding and accessing HoppingAmplitudes. Once all HoppingAmplitudes have been added to the AmplitudeSet, the construct method has to be called in order to construct an appropriate Hilbert space. The AmplitudeSet is most importantly used by the Model to store the Hamiltonian.

Constructor & Destructor Documentation

TBTK::AmplitudeSet::AmplitudeSet ( )

Constructor.

TBTK::AmplitudeSet::~AmplitudeSet ( )

Destructor.

Member Function Documentation

void TBTK::AmplitudeSet::addHA ( HoppingAmplitude  ha)
inline

Add a single HoppingAmplitude.

Parameters
haHoppingAMplitude to add.
void TBTK::AmplitudeSet::addHAAndHC ( HoppingAmplitude  ha)
inline

Add a HoppingAmplitude and its Hermitian conjugate.

Parameters
HoppingAmplitudeto add.
void TBTK::AmplitudeSet::construct ( )
inline

Construct Hilbert space. No more HoppingAmplitudes should be added after this call.

void TBTK::AmplitudeSet::constructCOO ( )

Construct Hamiltonian on COO format.

void TBTK::AmplitudeSet::destructCOO ( )

Destruct Hamiltonian on COO format.

int TBTK::AmplitudeSet::getBasisIndex ( const Index index) const
inline

Get Hilbert space index corresponding to given 'from'-index.

Parameters
index'From'-index to get Hilbert space index for.
int TBTK::AmplitudeSet::getBasisSize ( ) const
inline

Get size of Hilbert space.

const int * TBTK::AmplitudeSet::getCOOColIndices ( ) const
inline

Get col indices on COO format.

const int * TBTK::AmplitudeSet::getCOORowIndices ( ) const
inline

Get row indices on COO format.

const std::complex< double > * TBTK::AmplitudeSet::getCOOValues ( ) const
inline

Get row indices on COO format.

const std::vector< HoppingAmplitude > * TBTK::AmplitudeSet::getHAs ( Index  index) const
inline

Get all HoppingAmplitudes with given 'from'-index.

Parameters
index'From'-index to get HoppingAmplitudes for.
bool TBTK::AmplitudeSet::getIsConstructed ( ) const
inline

Returns true if the Hilbert space basis has been constructed.

AmplitudeSet::Iterator TBTK::AmplitudeSet::getIterator ( ) const

Returns an iterator for iterating through HoppingAmplitudes .

AmplitudeSet::Iterator TBTK::AmplitudeSet::getIterator ( const Index subspace) const

Returns an iterator for iterating through HoppingAmplitudes . The iterator is restricted to the subspace for which the 'from'-index starts with the indices in the argument 'subspace'.

int TBTK::AmplitudeSet::getNumMatrixElements ( ) const

Get number of matrix elements in the Hamiltonian corresponding to the AmplitudeSet.

bool TBTK::AmplitudeSet::isProperSubspace ( const Index subspace)
inline

Returns true if the subspace is a proper subspace. That is, if all indices starting with the indices in 'subspace' only are connected to other indices with the same initial subspace indices.

void TBTK::AmplitudeSet::print ( )

Print tree structure. Mainly for debuging.

void TBTK::AmplitudeSet::reconstructCOO ( )

Reconstruct Hamiltonian on COO format. Only has any effect if a Hamiltonian on COO format already is constructed. Is necessary to reflect changes in the Hamiltonain due to changes in values returned by HoppingAmplitude-callback functions. The function is intended to be called by the Model whenever it is notified of possible changes in values returned by the callback-functions.

void TBTK::AmplitudeSet::sort ( )
inline

Sort HoppingAmplitudes.

void TBTK::AmplitudeSet::tabulate ( std::complex< double > **  amplitudes,
int **  indices,
int *  numHoppingAmplitudes,
int *  maxIndexSize 
) const

Tabulates HoppingAmplitudes to make them possible to export.

Parameters
amplitudesPointer to amplitude table pointer. Memory will be allocated and has to be freed by the user. The array will contain all the HoppingAmplitude values when the function returns.
tablePointer to index table pointer. Memory will be allocated and has to be freed by the user. The array will contain the 'to'- and 'from'-indices for the corresponding HoppingAmplitude values in amplitudes. The values are stored sequentially using the format [to0] [padding] [from0] [padding] [to1] ..., where the padding is added to align 'to'- and 'from'-indices in memory in case multiple index sizes are encounterd. The number of padding elements will be zero for indices of size maxIndexSize and the padding value is -1. The total array size is 2*numHoppingAmplitudes*maxIndexSize.
numHoppingAmplitudesPointer to int that will contain the number of HoppingAMplitudes when the function returns.
maxIndexSizePointer to int that will contain the maximum number of subindices encountered.

Member Data Documentation

TreeNode TBTK::AmplitudeSet::tree

Root node for the tree structure in which HoppingAmplitudes are stored.


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