TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
#include <Subindex.h>
Public Member Functions | |
Subindex () | |
constexpr | Subindex (Integer value) |
constexpr | Subindex (int value) |
constexpr | Subindex (unsigned int value) |
Subindex (const std::string &serialization, Serializable::Mode mode) | |
bool | isWildcard () const |
bool | isLabeledWildcard () const |
Subindex | getWildcardLabel () const |
bool | isSummationIndex () const |
bool | isRangeIndex () const |
bool | isSpinIndex () const |
bool | isIndexSeparator () const |
constexpr | operator int () const |
Subindex & | operator= (Integer rhs) |
Subindex & | operator= (int rhs) |
Subindex & | operator+= (Subindex rhs) |
Subindex & | operator-= (Subindex rhs) |
Subindex & | operator*= (Subindex rhs) |
Subindex & | operator/= (Subindex rhs) |
Subindex & | operator++ () |
Subindex | operator++ (int) |
Subindex & | operator-- () |
Subindex | operator-- (int) |
Subindex | operator() (unsigned int label) const |
std::string | serialize (Serializable::Mode mode) const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Subindex subindex) |
std::istream & | operator>> (std::istream &is, Subindex &subindex) |
void | to_json (nlohmann::json &j, const Subindex &subindex) |
void | from_json (const nlohmann::json &j, Subindex &subindex) |
An entry in an Index.
A Subindex is an integer value with some added functionality and is meant to be an entry in an Index. Conversion between Subindex and int is implicit and the Subindex can therefore for most practical purposes be considered an int.
Subindices can have any value in the range [-16777215, 2147483647]. Values that are more negative than -16777215 (0x00FFFFFF) are reserved for special purposes. The following flags can be used to specify that a given Subindex have a special meaning:
IDX_ALL = _a_
Wildcard indicating that any Subindex value is acceptable. Can also be used when a specific Subindex in an Index has lost meaning. For example, when a Subindex has been summed over, but the resulting quantity retains the same Index structure.
The symbol _a_ is meant to simplify the syntax in application code. However, the more descriptive IDX_ALL should always be used in library code.
IDX_SUM_ALL
Indicates that the Subindex should be summed over.
IDX_SPIN:
Indicates that the Subindex corresponds to a spin Subindex.
IDX_SEPARATOR
Used to separate compound Indices such as {{1, 2}, {3, 4}}, which is stored as {1, 2, IDX_SEPARATOR, 3, 4}.
IDX_ALL_ = aX
Labeled wildcard. Similar to IDX_ALL, but two labeled wildcards with the same label are required to agree. Labels are attached using the notation IDX_ALL_(label). For example, {IDX_ALL_(0), 1, IDX_ALL_(1), IDX_ALL_(0), IDX_ALL_(1)} indicates that all indices of the form {m, 1, n, m, n} are of interest.
The symbol _a_ is meant to simplify the syntax in application code. However, the more descriptive IDX_ALL should always be used in library code.
IDX_X, IDX_Y, IDX_Z
Indicates that the Subindex should be looped over some range. IDX_X, IDX_Y, and IDX_Z indicates the first, second, and third range Subindex, respectively.
The Subindex also have functions for checking whether a given Subindex corresponds to one of the flags above.
|
inline |
Constructor.
|
inlineconstexpr |
Constructor.
value | The value to initilize the Subindex with. |
|
inlineconstexpr |
Constructor.
value | The value to initilize the Subindex with. |
|
inlineconstexpr |
Constructor.
value | The value to initilize the Subindex with. |
|
inline |
|
inline |
Get the label of a labeled wildcard. Exits if the Subindex is not a wildcard.
|
inline |
|
inline |
|
inline |
|
inline |
Check if the Subindex is a spin index (IDX_SPIN).
|
inline |
|
inline |
|
inlineconstexpr |
Type conversion operator.
|
inline |
Function call operator. Used to attach labels to predefined labeled Subindices. For example IDX_ALL_(n) can be used to define an nth labeled wildcard index. The function call fails if the Index is not of a type that supports labels. Note that if the label is so large that it has non-zero bits outside of the non-zero bits of IDX_FLAG_MASK, the highest valued bits will be truncted.
label | The label. |
Multiplication asignment operator.
rhs | The right hand side. |
|
inline |
Increment operator.
|
inline |
Increment operator.
Addition asignment operator.
rhs | The right hand side. |
|
inline |
Decrement operator.
|
inline |
Decrement operator.
Subtraction asignment operator.
rhs | The right hand side. |
Division asignment operator.
rhs | The right hand side. |
|
inline |
|
inline |
Serialize Subindex. Note that Subindex is PseudoSerializable rather than Serializable. This means that the Serializable interface is implemented non-virtually.
mode | Serialization mode. |
|
friend |
Implements the Nlohmann json interface for conversion from json.
j | The json input. |
subindex | The Subindex to convert to. |
|
friend |
ostream operator.
os | The ostream to write to. |
rhs | The Subindex to write. |
|
friend |
istream operator.
os | The istream to read from. |
rhs | The Subindex to read to. |
|
friend |
Implements the Nlohmann json interface for conversion to json.
j | The json output. |
subindex | The Subindex to convert. |