|
Cytnx v0.9.4
|
the object contains auxiliary properties for each Tensor rank (bond) More...
#include <Bond.hpp>
Public Member Functions | |
| Bond (const cytnx_uint64 &dim, const bondType &bd_type=bondType::BD_REG) | |
| The constructor of the Bond object. | |
| Bond (const bondType &bd_type, const std::vector< std::vector< cytnx_int64 > > &in_qnums, const std::vector< cytnx_uint64 > °s, const std::vector< Symmetry > &in_syms={}) | |
| The constructor of the Bond object. | |
| Bond (const bondType &bd_type, const std::initializer_list< std::vector< cytnx_int64 > > &in_qnums, const std::vector< cytnx_uint64 > °s, const std::vector< Symmetry > &in_syms={}) | |
| Bond (const bondType &bd_type, const std::vector< cytnx::Qs > &in_qnums, const std::vector< cytnx_uint64 > °s, const std::vector< Symmetry > &in_syms={}) | |
| Bond (const bondType &bd_type, const std::vector< std::pair< std::vector< cytnx_int64 >, cytnx_uint64 > > &in_qnums_dims, const std::vector< Symmetry > &in_syms={}) | |
| void | Init (const cytnx_uint64 &dim, const bondType &bd_type=bondType::BD_REG) |
| init a bond object | |
| void | Init (const bondType &bd_type, const std::vector< std::vector< cytnx_int64 > > &in_qnums, const std::vector< cytnx_uint64 > °s, const std::vector< Symmetry > &in_syms={}) |
| init a bond object | |
| void | Init (const bondType &bd_type, const std::vector< std::pair< std::vector< cytnx_int64 >, cytnx_uint64 > > &in_qnums_dims, const std::vector< Symmetry > &in_syms={}) |
| bondType | type () const |
| return the current bond type (see cytnx::bondType). | |
| const std::vector< std::vector< cytnx_int64 > > & | qnums () const |
| return the current quantum number set(s) by reference | |
| std::vector< std::vector< cytnx_int64 > > & | qnums () |
| std::vector< std::vector< cytnx_int64 > > | qnums_clone () const |
| return the clone (deep copy) of the current quantum number set(s) | |
| cytnx_uint64 | dim () const |
| return the dimension of the bond | |
| cytnx_uint32 | Nsym () const |
| return the number of the symmetries | |
| const std::vector< Symmetry > & | syms () const |
| return the vector of symmetry objects by reference. | |
| std::vector< Symmetry > & | syms () |
| std::vector< Symmetry > | syms_clone () const |
| return copy of the vector of symmetry objects. | |
| Bond & | set_type (const bondType &new_bondType) |
| change the tag-type of the instance Bond | |
| Bond | retype (const bondType &new_bondType) |
| create a new instance of Bond with type changed to the new tag-type. | |
| Bond | redirect () const |
| create a new instance of Bond with type changed in between bondType.BD_BRA / bondType.BD_KET. | |
| Bond & | redirect_ () |
| Change the bond type between bondType.BD_BRA and bondType.BD_KET in the Bond. | |
| void | clear_type () |
| change the tag-type to the default value bondType.BD_REG. | |
| Bond | clone () const |
| return a copy of the instance Bond | |
| void | combineBond_ (const Bond &bd_in, const bool &is_grp=true) |
| Combine the input bond with self, inplacely. | |
| Bond | combineBond (const Bond &bd_in, const bool &is_grp=true) const |
| combine the input bond with self, and return a new combined Bond instance. | |
| Bond | combineBonds (const std::vector< Bond > &bds, const bool &is_grp=true) |
| combine multiple input bonds with self, and return a new combined Bond instance. | |
| void | combineBonds_ (const std::vector< Bond > &bds, const bool &is_grp=true) |
| combine multiple input bonds with self, inplacely | |
| std::vector< std::vector< cytnx_int64 > > | getUniqueQnums (std::vector< cytnx_uint64 > &counts) |
| return a sorted qnum sets by removing all the duplicate qnum sets. | |
| std::vector< std::vector< cytnx_int64 > > | getUniqueQnums () |
| return a sorted qnum sets by removing all the duplicate qnum sets. | |
| cytnx_uint64 | getDegeneracy (const std::vector< cytnx_int64 > &qnum) const |
| return the degeneracy of specify qnum set. | |
| cytnx_uint64 | getDegeneracy (const std::vector< cytnx_int64 > &qnum, std::vector< cytnx_uint64 > &indices) const |
| return the degeneracy of specify qnum set. | |
| std::vector< cytnx_uint64 > & | getDegeneracies () |
| return all degeneracies. | |
| const std::vector< cytnx_uint64 > & | getDegeneracies () const |
| std::vector< cytnx_uint64 > | group_duplicates_ () |
| Group the duplicated quantum number, inplacely. | |
| Bond | group_duplicates (std::vector< cytnx_uint64 > &mapper) const |
| Group the duplicated quantum number and return the new instance of the Bond ojbect. | |
| bool | has_duplicate_qnums () const |
| Check whether there is duplicated quantum numbers in the Bond. | |
| std::vector< std::vector< cytnx_int64 > > | calc_reverse_qnums () |
| Calculate the reverse of the quantum numbers. | |
| void | Save (const std::string &fname) const |
| Save the Bond object to the file. | |
| void | Save (const char *fname) const |
| bool | operator== (const Bond &rhs) const |
| The comparison operator 'equal to'. | |
| bool | operator!= (const Bond &rhs) const |
| The comparison operator 'not equal to'. | |
| Bond | operator* (const Bond &rhs) const |
| The multiplication operator of the Bond object. | |
| Bond & | operator*= (const Bond &rhs) |
| The multiplication assignment operator of the Bond object. | |
Static Public Member Functions | |
| static cytnx::Bond | Load (const std::string &fname) |
| Load the Bond object from the file. | |
| static cytnx::Bond | Load (const char *fname) |
the object contains auxiliary properties for each Tensor rank (bond)
The Bond object is used to construct the bond of the UniTensor.
|
inline |
|
inline |
The constructor of the Bond object.
This function will call Init to do initialization.
| [in] | bd_type | the type (see bondType) of the bond |
| [in] | in_qnums | input the quantum numbers of the bond (for symmetry case) |
| [in] | degs | the degrees of freedom of the bond. |
| [in] | in_syms | input the symmetries of the bond (for symmetry case) |
|
inline |
|
inline |
|
inline |
|
inline |
Calculate the reverse of the quantum numbers.
This function will calculate the reverse of the qunatum numbers by the reverse rule of the Symmetry. See Symmetry.reverse_rule().
|
inline |
change the tag-type to the default value bondType.BD_REG.
|
inline |
return a copy of the instance Bond
Dim = 10 |type: REGULAR 1 0 1 1
Dim = 10 |type: REGULAR True False True True
combine the input bond with self, and return a new combined Bond instance.
| [in] | bd_in | the bond that to be combined. |
| [in] | is_grp | this parameter is only used when the bond is symmetric bond (bondType.BD_BRA or bondType.BD_KET). If is_grp is true, the basis with duplicated quantum number will be grouped together as a single basis. See group_duplicates(std::vector<cytnx_uint64> &mapper) const. |
Dim = 150 |type: KET> Dim = 10 |type: KET> Dim = 15 |type: KET> Dim = 12 |type: <BRA U1:: -5 -4 -2 -1 -1 +0 +1 +2 +3 +4 +5 Z2:: +0 +1 +0 +0 +1 +1 +1 +0 +1 +1 +0 Deg>> 1 1 1 1 1 1 1 2 1 1 1 Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1
Dim = 10 |type: KET> Dim = 15 |type: KET> Dim = 150 |type: KET> Dim = 12 |type: <BRA U1:: -5 -4 -2 -1 -1 +0 +1 +2 +3 +4 +5 Z2:: +0 +1 +0 +0 +1 +1 +1 +0 +1 +1 +0 Deg>> 1 1 1 1 1 1 1 2 1 1 1 Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1
|
inline |
Combine the input bond with self, inplacely.
| [in] | bd_in | the bond that to be combined with self. |
| [in] | is_grp | this parameter is only used when the bond is symmetric bond (bondType.BD_BRA or bondType.BD_KET). If is_grp is true, the basis with duplicated quantum number will be grouped together as a single basis. See group_duplicates(std::vector<cytnx_uint64> &mapper) const. |
Dim = 10 |type: REGULAR Dim = 5 |type: REGULAR Dim = 50 |type: REGULAR Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 12 |type: <BRA U1:: -5 -4 -2 -1 -1 +0 +1 +2 +3 +4 +5 Z2:: +0 +1 +0 +0 +1 +1 +1 +0 +1 +1 +0 Deg>> 1 1 1 1 1 1 1 2 1 1 1
Dim = 10 |type: REGULAR Dim = 5 |type: REGULAR Dim = 50 |type: REGULAR Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 12 |type: <BRA U1:: -5 -4 -2 -1 -1 +0 +1 +2 +3 +4 +5 Z2:: +0 +1 +0 +0 +1 +1 +1 +0 +1 +1 +0 Deg>> 1 1 1 1 1 1 1 2 1 1 1
|
inline |
combine multiple input bonds with self, and return a new combined Bond instance.
| [in] | bds | the bonds that to be combined with self. |
| [in] | is_grp | this parameter is only used when the bond is symmetric bond (bondType.BD_BRA or bondType.BD_KET). If is_grp is true, the basis with duplicated quantum number will be grouped together as a single basis. See group_duplicates(std::vector<cytnx_uint64> &mapper) const. |
Dim = 10 |type: KET> Dim = 4 |type: KET> Dim = 5 |type: KET> Dim = 2 |type: KET> Dim = 400 |type: KET> Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 5 |type: <BRA U1:: +1 -1 -2 +0 Z2:: +1 +1 +0 +0 Deg>> 2 1 1 1 Dim = 60 |type: <BRA U1:: -7 -6 -5 -4 -4 -3 -3 -2 -2 -1 -1 +0 +0 +1 +1 +2 +2 +3 +3 +4 +4 +5 +6 Z2:: +0 +1 +0 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 Deg>> 1 2 2 1 3 3 2 2 2 2 4 5 3 2 4 5 1 2 5 2 2 3 2
Dim = 10 |type: KET> Dim = 4 |type: KET> Dim = 5 |type: KET> Dim = 2 |type: KET> Dim = 400 |type: KET> Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 5 |type: <BRA U1:: +1 -1 -2 +0 Z2:: +1 +1 +0 +0 Deg>> 2 1 1 1 Dim = 60 |type: <BRA U1:: -7 -6 -5 -4 -4 -3 -3 -2 -2 -1 -1 +0 +0 +1 +1 +2 +2 +3 +3 +4 +4 +5 +6 Z2:: +0 +1 +0 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 Deg>> 1 2 2 1 3 3 2 2 2 2 4 5 3 2 4 5 1 2 5 2 2 3 2
|
inline |
combine multiple input bonds with self, inplacely
| [in] | bds | the bonds that to be combined with self. |
| [in] | is_grp | this parameter is only used when the bond is symmetric bond (bondType.BD_BRA or bondType.BD_KET). If is_grp is true, the basis with duplicated quantum number will be grouped together as a single basis. See group_duplicates(std::vector<cytnx_uint64> &mapper) const. |
Dim = 10 |type: KET> Dim = 4 |type: KET> Dim = 5 |type: KET> Dim = 2 |type: KET> Dim = 400 |type: KET> Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 5 |type: <BRA U1:: +1 -1 -2 +0 Z2:: +1 +1 +0 +0 Deg>> 2 1 1 1 Dim = 60 |type: <BRA U1:: -7 -6 -5 -4 -4 -3 -3 -2 -2 -1 -1 +0 +0 +1 +1 +2 +2 +3 +3 +4 +4 +5 +6 Z2:: +0 +1 +0 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 Deg>> 1 2 2 1 3 3 2 2 2 2 4 5 3 2 4 5 1 2 5 2 2 3 2
Dim = 10 |type: KET> Dim = 4 |type: KET> Dim = 5 |type: KET> Dim = 2 |type: KET> Dim = 400 |type: KET> Dim = 3 |type: <BRA U1:: +0 +2 -4 Z2:: +1 +0 +1 Deg>> 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1 Dim = 5 |type: <BRA U1:: +1 -1 -2 +0 Z2:: +1 +1 +0 +0 Deg>> 2 1 1 1 Dim = 60 |type: <BRA U1:: -7 -6 -5 -4 -4 -3 -3 -2 -2 -1 -1 +0 +0 +1 +1 +2 +2 +3 +3 +4 +4 +5 +6 Z2:: +0 +1 +0 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 +0 +1 Deg>> 1 2 2 1 3 3 2 2 2 2 4 5 3 2 4 5 1 2 5 2 2 3 2
|
inline |
return the dimension of the bond
|
inline |
return all degeneracies.
|
inline |
|
inline |
return the degeneracy of specify qnum set.
| [in] | qnum | input the quantum number you want to get the degeneracy. |
@note
if the bond has no symmetries, return 0.
if the degeneracy queried does not exist, return 0, and the indicies is empty
@see
getDegeneracy(const std::vector<cytnx_int64> &qnum,
std::vector<cytnx_uint64> &indices) const.
|
inline |
return the degeneracy of specify qnum set.
| [in] | qnum | input the quantum number you want to get the degeneracy. |
| [out] | indices | output the indices location of the quantum number qnum. |
@note If the bond has no symmetries, return 0. If the degeneracy queried does not exist, return 0, and the indicies is empty. @see getDegeneracy(const std::vector<cytnx_int64> &qnum) const.
|
inline |
return a sorted qnum sets by removing all the duplicate qnum sets.
|
inline |
return a sorted qnum sets by removing all the duplicate qnum sets.
| [out] | counts | output the counts of the unique quantum numbers. |
|
inline |
Group the duplicated quantum number and return the new instance of the Bond ojbect.
This function will group the duplicated quantum number and return the new instance of the Bond object. It will also the mapper, where mapper is about the new index from old index via
new_index = return<cytnx_uint64>[old_index].
| [out] | mapper | the new index from old index via new_index = return<cytnx_uint64>[old_index]. |
|
inline |
Group the duplicated quantum number, inplacely.
This function will group the duplicated quantum number and return the mapper, where mapper is about the new index from old index via
new_index = return<cytnx_uint64>[old_index].
|
inline |
Check whether there is duplicated quantum numbers in the Bond.
This function will check whether there is any duplicated quantum number is the Bond. If yes, return ture. Otherwise, return false.
|
inline |
|
inline |
init a bond object
This function is initialization for symmetry bond case.
| [in] | bd_type | the tag of the bond, it can be bondType.BD_BRA, bondType.BD_KET as physical tagged and cannot be bondType.BD_REG (regular bond). |
| [in] | in_qnums | the quantum number(s) of the bond. it should be a 2d vector with shape (# of unique qnum labels, # of symmetry). |
| [in] | degs | the degeneracy correspond to each qunatum number sets specified in the qnums, the size should match the # of rows of passed-in qnums. |
| [in] | in_syms | a vector of symmetry objects of the bond, the size should match the # of cols of passed-in qnums. [Note] if qnums are provided, the default symmetry type is Symmetry::U1 |
degs need to same as the size of in_qnums.in_qnums and degs cannot be empty.in_qnums MUST have the same size.in_syms is provided, the size of in_syms MUST same as the size of the sub-vector in in_qnums.bd_type cannot be bondType.BD_REG.in_qnums and in_syms need to be consistent. For example, you cannot set the quntum number 2 in Z(2) symmetry.
|
inline |
init a bond object
| [in] | dim | the dimension of the bond (rank) |
| [in] | bd_type | the tag of the bond, it can be BD_BRA, BD_KET as physical tagged; or BD_REG as regular bond (rank) |
details:
@pre
1. \p dim cannot be 0.
The bond can be tagged with bondType.BD_BRA or bondType.BD_KET, or bondType.BD_REG depending on the usage.
Dim = 10 |type: REGULAR Dim = 10 |type: KET> Dim = 4 |type: KET> U1:: +0 +2 -1 +3 Deg>> 1 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1
Dim = 10 |type: REGULAR Dim = 10 |type: KET> Dim = 4 |type: KET> U1:: +0 +2 -1 +3 Deg>> 1 1 1 1 Dim = 4 |type: <BRA U1:: +0 +2 -1 +3 Z2:: +0 +1 +1 +0 Deg>> 1 1 1 1
|
static |
|
static |
Load the Bond object from the file.
| [in] | fname | the file name of the Bond object. |
|
inline |
return the number of the symmetries
| bool cytnx::Bond::operator!= | ( | const Bond & | rhs | ) | const |
The comparison operator 'not equal to'.
The comparison operators to compare two Bonds. More precisely, it is the opposite result of the operator==(const Bond &rhs) const.
The multiplication operator of the Bond object.
The multiplication operator of the Bond means that Combine two Bond. So this operator is same as combineBond. The following code are same result:
The multiplication assignment operator of the Bond object.
The multiplication assignment operator of the Bond means that Combine two Bond inplacely, So this operator is same as combineBond_. The following code are same result:
| bool cytnx::Bond::operator== | ( | const Bond & | rhs | ) | const |
The comparison operator 'equal to'.
The comparison operators to compare two Bonds. If two Bond object are same, return true. Otherwise, return false. This equal to operator will compare all the "value" of the Bond object. Even the Bond object are different object (different address), but they are same "value", it will return true.
|
inline |
|
inline |
return the current quantum number set(s) by reference
|
inline |
|
inline |
create a new instance of Bond with type changed in between bondType.BD_BRA / bondType.BD_KET.
|
inline |
Change the bond type between bondType.BD_BRA and bondType.BD_KET in the Bond.
create a new instance of Bond with type changed to the new tag-type.
| [in] | new_bondType | the new tag-type, it can be bondType.BD_BRA, bondType.BD_KET or bondType.BD_REG. See cytnx::bondType. |
| void cytnx::Bond::Save | ( | const char * | fname | ) | const |
| void cytnx::Bond::Save | ( | const std::string & | fname | ) | const |
Save the Bond object to the file.
Save the Bond object to the file. The file extension will be automatically added as ".cybd".
| [in] | fname | the file name of the Bond object (exclude the file extension). |
change the tag-type of the instance Bond
| [in] | new_bondType | the new tag-type, it can be bondType.BD_BRA, boncType.BD_KET or bondType.BD_REG. See cytnx::bondType. |
|
inline |
|
inline |
return the vector of symmetry objects by reference.
|
inline |
return copy of the vector of symmetry objects.
|
inline |
return the current bond type (see cytnx::bondType).