TBTK
TBTK::HoppingAmplitudeSet Class Reference

HoppingAmplitude container. More...

#include <HoppingAmplitudeSet.h>

Inheritance diagram for TBTK::HoppingAmplitudeSet:
TBTK::Serializable

Classes

class  Iterator
 

Public Member Functions

 HoppingAmplitudeSet ()
 
 HoppingAmplitudeSet (const std::vector< unsigned int > &capacity)
 
 HoppingAmplitudeSet (const HoppingAmplitudeSet &hoppingAmplitudeSet)
 
 HoppingAmplitudeSet (HoppingAmplitudeSet &&hoppingAmplitudeSet)
 
 HoppingAmplitudeSet (const std::string &serializeation, Mode mode)
 
virtual ~HoppingAmplitudeSet ()
 
HoppingAmplitudeSetoperator= (const HoppingAmplitudeSet &rhs)
 
HoppingAmplitudeSetoperator= (HoppingAmplitudeSet &&rhs)
 
void addHoppingAmplitude (HoppingAmplitude ha)
 
void addHoppingAmplitudeAndHermitianConjugate (HoppingAmplitude ha)
 
const std::vector< HoppingAmplitude > * getHAs (Index index) const
 
int getBasisIndex (const Index &index) const
 
Index getPhysicalIndex (int basisIndex) const
 
int getBasisSize () const
 
bool isProperSubspace (const Index &subspace)
 
IndexTree getSubspaceIndices () const
 
void construct ()
 
bool getIsConstructed () const
 
std::vector< IndexgetIndexList (const Index &pattern) const
 
int getFirstIndexInBlock (const Index &blockIndex) const
 
int getLastIndexInBlock (const Index &blockIndex) 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
 
HoppingAmplitudeSet::Iterator getIterator () const
 
HoppingAmplitudeSet::Iterator getIterator (const Index &subspace) const
 
void print ()
 
void tabulate (std::complex< double > **amplitudes, int **indices, int *numHoppingAmplitudes, int *maxIndexSize) const
 
virtual std::string serialize (Mode mode) const
 
unsigned int getSizeInBytes () const
 

Additional Inherited Members

- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 
- Static Public Member Functions inherited from TBTK::Serializable
static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
- Static Protected Member Functions inherited from TBTK::Serializable
static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
static std::string serialize (bool b, Mode mode)
 
static void deserialize (const std::string &serialization, bool *b, Mode mode)
 
static std::string serialize (int i, Mode mode)
 
static void deserialize (const std::string &serialization, int *i, Mode mode)
 
static std::string serialize (unsigned int u, Mode mode)
 
static void deserialize (const std::string &serialization, unsigned int *u, Mode mode)
 
static std::string serialize (double d, Mode mode)
 
static void deserialize (const std::string &serialization, double *d, Mode mode)
 
static std::string serialize (std::complex< double > c, Mode mode)
 
static void deserialize (const std::string &serialization, std::complex< double > *c, Mode mode)
 
static std::string serialize (Statistics s, Mode mode)
 
static void deserialize (const std::string &serialization, Statistics *s, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Detailed Description

HoppingAmplitude container.

A HoppingAmplitudeSet 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 HoppingAmplitudeSet, the construct method has to be called in order to construct an appropriate Hilbert space. The HoppingAmplitudeSet is most importantly used by the Model to store the Hamiltonian.

Constructor & Destructor Documentation

TBTK::HoppingAmplitudeSet::HoppingAmplitudeSet ( )

Constructor.

TBTK::HoppingAmplitudeSet::HoppingAmplitudeSet ( const std::vector< unsigned int > &  capacity)

Constructor. Preallocates the contained HoppingAmplitudeTree with capacity 'capacity'.

TBTK::HoppingAmplitudeSet::HoppingAmplitudeSet ( const HoppingAmplitudeSet hoppingAmplitudeSet)

Copy constructor.

TBTK::HoppingAmplitudeSet::HoppingAmplitudeSet ( HoppingAmplitudeSet &&  hoppingAmplitudeSet)

Move constructor.

TBTK::HoppingAmplitudeSet::HoppingAmplitudeSet ( const std::string &  serializeation,
Mode  mode 
)

Constructor. Constructs the HoppingAmplitudeSet from a serialization string.

virtual TBTK::HoppingAmplitudeSet::~HoppingAmplitudeSet ( )
virtual

Destructor.

Member Function Documentation

void TBTK::HoppingAmplitudeSet::addHoppingAmplitude ( HoppingAmplitude  ha)
inline

Add a single HoppingAmplitude.

Parameters
haHoppingAmplitude to add.
void TBTK::HoppingAmplitudeSet::addHoppingAmplitudeAndHermitianConjugate ( HoppingAmplitude  ha)
inline

Add a HoppingAmplitude and its Hermitian conjugate.

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

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

void TBTK::HoppingAmplitudeSet::constructCOO ( )

Construct Hamiltonian on COO format.

void TBTK::HoppingAmplitudeSet::destructCOO ( )

Destruct Hamiltonian on COO format.

int TBTK::HoppingAmplitudeSet::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::HoppingAmplitudeSet::getBasisSize ( ) const
inline

Get size of Hilbert space.

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

Get col indices on COO format.

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

Get row indices on COO format.

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

Get row indices on COO format.

int TBTK::HoppingAmplitudeSet::getFirstIndexInBlock ( const Index blockIndex) const
inline

Get first index in block.

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

Get all HoppingAmplitudes with given 'from'-index.

Parameters
index'From'-index to get HoppingAmplitudes for.
std::vector< Index > TBTK::HoppingAmplitudeSet::getIndexList ( const Index pattern) const
inline

Generate a list of indices satisfying the specified pattern.

bool TBTK::HoppingAmplitudeSet::getIsConstructed ( ) const
inline

Returns true if the Hilbert space basis has been constructed.

HoppingAmplitudeSet::Iterator TBTK::HoppingAmplitudeSet::getIterator ( ) const

Returns an iterator for iterating through HoppingAmplitudes .

HoppingAmplitudeSet::Iterator TBTK::HoppingAmplitudeSet::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::HoppingAmplitudeSet::getLastIndexInBlock ( const Index blockIndex) const
inline

Get last index in block.

int TBTK::HoppingAmplitudeSet::getNumMatrixElements ( ) const

Get number of matrix elements in the Hamiltonian corresponding to the HoppingAmplitudeSet. Only used if COO format has been constructed.

Index TBTK::HoppingAmplitudeSet::getPhysicalIndex ( int  basisIndex) const
inline

Get Physical index for given Hilbert space basis index.

unsigned int TBTK::HoppingAmplitudeSet::getSizeInBytes ( ) const
inline

Get size in bytes.

IndexTree TBTK::HoppingAmplitudeSet::getSubspaceIndices ( ) const
inline

Returns an IndexTree containing all subspace indices.

bool TBTK::HoppingAmplitudeSet::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.

HoppingAmplitudeSet& TBTK::HoppingAmplitudeSet::operator= ( const HoppingAmplitudeSet rhs)

Assignment operator.

HoppingAmplitudeSet& TBTK::HoppingAmplitudeSet::operator= ( HoppingAmplitudeSet &&  rhs)

Move assignment operator.

void TBTK::HoppingAmplitudeSet::print ( )

Print tree structure. Mainly for debuging.

void TBTK::HoppingAmplitudeSet::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.

virtual std::string TBTK::HoppingAmplitudeSet::serialize ( Mode  mode) const
virtual
void TBTK::HoppingAmplitudeSet::sort ( )
inline

Sort HoppingAmplitudes.

void TBTK::HoppingAmplitudeSet::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.

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