|
Cytnx v0.9.1
|
An Enhanced tensor specifically designed for physical Tensor network simulation. More...
#include <UniTensor.hpp>
Public Member Functions | |
| UniTensor (const Tensor &in_tensor, const bool &is_diag=false, const cytnx_int64 &rowrank=-1, const std::string &name="") | |
| Construct a UniTensor from a cytnx::Tensor. | |
| void | Init (const Tensor &in_tensor, const bool &is_diag=false, const cytnx_int64 &rowrank=-1, const std::string &name="") |
| Initialize a UniTensor with cytnx::Tensor. | |
| UniTensor (const std::vector< Bond > &bonds, const std::vector< std::string > &in_labels={}, const cytnx_int64 &rowrank=-1, const unsigned int &dtype=Type.Double, const int &device=Device.cpu, const bool &is_diag=false, const std::string &name="") | |
| Construct a UniTensor. | |
| UniTensor (const std::vector< Bond > &bonds, const std::vector< cytnx_int64 > &in_labels, const cytnx_int64 &rowrank=-1, const unsigned int &dtype=Type.Double, const int &device=Device.cpu, const bool &is_diag=false, const std::string &name="") | |
| void | Init (const std::vector< Bond > &bonds, const std::vector< std::string > &in_labels={}, const cytnx_int64 &rowrank=-1, const unsigned int &dtype=Type.Double, const int &device=Device.cpu, const bool &is_diag=false, const std::string &name="") |
| Initialize the UniTensor with the given arguments. | |
| void | Init (const std::vector< Bond > &bonds, const std::vector< cytnx_int64 > &in_labels, const cytnx_int64 &rowrank=-1, const unsigned int &dtype=Type.Double, const int &device=Device.cpu, const bool &is_diag=false, const std::string &name="") |
| UniTensor & | set_name (const std::string &in) |
| Set the name of the UniTensor. | |
| UniTensor & | set_label (const cytnx_int64 &idx, const cytnx_int64 &new_label, const bool &by_label) |
| UniTensor & | set_label (const cytnx_int64 &idx, const cytnx_int64 &new_label) |
| UniTensor & | set_label (const cytnx_int64 &idx, const std::string &new_label) |
| Set a new label for bond at the assigned index. | |
| UniTensor & | set_label (const cytnx_int64 &idx, const char *new_label) |
| UniTensor & | set_label (const std::string &old_label, const std::string &new_label) |
| set a new label for bond to replace one of the current label. | |
| UniTensor & | set_label (const char *old_label, const std::string &new_label) |
| UniTensor & | set_label (const std::string &old_label, const char *new_label) |
| UniTensor & | set_label (const char *old_label, const char *new_label) |
| UniTensor & | set_labels (const std::vector< cytnx_int64 > &new_labels) |
| change a new label for bond with original label. | |
| UniTensor & | set_labels (const std::vector< std::string > &new_labels) |
| Set new labels for all the bonds. | |
| UniTensor & | set_labels (const std::initializer_list< char * > &new_labels) |
| UniTensor & | set_rowrank (const cytnx_uint64 &new_rowrank) |
| Set the row rank of the UniTensor. | |
| template<class T > | |
| T & | item () |
| Scalar::Sproxy | item () const |
| cytnx_uint64 | Nblocks () const |
| Return the blocks' number. | |
| cytnx_uint64 | rank () const |
| Return the rank of the UniTensor. | |
| cytnx_uint64 | rowrank () const |
| Return the row rank of the UniTensor. | |
| unsigned int | dtype () const |
| Return the data type of the UniTensor. | |
| int | uten_type () const |
| Return the UniTensor type (cytnx::UTenType) of the UniTensor. | |
| int | device () const |
| Return the device of the UniTensor. | |
| std::string | name () const |
| Return the name of the UniTensor. | |
| std::string | dtype_str () const |
| Return the data type of the UniTensor in 'string' form. | |
| std::string | device_str () const |
| Return the device of the UniTensor in 'string' form. | |
| std::string | uten_type_str () const |
| Return the UniTensor type (cytnx::UTenType) of the UniTensor in 'string' form. | |
| bool | is_contiguous () const |
| To tell whether the UniTensor is contiguous. | |
| bool | is_diag () const |
| To tell whether the UniTensor is in diagonal form. | |
| bool | is_tag () const |
| std::vector< Symmetry > | syms () const |
| Return the symmetry type of the UniTensor. | |
| const bool & | is_braket_form () const |
| const std::vector< std::string > & | labels () const |
| Return the labels of the UniTensor. | |
| cytnx_int64 | get_index (std::string lbl) const |
| Get the index of an desired label string. | |
| const std::vector< Bond > & | bonds () const |
| Get the bonds of the UniTensor. | |
| std::vector< Bond > & | bonds () |
| std::vector< cytnx_uint64 > | shape () const |
| Get the shape of the UniTensor. | |
| bool | is_blockform () const |
| void | to_ (const int &device) |
| move the current UniTensor to the assigned device (inplace). | |
| UniTensor | to (const int &device) const |
| move the current UniTensor to the assigned device. | |
| UniTensor | clone () const |
| Clone (deep copy) the UniTensor. | |
| UniTensor | relabels (const std::vector< cytnx_int64 > &new_labels) const |
| UniTensor | relabels (const std::vector< std::string > &new_labels) const |
| rebables all of the labels in UniTensor. | |
| UniTensor | relabels (const std::initializer_list< char * > &new_lbls) const |
| UniTensor | relabel (const cytnx_int64 &inx, const cytnx_int64 &new_label, const bool &by_label=false) const |
| UniTensor | relabel (const cytnx_int64 &inx, const std::string &new_label) const |
| rebable the lags in the UniTensor by given index. | |
| UniTensor | relabel (const std::string &old_label, const std::string &new_label) const |
| rebable the lags in the UniTensor by a given label. | |
| UniTensor | astype (const unsigned int &dtype) const |
| Return a new UniTensor that cast to different data type. | |
| UniTensor | permute (const std::vector< cytnx_int64 > &mapper, const cytnx_int64 &rowrank=-1, const bool &by_label=false) const |
| permute the lags of the UniTensor | |
| UniTensor | permute (const std::vector< std::string > &mapper, const cytnx_int64 &rowrank=-1) const |
| permute the lags of the UniTensor by labels | |
| UniTensor | permute (const std::initializer_list< char * > &mapper, const cytnx_int64 &rowrank=-1) const |
| void | permute_ (const std::vector< cytnx_int64 > &mapper, const cytnx_int64 &rowrank=-1, const bool &by_label=false) |
| permute the lags of the UniTensor, inplacely. | |
| void | permute_ (const std::vector< std::string > &mapper, const cytnx_int64 &rowrank=-1) |
| permute the lags of the UniTensor, inplacely. | |
| UniTensor | contiguous () const |
| Make the UniTensor contiguous by coalescing the memory (storage). | |
| void | contiguous_ () |
| Make the UniTensor contiguous by coalescing the memory (storage), inplacely. | |
| void | print_diagram (const bool &bond_info=false) |
| Plot the diagram of the UniTensor. | |
| void | print_blocks (const bool &full_info=true) const |
| Print all of the blocks in the UniTensor. | |
| void | print_block (const cytnx_int64 &idx, const bool &full_info=true) const |
| Given a index and print out the corresponding block of the UniTensor. | |
| void | group_basis_ () |
| UniTensor | group_basis () const |
| template<class T > | |
| T & | at (const std::vector< cytnx_uint64 > &locator) |
| Get an element at specific location. | |
| template<class T > | |
| const T & | at (const std::vector< cytnx_uint64 > &locator) const |
| Get an element at specific location. | |
| const Scalar::Sproxy | at (const std::vector< cytnx_uint64 > &locator) const |
| Scalar::Sproxy | at (const std::vector< cytnx_uint64 > &locator) |
| Tensor | get_block (const cytnx_uint64 &idx=0) const |
| Get the block of the UniTensor for a given index. | |
| Tensor | get_block (const std::vector< cytnx_int64 > &qnum, const bool &force=false) const |
| Get the block of the UniTensor for the given quantun number. | |
| Tensor | get_block (const std::initializer_list< cytnx_int64 > &qnum, const bool &force=false) const |
| Tensor | get_block (const std::vector< cytnx_uint64 > &qnum, const bool &force=false) const |
| const Tensor & | get_block_ (const cytnx_uint64 &idx=0) const |
| Get the shared view of block for the given index. | |
| Tensor & | get_block_ (const cytnx_uint64 &idx=0) |
| Tensor & | get_block_ (const std::vector< cytnx_int64 > &qnum, const bool &force=false) |
| Get the shared view of block for the given quantum number. | |
| Tensor & | get_block_ (const std::initializer_list< cytnx_int64 > &qnum, const bool &force=false) |
| Tensor & | get_block_ (const std::vector< cytnx_uint64 > &qnum, const bool &force=false) |
| const Tensor & | get_block_ (const std::vector< cytnx_int64 > &qnum, const bool &force=false) const |
| const Tensor & | get_block_ (const std::initializer_list< cytnx_int64 > &qnum, const bool &force=false) const |
| const Tensor & | get_block_ (const std::vector< cytnx_uint64 > &qnum, const bool &force=false) const |
| std::vector< Tensor > | get_blocks () const |
| Get all the blocks of the UniTensor. | |
| const std::vector< Tensor > & | get_blocks_ (const bool &silent=false) const |
| Get all the blocks of the UniTensor, inplacely. | |
| std::vector< Tensor > & | get_blocks_ (const bool &silent=false) |
| void | put_block (const Tensor &in, const cytnx_uint64 &idx=0) |
| Put the block into the UniTensor with given index. | |
| void | put_block (const Tensor &in, const std::vector< cytnx_int64 > &qnum, const bool &force) |
| Put the block into the UniTensor with given quantum number. | |
| void | put_block_ (Tensor &in, const cytnx_uint64 &idx=0) |
| Put the block into the UniTensor with given index, inplacely. | |
| void | put_block_ (Tensor &in, const std::vector< cytnx_int64 > &qnum, const bool &force) |
| Put the block into the UniTensor with given quantum number, inplacely. | |
| UniTensor | get (const std::vector< Accessor > &accessors) const |
| void | set (const std::vector< Accessor > &accessors, const Tensor &rhs) |
| UniTensor | reshape (const std::vector< cytnx_int64 > &new_shape, const cytnx_uint64 &rowrank=0) |
| Reshape the UniTensor. | |
| void | reshape_ (const std::vector< cytnx_int64 > &new_shape, const cytnx_uint64 &rowrank=0) |
| Reshape the UniTensor, inplacely. | |
| UniTensor | to_dense () |
| Convert the UniTensor to non-diagonal form. | |
| void | to_dense_ () |
| Convert the UniTensor to non-diagonal form, inplacely. | |
| void | combineBonds (const std::vector< cytnx_int64 > &indicators, const bool &force, const bool &by_label) |
| void | combineBonds (const std::vector< std::string > &indicators, const bool &force=false) |
| Combine the sevral bonds of the UniTensor. | |
| void | combineBonds (const std::vector< cytnx_int64 > &indicators, const bool &force=false) |
| UniTensor | contract (const UniTensor &inR, const bool &mv_elem_self=false, const bool &mv_elem_rhs=false) const |
| Contract the UniTensor with common labels. | |
| std::vector< Bond > | getTotalQnums (const bool physical=false) const |
| Get the total quantum number of the UniTensor. | |
| std::vector< std::vector< cytnx_int64 > > | get_blocks_qnums () const |
| bool | same_data (const UniTensor &rhs) const |
| UniTensor & | Add_ (const UniTensor &rhs) |
| The addition function of the UniTensor. | |
| UniTensor & | Mul_ (const UniTensor &rhs) |
| The multiplcation function of the UniTensor. | |
| UniTensor & | Sub_ (const UniTensor &rhs) |
| The subtraction function of the UniTensor. | |
| UniTensor & | Div_ (const UniTensor &rhs) |
| The division function of the UniTensor. | |
| UniTensor & | Add_ (const Scalar &rhs) |
| The addition function for a given scalar. | |
| UniTensor & | Mul_ (const Scalar &rhs) |
| The multiplication function for a given scalar. | |
| UniTensor & | Sub_ (const Scalar &rhs) |
| The subtraction function for a given scalar. | |
| UniTensor & | Div_ (const Scalar &rhs) |
| The division function for a given scalar. | |
| UniTensor | Add (const UniTensor &rhs) const |
| The addition function of the UniTensor. | |
| UniTensor | Add (const Scalar &rhs) const |
| The addition function for a given scalar. | |
| UniTensor | Mul (const UniTensor &rhs) const |
| The multiplication function of the UniTensor. | |
| UniTensor | Mul (const Scalar &rhs) const |
| The multiplication function for a given scalar. | |
| UniTensor | Div (const UniTensor &rhs) const |
| The division function of the UniTensor. | |
| UniTensor | Div (const Scalar &rhs) const |
| The division function for a given scalar. | |
| UniTensor | Sub (const UniTensor &rhs) const |
| The subtraction function of the UniTensor. | |
| UniTensor | Sub (const Scalar &rhs) const |
| The subtraction function for a given scalar. | |
| Tensor | Norm () const |
| Return the norm of the UniTensor. | |
| UniTensor & | operator+= (const UniTensor &rhs) |
| The addition assignment operator of the UniTensor. | |
| UniTensor & | operator-= (const UniTensor &rhs) |
| The subtraction assignment operator of the UniTensor. | |
| UniTensor & | operator/= (const UniTensor &rhs) |
| The division assignment operator of the UniTensor. | |
| UniTensor & | operator*= (const UniTensor &rhs) |
| The multiplication assignment operator of the UniTensor. | |
| UniTensor & | operator+= (const Scalar &rhs) |
| The addition assignment operator for a given scalar. | |
| UniTensor & | operator-= (const Scalar &rhs) |
| The subtraction assignment operator for a given scalar. | |
| UniTensor & | operator/= (const Scalar &rhs) |
| The division assignment operator for a given scalar. | |
| UniTensor & | operator*= (const Scalar &rhs) |
| The multiplication assignment operator for a given scalar. | |
| UniTensor | Conj () |
| Apply complex conjugate on each entry of the UniTensor. | |
| UniTensor & | Conj_ () |
| Apply complex conjugate on each entry of the UniTensor. | |
| UniTensor | Transpose () const |
| Take the transpose of the UniTensor. | |
| UniTensor & | Transpose_ () |
| Take the transpose of the UniTensor, inplacely. | |
| UniTensor | normalize () const |
| normalize the current UniTensor instance with 2-norm. | |
| UniTensor & | normalize_ () |
| normalize the UniTensor, inplacely. | |
| UniTensor | Trace (const std::string &a, const std::string &b) const |
| Take the partial trance to the UniTensor. | |
| UniTensor | Trace (const cytnx_int64 &a=0, const cytnx_int64 &b=1) const |
| Take the partial trance to the UniTensor. | |
| UniTensor | Trace (const cytnx_int64 &a, const cytnx_int64 &b, const bool &by_label) const |
| UniTensor & | Trace_ (const std::string &a, const std::string &b) |
| Take the partial trance to the UniTensor, inplacely. | |
| UniTensor & | Trace_ (const cytnx_int64 &a=0, const cytnx_int64 &b=1) |
| Take the partial trance to the UniTensor, inplacely. | |
| UniTensor & | Trace_ (const cytnx_int64 &a, const cytnx_int64 &b, const bool &by_label) |
| UniTensor | Dagger () const |
| Take the conjugate transpose to the UniTensor. | |
| UniTensor & | Dagger_ () |
| Take the conjugate transpose to the UniTensor, inplacely. | |
| UniTensor & | tag () |
| UniTensor | Pow (const double &p) const |
| Power function. | |
| UniTensor & | Pow_ (const double &p) |
| Power function. | |
| bool | elem_exists (const std::vector< cytnx_uint64 > &locator) const |
| template<class T > | |
| T | get_elem (const std::vector< cytnx_uint64 > &locator) const |
| template<class T2 > | |
| void | set_elem (const std::vector< cytnx_uint64 > &locator, const T2 &rc) |
| void | Save (const std::string &fname) const |
| save a UniTensor to file | |
| void | Save (const char *fname) const |
| save a UniTensor to file | |
| UniTensor & | truncate_ (const cytnx_int64 &bond_idx, const cytnx_uint64 &dim, const bool &by_label) |
| UniTensor & | truncate_ (const std::string &bond_idx, const cytnx_uint64 &dim) |
| UniTensor & | truncate_ (const cytnx_int64 &bond_idx, const cytnx_uint64 &dim) |
| UniTensor | truncate (const cytnx_int64 &bond_idx, const cytnx_uint64 &dim, const bool &by_label) const |
| UniTensor | truncate (const std::string &bond_idx, const cytnx_uint64 &dim) const |
| UniTensor | truncate (const cytnx_int64 &bond_idx, const cytnx_uint64 &dim) const |
| const std::vector< cytnx_uint64 > & | get_qindices (const cytnx_uint64 &bidx) const |
| get the q-indices on each leg for the [bidx]-th block | |
| std::vector< cytnx_uint64 > & | get_qindices (const cytnx_uint64 &bidx) |
| get the q-indices on each leg for the [bidx]-th block | |
| const vec2d< cytnx_uint64 > & | get_itoi () const |
| get the q-indices on each leg for all the blocks | |
| vec2d< cytnx_uint64 > & | get_itoi () |
Static Public Member Functions | |
| static UniTensor | Load (const std::string &fname) |
| load a UniTensor from file | |
| static UniTensor | Load (const char *fname) |
| load a UniTensor from file | |
An Enhanced tensor specifically designed for physical Tensor network simulation.
|
inlineexplicit |
Construct a UniTensor from a cytnx::Tensor.
| [in] | in_tensor | a cytnx::Tensor |
| [in] | is_diag | Whther the current UniTensor is a diagonal Tensor. This will requires that the input of in_tensor to be 1D. |
| [in] | rowrank | the rowrank of the outcome UniTensor |
-----------------------
tensor Name :
tensor Rank : 2
block_form : false
is_diag : False
on device : cytnx device: CPU
-------------
/ \
0 ____| 4 |
| |
1 ____| 4 |
\ /
-------------
before:
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
after:
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
[non-share example]
before:
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
after
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 2.34500e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-----------------------
tensor Name :
tensor Rank : 2
block_form : false
is_diag : False
on device : cytnx device: CPU
--------
/ \
0 ____| 4 |
| |
1 ____| 4 |
\ /
--------
before:
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
after
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
[non-share example]
before:
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
after
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
-------- start of print ---------
Tensor name:
Tensor name:
is_diag : False
contiguous : True
Total elem: 16
type : Double (Float64)
cytnx device: CPU
Shape : (4,4)
[[1.45600e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 2.34500e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]
[0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 ]]
|
inline |
Construct a UniTensor.
| [in] | bonds | the bond list. Each bond will be deep copy( not a shared view of bond object with input bond) |
| [in] | in_labels | the labels for each rank(bond) |
| [in] | rowrank | the rank of physical row space. |
| [in] | dtype | the data type of the UniTensor. It can be any type defined in cytnx::Type. |
| [in] | device | the device that the UniTensor is put on. It can be any device defined in cytnx::Device. |
| [in] | is_diag | if the constructed UniTensor is a diagonal UniTensor. This can only be assigned true when the UniTensor is square, untagged and rank-2 UniTensor. |
|
inline |
The addition function for a given scalar.
Given the scalar rhs, it will perform the addition for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to add in the UniTensor. |
The addition function of the UniTensor.
This is addition function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return a new UniTensor
\[ UT = UT_{self} + UT_2 \]
Perform element-wise addition of two UniTensor.
| [in] | rhs | The UniTensor you want to add by. |
The addition function for a given scalar.
Given the Scalar rhs, it will perform the addition for each element in UniTensor with this Scalar rhs.
The addition function of the UniTensor.
This is addition function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return
\[ UT_{self} = UT_{self} + UT_2 \]
Perform element-wise addition of two UniTensor.
| [in] | rhs | The UniTensor you want to add by. |
|
inline |
Return a new UniTensor that cast to different data type.
| [in] | new_type | the new data type. It an be any type defined in cytnx::Type. |
new_type is same as dtype of the original UniTensor, return self.
|
inline |
Get an element at specific location.
| [in] | locator | the location of the element we want to access. |
|
inline |
|
inline |
Get an element at specific location.
| [in] | locator | the location of the element we want to access. |
|
inline |
|
inline |
Get the bonds of the UniTensor.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Make the UniTensor contiguous by coalescing the memory (storage).
|
inline |
Make the UniTensor contiguous by coalescing the memory (storage), inplacely.
|
inline |
Contract the UniTensor with common labels.
This function contract the UniTensor lags with common labels.
| [in] | inR | The UniTensor you want to contract with. |
| [in] | mv_elem_self | |
| [in] | mv_elem_rhs |
|
inline |
|
inline |
|
inline |
|
inline |
The division function for a given scalar.
Given the scalar rhs, it will perform the division for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to divide in the UniTensor. |
The division function of the UniTensor.
This is division function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return a new UniTensor
\[ UT = UT_{self} / UT_2 \]
Perform element-wise division of two UniTensor.
| [in] | rhs | the divisor |
The division function for a given scalar.
Given the scalar rhs, it will perform the division for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to divide in the UniTensor. |
The division function of the UniTensor.
This is division function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return
\[ UT_{self} = UT_{self} / UT_2 \]
Perform element-wise division of two UniTensor.
| [in] | rhs | the divisor |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the block of the UniTensor for the given quantun number.
| [in] | qnum | input the quantum number |
| [in] | force | If force is true, it will return the tensor anyway (Even the corresponding block is empty, it will return void type tensor if force is set as true. Otherwise, it will trow the exception.) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the shared view of block for the given quantum number.
| [in] | qnum | input the quantum number you want to get the corresponding block |
| [in] | force | If force is true, it will return the tensor anyway (Even the corresponding block is empty, it will return void type tensor if force is set as true. Otherwise, it will trow the exception.) |
|
inline |
|
inline |
|
inline |
|
inline |
Get all the blocks of the UniTensor.
get_blocks will return the blocks of the UniTensor. Furthermore,
|
inline |
|
inline |
Get all the blocks of the UniTensor, inplacely.
| [in] | silent | whether need to print out the warning messages. |
|
inline |
|
inline |
|
inline |
Get the index of an desired label string.
| lbl | Label you want to find |
|
inline |
|
inline |
get the q-indices on each leg for all the blocks
|
inline |
get the q-indices on each leg for the [bidx]-th block
| bidx | the bidx-th block in current block list. |
|
inline |
get the q-indices on each leg for the [bidx]-th block
| bidx | the bidx-th block in current block list. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Initialize the UniTensor with the given arguments.
This is the initial function of the UniTensor. If you want to initialize your UniTensor after declaring just a 'void' UniTensor. You can use this function to initialize it.
| [in] | bonds | the bond list. Each bond will be deep copy( not a shared view of bond object with input bond) |
| [in] | in_labels | the labels for each rank(bond) |
| [in] | rowrank | the rank of physical row space |
| [in] | dtype | the dtype of the UniTensor. It can be any type defined in cytnx::Type. |
| [in] | device | the device that the UniTensor is put on. It can be any device defined in cytnx::Device. |
| [in] | is_diag | if the constructed UniTensor is a diagonal UniTensor. This can only be assigned true when the UniTensor is square, untagged and rank-2 UniTensor. |
| [in] | name | user specified name of the UniTensor. |
bonds should be all symmetric or non-symmetric. You cannot mix them.
|
inline |
Initialize a UniTensor with cytnx::Tensor.
| [in] | in_tensor | a cytnx::Tensor |
| [in] | is_diag | if the current UniTensor is a diagonal Tensor. This will requires input of Tensor to be 1D. |
| [in] | rowrank | the rowrank of the outcome UniTensor. |
| [in] | name | user specified name of the UniTensor. |
|
inline |
|
inline |
|
inline |
|
inline |
To tell whether the UniTensor is in diagonal form.
|
inline |
|
inline |
|
inline |
|
inline |
Return the labels of the UniTensor.
|
static |
|
static |
The multiplication function for a given scalar.
Given the scalar rhs, it will perform the multiplication for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to multiply in the UniTensor. |
The multiplication function of the UniTensor.
This is multiplication function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return a new UniTensor
\[ UT = UT_{self} \times UT_2 \]
Perform element-wise multiplcation of two UniTensor.
| [in] | rhs | The UniTensor you want to multiplicate by. |
The multiplication function for a given scalar.
Given the scalar rhs, it will perform the multiplication for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to multiplicate in the UniTensor. |
The multiplcation function of the UniTensor.
This is multiplcation function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return
\[ UT_{self} = UT_{self} \times UT_2 \]
Perform element-wise multiplication of two UniTensor.
| [in] | rhs | The UniTensor you want to multiplcate by. |
|
inline |
Return the name of the UniTensor.
|
inline |
Return the blocks' number.
|
inline |
|
inline |
normalize the current UniTensor instance with 2-norm.
|
inline |
normalize the UniTensor, inplacely.
The multiplication assignment operator for a given scalar.
Given the scalar rhs, it will perform the multiplication for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to multiply in the UniTensor. |
The multiplication assignment operator of the UniTensor.
This is multiplication assignment operator of the UniTensor. It will perform element-wise multiplication and return
\[ UT *= UT_R \]
| [in] | rhs | The UniTensor you want to multilicate by. |
The addition assignment operator for a given scalar.
Given the scalar rhs, it will perform the addition for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to add in the UniTensor. |
The addition assignment operator of the UniTensor.
This is addition assignment operator of the UniTensor. It will perform element-wise addition and return
\[ UT += UT_R \]
| [in] | rhs | The UniTensor you want to add by. |
The subtraction assignment operator for a given scalar.
Given the scalar rhs, it will perform the subtraction for each element in UniTensor with this scalar rhs.
| [in] | rhs | the subtrahend |
The subtraction assignment operator of the UniTensor.
This is subtraction assignment operator of the UniTensor. It will perform element-wise subtraction and return
\[ UT -= UT_R \]
| [in] | rhs | the subtrahend |
The division assignment operator for a given scalar.
Given the scalar rhs, it will perform the division for each element in UniTensor with this scalar rhs.
| [in] | rhs | the divisor |
The division assignment operator of the UniTensor.
This is division assignment operator of the UniTensor. It will perform element-wise division and return
\[ UT /= UT_R \]
| [in] | rhs | the divisor |
|
inline |
|
inline |
permute the lags of the UniTensor
| [in] | mapper | the mapper of the permutation |
| [in] | rowrank | the new rowrank after the permutation |
| [in] | by_label | Whether permute the lags by label. It can only be used if labels are integer form, which will be deprecated soon. |
by_label will be deprecated!
|
inline |
|
inline |
permute the lags of the UniTensor, inplacely.
| [in] | mapper | the mapper by labels |
| [in] | rowrank | the row rank after the permutation |
| [in] | by_label | permute by label or index. |
|
inline |
permute the lags of the UniTensor, inplacely.
| [in] | mapper | the mapper by labels |
| [in] | rowrank | the row rank after the permutation |
| UniTensor cytnx::UniTensor::Pow | ( | const double & | p | ) | const |
| UniTensor & cytnx::UniTensor::Pow_ | ( | const double & | p | ) |
|
inline |
Given a index and print out the corresponding block of the UniTensor.
| [in] | idx | the input index |
| [in] | full_info | whether need to print the full information of the block |
|
inline |
Print all of the blocks in the UniTensor.
| [in] | full_info | whether need to print the full information of the blocks |
|
inline |
|
inline |
|
inline |
|
inline |
Put the block into the UniTensor with given index, inplacely.
|
inline |
Put the block into the UniTensor with given quantum number, inplacely.
|
inline |
Return the rank of the UniTensor.
|
inline |
|
inline |
|
inline |
rebable the lags in the UniTensor by a given label.
| [in] | old_label | original label you want to replace |
| [in] | new_label | the new label |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Reshape the UniTensor, inplacely.
|
inline |
Return the row rank of the UniTensor.
|
inline |
| void cytnx::UniTensor::Save | ( | const char * | fname | ) | const |
save a UniTensor to file
| [in] | fname | the file name (exclude the file extension). |
| void cytnx::UniTensor::Save | ( | const std::string & | fname | ) | const |
save a UniTensor to file
| [in] | fname | the file name (exclude the file extension). |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set a new label for bond at the assigned index.
| [in] | idx | the index of the bond. |
| [in] | new_label | the new label that is assign to the bond. |
|
inline |
|
inline |
set a new label for bond to replace one of the current label.
| [in] | old_label | the current label of the bond. |
| [in] | new_label | the new label that is assign to the bond. |
|
inline |
|
inline |
change a new label for bond with original label.
| old_lbl | the original label of the bond that to be replaced. |
| new_label | the new label that is assign to replace the original label. |
[Note] the new assign label cannot be the same as the label of any other bonds in the UniTensor. ( cannot have duplicate labels )
|
inline |
Set new labels for all the bonds.
| [in] | new_labels | the new labels for each bond. |
|
inline |
|
inline |
|
inline |
Get the shape of the UniTensor.
The subtraction function for a given scalar.
Given the scalar rhs, it will perform the subtraction for each element in UniTensor with this scalar rhs.
| [in] | rhs | the subtrahend |
The subtraction function of the UniTensor.
This is subtraction function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return a new UniTensor
\[ UT = UT_{self} - UT_2 \]
Perform element-wise subtraction of two UniTensor.
| [in] | rhs | the subtrahend |
The subtraction function for a given scalar.
Given the scalar rhs, it will perform the subtraction for each element in UniTensor with this scalar rhs.
| [in] | rhs | a scalar you want to subtract in the UniTensor. |
The subtraction function of the UniTensor.
This is subtraction function of the UniTensor. Given the UniTensor \( UT_2\) as the argument, it will return
\[ UT_{self} = UT_{self} - UT_2 \]
Perform element-wise subtraction of two UniTensor.
| [in] | rhs | the subtrahend |
|
inline |
|
inline |
|
inline |
move the current UniTensor to the assigned device.
| [in] | device | the device-id(cytnx::Device) that is moving to. It can by any device defined in cytnx::Device. |
|
inline |
move the current UniTensor to the assigned device (inplace).
| [in] | device | the device-id(cytnx::Device) that is moving to. It can by any device defined in cytnx::Device. |
|
inline |
Convert the UniTensor to non-diagonal form.
to_dense() convert the UniTensor from diagonal form to non-diagonal structure. That means input the UniTensor with is_diag = true to is_diag = false.
|
inline |
Convert the UniTensor to non-diagonal form, inplacely.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Take the transpose of the UniTensor.
|
inline |
Take the transpose of the UniTensor, inplacely.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the UniTensor type (cytnx::UTenType) of the UniTensor.
The function return the UniTensor type of the UniTensor.
|
inline |
Return the UniTensor type (cytnx::UTenType) of the UniTensor in 'string' form.