TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Node in tree used by HoppingAmplitudeSet to store HoppingAmplitudes . More...
#include <HoppingAmplitudeTree.h>
Classes | |
class | ConstIterator |
class | Iterator |
Public Member Functions | |
HoppingAmplitudeTree () | |
HoppingAmplitudeTree (const std::vector< unsigned int > &capacity) | |
HoppingAmplitudeTree (const std::string &serialization, Mode mode) | |
virtual | ~HoppingAmplitudeTree () |
void | add (HoppingAmplitude ha) |
int | getBasisSize () const |
HoppingAmplitudeTree * | getSubTree (const Index &subspace) |
const HoppingAmplitudeTree * | getSubTree (const Index &subspace) const |
bool | isProperSubspace (const Index &subspace) const |
IndexTree | getSubspaceIndices () const |
Index | getSubspaceIndex (const Index &index) const |
int | getFirstIndexInSubspace (const Index &subspaceIndex) const |
int | getLastIndexInSubspace (const Index &subspaceIndex) const |
const std::vector< HoppingAmplitude > & | getHoppingAmplitudes (Index index) const |
int | getBasisIndex (const Index &index) const |
Index | getPhysicalIndex (int basisIndex) const |
void | generateBasisIndices () |
std::vector< Index > | getIndexList (const Index &pattern) const |
std::vector< Index > | getIndexListMultiplePatterns (const std::vector< Index > &patterns) const |
void | sort (HoppingAmplitudeTree *rootNode) |
void | print () |
Iterator | begin () |
ConstIterator | begin () const |
ConstIterator | cbegin () const |
Iterator | end () |
ConstIterator | end () const |
ConstIterator | cend () const |
virtual std::string | serialize (Mode mode) const |
unsigned int | getSizeInBytes () const |
Public Member Functions inherited from TBTK::Serializable | |
template<> | |
std::string | serialize (const bool &data, Mode mode) |
template<> | |
std::string | serialize (const double &data, Mode mode) |
template<> | |
std::string | serialize (const std::complex< double > &data, Mode mode) |
template<> | |
std::string | serialize (const int &data, Mode mode) |
template<> | |
std::string | serialize (const unsigned int &data, Mode mode) |
template<> | |
std::string | serialize (const SpinMatrix &data, Mode mode) |
template<> | |
std::string | serialize (const Statistics &data, Mode mode) |
template<> | |
std::string | serialize (const std::vector< std::complex< double >> &data, Mode mode) |
template<> | |
int | deserialize (const std::string &serialization, Mode mode) |
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 std::string | extractComponent (const std::string &serialization, const std::string &containerID, const std::string &componentID, const std::string &componentName, 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) |
template<typename DataType > | |
static std::enable_if<!std::is_pointer< DataType >::value, std::string >::type | serialize (const DataType &data, Mode mode) |
template<typename DataType > | |
static std::enable_if< std::is_pointer< DataType >::value, std::string >::type | serialize (const DataType &data, Mode mode) |
template<typename DataType > | |
static DataType | deserialize (const std::string &serialization, Mode mode) |
static std::string | extract (const std::string &serialization, Mode mode, std::string component) |
Node in tree used by HoppingAmplitudeSet to store HoppingAmplitudes .
HoppingAmplitudeTree is a tree structure used to build a tree for stroing HoppingAmplitudes . Used by AmplitudeSet.
TBTK::HoppingAmplitudeTree::HoppingAmplitudeTree | ( | ) |
Constructs a HoppingAmplitudeTree.
TBTK::HoppingAmplitudeTree::HoppingAmplitudeTree | ( | const std::vector< unsigned int > & | capacity | ) |
Constructs a HoppingAmplitudeTree with a preallocated tree structure such that the addition of HoppingAmplitudes with indices that have the same subindex structure as 'capacity', but with smaller subindices will not cause reallocation for the main tree stucture. Internal containers for HoppingAmplitudes may still be reallocated.
capacity | The 'Index capacity'. |
TBTK::HoppingAmplitudeTree::HoppingAmplitudeTree | ( | const std::string & | serialization, |
Mode | mode | ||
) |
Constructor. Constructs the HoppingAmplitudeTree from a serialization string.
serialization | Serialization string from which to construct the Index. |
mode | Mode with which the string has been serialized. |
|
virtual |
Destructor.
void TBTK::HoppingAmplitudeTree::add | ( | HoppingAmplitude | ha | ) |
Add a HoppingAmplitude.
ha | HoppingAmplitude to add. |
|
inline |
Create Iterator.
ConstIterator TBTK::HoppingAmplitudeTree::begin | ( | ) | const |
Create ConstIterator.
|
inline |
Create ConstIterator.
|
inline |
Create ConstIterator pointing to the end.
|
inline |
Create Iterator pointing to the end.
ConstIterator TBTK::HoppingAmplitudeTree::end | ( | ) | const |
Create ConstIterator pointing to the end.
void TBTK::HoppingAmplitudeTree::generateBasisIndices | ( | ) |
Generate Hilbert space indices. No more HoppingAmplitudes should be added after this call.
int TBTK::HoppingAmplitudeTree::getBasisIndex | ( | const Index & | index | ) | const |
Get Hilbert space basis index for given physical index.
index | Physical Index for which to obtain the Hilbert space index. |
|
inline |
Get basis size.
|
inline |
Get first index in subspace.
subspaceIndex | The physical Index of the subspace. |
const std::vector<HoppingAmplitude>& TBTK::HoppingAmplitudeTree::getHoppingAmplitudes | ( | Index | index | ) | const |
Get all HoppingAmplitudes with given 'from'-index.
index | From-Index. |
Generate a list containing the indices in the HoppingAmplitudeTree that satisfies the specified pattern. The indices are ordered in terms of rising Hilbert space indices.
pattern | Pattern to match against. IDX_ALL can be used as a wildcard. |
std::vector<Index> TBTK::HoppingAmplitudeTree::getIndexListMultiplePatterns | ( | const std::vector< Index > & | patterns | ) | const |
Generate a list containing the indices in the HoppingAmplitudeTree that satisfies the specified patterns. The indices are ordered in terms of rising Hilbert space indices.
patterns | Patterns to match against. IDX_ALL can be used as a wildcard. |
|
inline |
Get last index in subspace.
subspaceIndex | The physical Index of the subspace. |
Index TBTK::HoppingAmplitudeTree::getPhysicalIndex | ( | int | basisIndex | ) | const |
|
inline |
Get size in bytes.
IndexTree TBTK::HoppingAmplitudeTree::getSubspaceIndices | ( | ) | const |
HoppingAmplitudeTree* TBTK::HoppingAmplitudeTree::getSubTree | ( | const Index & | subspace | ) |
Get HoppingAmplitudeTree containing the HoppingAmplitudes of the specified subspace. If the original HoppingAMplitudeTree has an Index structure with {subspace, intra subspace indices}, then the new HoppingAmplitudeTree has the Index-structure {intra subspace indices}. This function does not guarantee to return a closed subspace and can contain HoppingAmplitudes to components with other subspace indices if the specified subspace is not a proper subspace. If in doubt, use HoppingAmplitudeTree::isProperSubspace() to check whether a given subspace is a proper subspace before calling this function. Empty subspaces for which no HoppingAmplitudes have been added return empty subspaces.
subspace | A number of subindices that when used as leftmost subindices in an Index specifies a subspace. |
const HoppingAmplitudeTree* TBTK::HoppingAmplitudeTree::getSubTree | ( | const Index & | subspace | ) | const |
Get HoppingAmplitudeTree containing the HoppingAmplitudes of the specified subspace. If the original HoppingAMplitudeTree has an Index structure with {subspace, intra subspace indices}, then the new HoppingAmplitudeTree has the Index-structure {intra subspace indices}. This function does not guarantee to return a closed subspace and can contain HoppingAmplitudes to components with other subspace indices if the specified subspace is not a proper subspace. If in doubt, use HoppingAmplitudeTree::isProperSubspace() to check whether a given subspace is a proper subspace before calling this function. Empty subspaces for which no HoppingAmplitudes have been added return empty subspaces.
subspace | A number of subindices that when used as leftmost subindices in an Index specifies a subspace. |
bool TBTK::HoppingAmplitudeTree::isProperSubspace | ( | const Index & | subspace | ) | const |
Returns true if the subspace is a proper subspace. That is, if the corresponding subtree only contains HoppingAmplitudes that connects states within the subtree (see exception below). Empty subspaces for which no HoppingAmplitudes have been added are considered proper subspaces.
Exception: For a subspace to be considered a proper subspace, each of it subindices needs to completely split the problem into independent parts. For example, for the set of HoppingAmplitudes below, {0, 0, 0} is a proper subspace in the sense that it contains no HoppingAmplitudes to other subspaces. However, the second subindex does not split the problem completely since {0, 0, 1} and {0, 0, 2} belong to the same subspace. In this case {0, 0} therefore is the most specific proper subspace.
HoppingAmplitude(1, {0, 0, 0}, {0, 0, 0});
HoppingAmplitude(1, {0, 0, 1}, {0, 0, 2});
HoppingAmplitude(1, {0, 0, 2}, {0, 0, 1});
subspace | A number of subindices that when used as leftmost subindices in an Index specifies a subspace. |
void TBTK::HoppingAmplitudeTree::print | ( | ) |
Print HoppingAmplitudes . Mainly for debuging purposes.
|
virtual |
Implements Serializable::serialize.
mode | Serialization mode to use. |
Implements TBTK::Serializable.
Reimplemented in TBTK::HoppingAmplitudeSet.
void TBTK::HoppingAmplitudeTree::sort | ( | HoppingAmplitudeTree * | rootNode | ) |
Sort HoppingAmplitudes in row order.