Cytnx v0.9.6
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cytnx Namespace Reference

Helper function to print vector with ODT: More...

Namespaces

namespace  algo
 Some basic algorithms API.
 
namespace  linalg
 linear algebra related functions.
 
namespace  operators
 
namespace  physics
 
namespace  random
 The randomization related functions.
 
namespace  stat
 
namespace  tn_algo
 

Classes

class  Accessor
 object that mimic the python slice to access elements in C++ [this is for c++ API only]. More...
 
class  Bond
 the object contains auxiliary properties for each Tensor rank (bond) More...
 
class  LinOp
 
class  Network
 
class  Qs
 
class  Symmetry
 the symmetry object More...
 
class  Tensor
 an tensor (multi-dimensional array) More...
 
class  UniTensor
 An Enhanced tensor specifically designed for physical Tensor network simulation. More...
 

Typedefs

template<class T >
using vec3d = std::vector< std::vector< std::vector< T > > >
 
template<class T >
using vec2d = std::vector< std::vector< T > >
 
typedef double cytnx_double
 
typedef float cytnx_float
 
typedef uint64_t cytnx_uint64
 
typedef uint32_t cytnx_uint32
 
typedef uint16_t cytnx_uint16
 
typedef int64_t cytnx_int64
 
typedef int32_t cytnx_int32
 
typedef int16_t cytnx_int16
 
typedef size_t cytnx_size_t
 
typedef std::complex< float > cytnx_complex64
 
typedef std::complex< double > cytnx_complex128
 
typedef bool cytnx_bool
 

Enumerations

enum  bondType : int {
  BD_KET = -1 , BD_BRA = 1 , BD_REG = 0 , BD_NONE = 0 ,
  BD_IN = -1 , BD_OUT = 1
}
 bond type More...
 

Functions

Tensor zeros (const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an rank-1 Tensor with all the elements are initialized with zero.
 
Tensor zeros (const std::vector< cytnx_uint64 > &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an Tensor with all the elements are initialized with zero.
 
Tensor identity (const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an square rank-2 Tensor with all diagonal to be one.
 
Tensor eye (const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an square rank-2 Tensor with all diagonal to be one.
 
Tensor ones (const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an rank-1 Tensor with all the elements are initialized with one.
 
Tensor ones (const std::vector< cytnx_uint64 > &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an Tensor with all the elements are initialized with one.
 
Tensor arange (const cytnx_int64 &Nelem)
 create an rank-1 Tensor with incremental unsigned integer elements start with [0,Nelem)
 
Tensor arange (const cytnx_double &start, const cytnx_double &end, const cytnx_double &step=1, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 create an rank-1 Tensor with elements defined in range [start,end) with assigned step-size
 
Tensor linspace (const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem, const bool &endpoint=true, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
 
int set_mkl_ilp64 ()
 
int get_mkl_code ()
 
cytnx::UniTensor operator+ (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The addtion operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator+ (const T &lc, const cytnx::UniTensor &Rt)
 The addtion operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator+ (const cytnx::UniTensor &Lt, const T &rc)
 The addtion operator between a UniTensor and a template type.
 
cytnx::UniTensor operator- (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The subtraction operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator- (const T &lc, const cytnx::UniTensor &Rt)
 The subtraction operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator- (const cytnx::UniTensor &Lt, const T &rc)
 The subtraction operator between a UniTensor and a template type.
 
cytnx::UniTensor operator* (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The multiplication operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator* (const T &lc, const cytnx::UniTensor &Rt)
 The multiplication operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator* (const cytnx::UniTensor &Lt, const T &rc)
 The multiplication operator between a UniTensor and a template type.
 
cytnx::UniTensor operator/ (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The division operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator/ (const T &lc, const cytnx::UniTensor &Rt)
 The division operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator/ (const cytnx::UniTensor &Lt, const T &rc)
 The division operator between a UniTensor and a template type.
 
cytnx::UniTensor operator% (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The modulo operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator% (const T &lc, const cytnx::UniTensor &Rt)
 The modulo operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator% (const cytnx::UniTensor &Lt, const T &rc)
 The modulo operator between a UniTensor and a template type.
 
Tensor operator+ (const Tensor &Lt, const Tensor &Rt)
 The addition operator for Tensor.
 
template<class T >
Tensor operator+ (const T &lc, const Tensor &Rt)
 The addition operator between a template type and Tensor.
 
template<class T >
Tensor operator+ (const Tensor &Lt, const T &rc)
 The addition operator between Tensor and a template type.
 
Tensor operator- (const Tensor &Lt, const Tensor &Rt)
 The subtraction operator for Tensor.
 
template<class T >
Tensor operator- (const T &lc, const Tensor &Rt)
 The subtraction operator between a template type and Tensor.
 
template<class T >
Tensor operator- (const Tensor &Lt, const T &rc)
 The subtraction operator between Tensor and a template type.
 
Tensor operator* (const Tensor &Lt, const Tensor &Rt)
 The multiplication operator for Tensor.
 
template<class T >
Tensor operator* (const T &lc, const Tensor &Rt)
 The multiplication operator between a template type and Tensor.
 
template<class T >
Tensor operator* (const Tensor &Lt, const T &rc)
 The multiplication operator between Tensor and a template type.
 
Tensor operator/ (const Tensor &Lt, const Tensor &Rt)
 The division operator for Tensor.
 
template<class T >
Tensor operator/ (const T &lc, const Tensor &Rt)
 The division operator between a template type and Tensor.
 
template<class T >
Tensor operator/ (const Tensor &Lt, const T &rc)
 The division operator between Tensor and a template type.
 
Tensor operator% (const Tensor &Lt, const Tensor &Rt)
 The mode operator for Tensor.
 
template<class T >
Tensor operator% (const T &lc, const Tensor &Rt)
 The mode operator between a template type and Tensor.
 
template<class T >
Tensor operator% (const Tensor &Lt, const T &rc)
 The mode operator between Tensor and a template type.
 
Tensor operator== (const Tensor &Lt, const Tensor &Rt)
 The comparison operator for Tensor.
 
template<class T >
Tensor operator== (const T &lc, const Tensor &Rt)
 The comparison operator between a template type and Tensor.
 
template<class T >
Tensor operator== (const Tensor &Lt, const T &rc)
 The comparison operator between Tensor and a template type.
 
UniTensor ncon (const std::vector< UniTensor > &tensor_list_in, const std::vector< std::vector< cytnx_int64 > > &connect_list_in, const bool check_network=false, const bool optimize=false, std::vector< cytnx_int64 > cont_order=std::vector< cytnx_int64 >(), const std::vector< std::string > &out_labels=std::vector< std::string >())
 
Tensor operator+ (const Tensor &lhs, const Tensor::Tproxy &rhs)
 
Tensor operator- (const Tensor &lhs, const Tensor::Tproxy &rhs)
 
Tensor operator* (const Tensor &lhs, const Tensor::Tproxy &rhs)
 
Tensor operator/ (const Tensor &lhs, const Tensor::Tproxy &rhs)
 
Tensor operator+ (const Tensor &lhs, const Scalar::Sproxy &rhs)
 
Tensor operator- (const Tensor &lhs, const Scalar::Sproxy &rhs)
 
Tensor operator* (const Tensor &lhs, const Scalar::Sproxy &rhs)
 
Tensor operator/ (const Tensor &lhs, const Scalar::Sproxy &rhs)
 
UniTensor Contract (const UniTensor &inL, const UniTensor &inR, const bool &cacheL=false, const bool &cacheR=false)
 Contract two UniTensor by tracing the ranks with common labels.
 
UniTensor Contracts (const std::vector< UniTensor > &TNs, const std::string &order, const bool &optimal)
 Contract multiple UniTensor by tracing the ranks with common labels with pairwise operation.
 
template<class... T>
UniTensor Contracts (const UniTensor &in, const T &...args, const std::string &order, const bool &optimal)
 Contract multiple UniTensor by tracing the ranks with common labels with pairwise operation.
 
bool _fx_compare_vec_inc (const std::vector< cytnx_int64 > &v1, const std::vector< cytnx_int64 > &v2)
 
bool _fx_compare_vec_dec (const std::vector< cytnx_int64 > &v1, const std::vector< cytnx_int64 > &v2)
 

Variables

Device_class Device
 data on which devices.
 
SymmetryType_class SymType
 Symmetry type.
 
Type_class Type
 data type
 
int __blasINTsize__
 
bool User_debug
 
UniTensorType_class UTenType
 UniTensor type.
 

Detailed Description

Helper function to print vector with ODT:

Typedef Documentation

◆ cytnx_bool

typedef bool cytnx::cytnx_bool

◆ cytnx_complex128

typedef std::complex<double> cytnx::cytnx_complex128

◆ cytnx_complex64

typedef std::complex<float> cytnx::cytnx_complex64

◆ cytnx_double

typedef double cytnx::cytnx_double

◆ cytnx_float

typedef float cytnx::cytnx_float

◆ cytnx_int16

typedef int16_t cytnx::cytnx_int16

◆ cytnx_int32

typedef int32_t cytnx::cytnx_int32

◆ cytnx_int64

typedef int64_t cytnx::cytnx_int64

◆ cytnx_size_t

typedef size_t cytnx::cytnx_size_t

◆ cytnx_uint16

typedef uint16_t cytnx::cytnx_uint16

◆ cytnx_uint32

typedef uint32_t cytnx::cytnx_uint32

◆ cytnx_uint64

typedef uint64_t cytnx::cytnx_uint64

◆ vec2d

template<class T >
using cytnx::vec2d = typedef std::vector<std::vector<T> >

◆ vec3d

template<class T >
using cytnx::vec3d = typedef std::vector<std::vector<std::vector<T> >>

Enumeration Type Documentation

◆ bondType

enum cytnx::bondType : int

bond type

This is about the enumeration of the type of the object Bond.

  1. For the UniTensor which is non-symmetry, the corresponding bondType will be set as bondType.BD_REG defaultly. You also can set the bondType as bondType.BD_KET or bondType.BD_BRA if you want to give the UniTensor more physics meaning.
  2. For the UniTensor is symmetry, the corresponding bondType must be bondType.BD_KET or bondType.BD_BRA.
  3. Please note that if you want to do the contraction for symmetric UniTensor, you must make sure that the two bonds you want to contract are one bondType.BD_KET and the other bondType.BD_BRA. Namely, you cannot do the contraction if two bonds are both bondType.BD_KET or both bondType.BD_BRA.
    Note
    currently using gBD_* to indicate this is bond with new qnum structure!
Enumerator
BD_KET 

-1, represent ket state in physics

BD_BRA 

1, represent bra state in physics

BD_REG 

0, only can be used in non-symmetry UniTensor

BD_NONE 

0, same as BD_REG

BD_IN 

-1, same as BD_KET

BD_OUT 

1, same as BD_BRA

Function Documentation

◆ _fx_compare_vec_dec()

bool cytnx::_fx_compare_vec_dec ( const std::vector< cytnx_int64 > &  v1,
const std::vector< cytnx_int64 > &  v2 
)

◆ _fx_compare_vec_inc()

bool cytnx::_fx_compare_vec_inc ( const std::vector< cytnx_int64 > &  v1,
const std::vector< cytnx_int64 > &  v2 
)

◆ arange() [1/2]

Tensor cytnx::arange ( const cytnx_double start,
const cytnx_double end,
const cytnx_double step = 1,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an rank-1 Tensor with elements defined in range [start,end) with assigned step-size

Parameters
startthe start value of the range
endthe end value of the range
stepthe step-size of the range
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

◆ arange() [2/2]

Tensor cytnx::arange ( const cytnx_int64 Nelem)

create an rank-1 Tensor with incremental unsigned integer elements start with [0,Nelem)

Parameters
Nelemthe number of incremental elements to create.
Returns
[Tensor]

◆ Contract()

UniTensor cytnx::Contract ( const UniTensor inL,
const UniTensor inR,
const bool &  cacheL = false,
const bool &  cacheR = false 
)

Contract two UniTensor by tracing the ranks with common labels.

Parameters
[in]inLthe Tensor #1
[in]inRthe Tensor #2
[in]cacheLif the inL should be contiguous align after calling
[in]cacheRif the inR should be contiguous align after calling
Returns
[UniTensor]
See also
cytnx::UniTensor::contract

◆ Contracts() [1/2]

UniTensor cytnx::Contracts ( const std::vector< UniTensor > &  TNs,
const std::string &  order,
const bool &  optimal 
)

Contract multiple UniTensor by tracing the ranks with common labels with pairwise operation.

Parameters
[in]TNsthe Tensors.
[in]orderdesired contraction order.
[in]optimalwheather to find the optimal contraction order automatically.
Returns
[UniTensor]

See also UniTensor.contract

◆ Contracts() [2/2]

template<class... T>
UniTensor cytnx::Contracts ( const UniTensor in,
const T &...  args,
const std::string &  order,
const bool &  optimal 
)

Contract multiple UniTensor by tracing the ranks with common labels with pairwise operation.

Parameters
inthe Tensors.
argsthe Tensors.
Returns
[UniTensor]

See also UniTensor.contract

◆ eye()

Tensor cytnx::eye ( const cytnx_uint64 Dim,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an square rank-2 Tensor with all diagonal to be one.

Parameters
Dimthe dimension of diagonal.
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

Note: This function is a alias of cytnx::identity().

◆ get_mkl_code()

int cytnx::get_mkl_code ( )

◆ identity()

Tensor cytnx::identity ( const cytnx_uint64 Dim,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an square rank-2 Tensor with all diagonal to be one.

Parameters
Dimthe dimension of diagonal.
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

◆ linspace()

Tensor cytnx::linspace ( const cytnx_double start,
const cytnx_double end,
const cytnx_uint64 Nelem,
const bool &  endpoint = true,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

◆ ncon()

UniTensor cytnx::ncon ( const std::vector< UniTensor > &  tensor_list_in,
const std::vector< std::vector< cytnx_int64 > > &  connect_list_in,
const bool  check_network = false,
const bool  optimize = false,
std::vector< cytnx_int64 cont_order = std::vector< cytnx_int64 >(),
const std::vector< std::string > &  out_labels = std::vector< std::string >() 
)

◆ ones() [1/2]

Tensor cytnx::ones ( const cytnx_uint64 Nelem,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an rank-1 Tensor with all the elements are initialized with one.

Parameters
Nelemthe number of elements
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

◆ ones() [2/2]

Tensor cytnx::ones ( const std::vector< cytnx_uint64 > &  Nelem,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an Tensor with all the elements are initialized with one.

Parameters
Nelemthe shape of the Tensor
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

◆ operator%() [1/6]

cytnx::UniTensor cytnx::operator% ( const cytnx::UniTensor Lt,
const cytnx::UniTensor Rt 
)

The modulo operator between two UniTensor.

This is the modulo function for UniTensor. It will call linalg::Mod(const UniTensor &Lt, const UniTensor &Rt) function.

Parameters
[in]LtThe left UniTensor.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the modulo.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Mod(const UniTensor &Lt, const UniTensor &Rt)

◆ operator%() [2/6]

template<class T >
cytnx::UniTensor cytnx::operator% ( const cytnx::UniTensor Lt,
const T &  rc 
)

The modulo operator between a UniTensor and a template type.

This is the modulo function for UniTensor. It will call linalg::Mod(const UniTensor &Lt, const T &rc) function.

Parameters
[in]LtThe left UniTensor.
[in]rcThe right template type.
Returns
[UniTensor] The result of the modulo.
See also
linalg::Mod(const UniTensor &Lt, const T &rc)

◆ operator%() [3/6]

template<class T >
cytnx::UniTensor cytnx::operator% ( const T &  lc,
const cytnx::UniTensor Rt 
)

The modulo operator between a template type and a UniTensor.

This is the modulo function for UniTensor. It will call linalg::Mod(const T &lc, const UniTensor &Rt) function.

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the modulo.
See also
linalg::Mod(const T &lc, const UniTensor &Rt)

◆ operator%() [4/6]

template<class T >
Tensor cytnx::operator% ( const T &  lc,
const Tensor Rt 
)

The mode operator between a template type and Tensor.

This operator call linalg::Mod(const T &lc, const Tensor &Rt) to perform the mode between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of mode.
See also
linalg::Mod(const T &lc, const Tensor &Rt)

◆ operator%() [5/6]

template<class T >
Tensor cytnx::operator% ( const Tensor Lt,
const T &  rc 
)

The mode operator between Tensor and a template type.

This operator call linalg::Mod(const Tensor &Lt, const T &rc) to perform the mode between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of mode.
See also
linalg::Mod(const Tensor &Lt, const T &rc)

◆ operator%() [6/6]

Tensor cytnx::operator% ( const Tensor Lt,
const Tensor Rt 
)

The mode operator for Tensor.

This operator call linalg::Mod(const Tensor &Lt, const Tensor &Rt) to perform the mode.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of mode.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Mod(const Tensor &Lt, const Tensor &Rt)

◆ operator*() [1/8]

cytnx::UniTensor cytnx::operator* ( const cytnx::UniTensor Lt,
const cytnx::UniTensor Rt 
)

The multiplication operator between two UniTensor.

This is the multiplication function for UniTensor. It will call linalg::Mul(const UniTensor &Lt, const UniTensor &Rt) function.

Parameters
[in]LtThe left UniTensor.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the multiplication.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Mul(const UniTensor &Lt, const UniTensor &Rt)

◆ operator*() [2/8]

template<class T >
cytnx::UniTensor cytnx::operator* ( const cytnx::UniTensor Lt,
const T &  rc 
)

The multiplication operator between a UniTensor and a template type.

This is the multiplication function for UniTensor. It will call linalg::Mul(const UniTensor &Lt, const T &rc) function.

Parameters
[in]LtThe left UniTensor.
[in]rcThe right template type.
Returns
[UniTensor] The result of the multiplication.
See also
linalg::Mul(const UniTensor &Lt, const T &rc)

◆ operator*() [3/8]

template<class T >
cytnx::UniTensor cytnx::operator* ( const T &  lc,
const cytnx::UniTensor Rt 
)

The multiplication operator between a template type and a UniTensor.

This is the multiplication function for UniTensor. It will call linalg::Mul(const T &lc, const UniTensor &Rt) function.

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the multiplication.
See also
linalg::Mul(const T &lc, const UniTensor &Rt)

◆ operator*() [4/8]

template<class T >
Tensor cytnx::operator* ( const T &  lc,
const Tensor Rt 
)

The multiplication operator between a template type and Tensor.

This operator call linalg::Mul(const T &lc, const Tensor &Rt) to perform the multiplication between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of multiplication.
See also
linalg::Mul(const T &lc, const Tensor &Rt)

◆ operator*() [5/8]

Tensor cytnx::operator* ( const Tensor lhs,
const Scalar::Sproxy &  rhs 
)

◆ operator*() [6/8]

Tensor cytnx::operator* ( const Tensor lhs,
const Tensor::Tproxy rhs 
)

◆ operator*() [7/8]

template<class T >
Tensor cytnx::operator* ( const Tensor Lt,
const T &  rc 
)

The multiplication operator between Tensor and a template type.

This operator call linalg::Mul(const Tensor &Lt, const T &rc) to perform the multiplication between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of multiplication.
See also
linalg::Mul(const Tensor &Lt, const T &rc)

◆ operator*() [8/8]

Tensor cytnx::operator* ( const Tensor Lt,
const Tensor Rt 
)

The multiplication operator for Tensor.

This operator call linalg::Mul(const Tensor &Lt, const Tensor &Rt) to perform the multiplication.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of multiplication.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Mul(const Tensor &Lt, const Tensor &Rt)

◆ operator+() [1/8]

cytnx::UniTensor cytnx::operator+ ( const cytnx::UniTensor Lt,
const cytnx::UniTensor Rt 
)

The addtion operator between two UniTensor.

This is the addtion function for UniTensor. It will call linalg::Add(const UniTensor &Lt, const UniTensor &Rt) function.

Parameters
[in]LtThe left UniTensor.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the addtion.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Add(const UniTensor &Lt, const UniTensor &Rt)

◆ operator+() [2/8]

template<class T >
cytnx::UniTensor cytnx::operator+ ( const cytnx::UniTensor Lt,
const T &  rc 
)

The addtion operator between a UniTensor and a template type.

This is the addtion function for UniTensor. It will call linalg::Add(const UniTensor &Lt, const T &rc) function.

Parameters
[in]LtThe left UniTensor.
[in]rcThe right template type.
Returns
[UniTensor] The result of the addtion.
See also
linalg::Add(const UniTensor &Lt, const T &rc)

◆ operator+() [3/8]

template<class T >
cytnx::UniTensor cytnx::operator+ ( const T &  lc,
const cytnx::UniTensor Rt 
)

The addtion operator between a template type and a UniTensor.

This is the addtion function for UniTensor. It will call linalg::Add(const T &lc, const UniTensor &Rt) function.

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the addtion.
See also
linalg::Add(const T &lc, const UniTensor &Rt)

◆ operator+() [4/8]

template<class T >
Tensor cytnx::operator+ ( const T &  lc,
const Tensor Rt 
)

The addition operator between a template type and Tensor.

This operator call linalg::Add(const T &lc, const Tensor &Rt) to perform the addition between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of addition.
See also
linalg::Add(const T &lc, const Tensor &Rt)

◆ operator+() [5/8]

Tensor cytnx::operator+ ( const Tensor lhs,
const Scalar::Sproxy &  rhs 
)

◆ operator+() [6/8]

Tensor cytnx::operator+ ( const Tensor lhs,
const Tensor::Tproxy rhs 
)

◆ operator+() [7/8]

template<class T >
Tensor cytnx::operator+ ( const Tensor Lt,
const T &  rc 
)

The addition operator between Tensor and a template type.

This operator call linalg::Add(const Tensor &Lt, const T &rc) to perform the addition between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of addition.
See also
linalg::Add(const Tensor &Lt, const T &rc)

◆ operator+() [8/8]

Tensor cytnx::operator+ ( const Tensor Lt,
const Tensor Rt 
)

The addition operator for Tensor.

This operator call linalg::Add(const Tensor &Lt, const Tensor &Rt) to perform the addition.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of addition.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Add(const Tensor &Lt, const Tensor &Rt)

◆ operator-() [1/8]

cytnx::UniTensor cytnx::operator- ( const cytnx::UniTensor Lt,
const cytnx::UniTensor Rt 
)

The subtraction operator between two UniTensor.

This is the subtraction function for UniTensor. It will call linalg::Sub(const UniTensor &Lt, const UniTensor &Rt) function.

Parameters
[in]LtThe left UniTensor.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the subtraction.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Sub(const UniTensor &Lt, const UniTensor &Rt)

◆ operator-() [2/8]

template<class T >
cytnx::UniTensor cytnx::operator- ( const cytnx::UniTensor Lt,
const T &  rc 
)

The subtraction operator between a UniTensor and a template type.

This is the subtraction function for UniTensor. It will call linalg::Sub(const UniTensor &Lt, const T &rc) function.

Parameters
[in]LtThe left UniTensor.
[in]rcThe right template type.
Returns
[UniTensor] The result of the subtraction.
See also
linalg::Sub(const UniTensor &Lt, const T &rc)

◆ operator-() [3/8]

template<class T >
cytnx::UniTensor cytnx::operator- ( const T &  lc,
const cytnx::UniTensor Rt 
)

The subtraction operator between a template type and a UniTensor.

This is the subtraction function for UniTensor. It will call linalg::Sub(const T &lc, const UniTensor &Rt) function.

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the subtraction.
See also
linalg::Sub(const T &lc, const UniTensor &Rt)

◆ operator-() [4/8]

template<class T >
Tensor cytnx::operator- ( const T &  lc,
const Tensor Rt 
)

The subtraction operator between a template type and Tensor.

This operator call linalg::Sub(const T &lc, const Tensor &Rt) to perform the subtraction between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of subtraction.
See also
linalg::Sub(const T &lc, const Tensor &Rt)

◆ operator-() [5/8]

Tensor cytnx::operator- ( const Tensor lhs,
const Scalar::Sproxy &  rhs 
)

◆ operator-() [6/8]

Tensor cytnx::operator- ( const Tensor lhs,
const Tensor::Tproxy rhs 
)

◆ operator-() [7/8]

template<class T >
Tensor cytnx::operator- ( const Tensor Lt,
const T &  rc 
)

The subtraction operator between Tensor and a template type.

This operator call linalg::Sub(const Tensor &Lt, const T &rc) to perform the subtraction between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of subtraction.
See also
linalg::Sub(const Tensor &Lt, const T &rc)

◆ operator-() [8/8]

Tensor cytnx::operator- ( const Tensor Lt,
const Tensor Rt 
)

The subtraction operator for Tensor.

This operator call linalg::Sub(const Tensor &Lt, const Tensor &Rt) to perform the subtraction.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of subtraction.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Sub(const Tensor &Lt, const Tensor &Rt)

◆ operator/() [1/8]

cytnx::UniTensor cytnx::operator/ ( const cytnx::UniTensor Lt,
const cytnx::UniTensor Rt 
)

The division operator between two UniTensor.

This is the division function for UniTensor. It will call linalg::Div(const UniTensor &Lt, const UniTensor &Rt) function.

Parameters
[in]LtThe left UniTensor.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the division.
Precondition
Lt and Rt must have the same shape.
See also
linalg::Div(const UniTensor &Lt, const UniTensor &Rt)

◆ operator/() [2/8]

template<class T >
cytnx::UniTensor cytnx::operator/ ( const cytnx::UniTensor Lt,
const T &  rc 
)

The division operator between a UniTensor and a template type.

This is the division function for UniTensor. It will call linalg::Div(const UniTensor &Lt, const T &rc) function.

Parameters
[in]LtThe left UniTensor.
[in]rcThe right template type.
Returns
[UniTensor] The result of the division.
See also
linalg::Div(const UniTensor &Lt, const T &rc)

◆ operator/() [3/8]

template<class T >
cytnx::UniTensor cytnx::operator/ ( const T &  lc,
const cytnx::UniTensor Rt 
)

The division operator between a template type and a UniTensor.

This is the division function for UniTensor. It will call linalg::Div(const T &lc, const UniTensor &Rt) function.

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the division.
See also
linalg::Div(const T &lc, const UniTensor &Rt)

◆ operator/() [4/8]

template<class T >
Tensor cytnx::operator/ ( const T &  lc,
const Tensor Rt 
)

The division operator between a template type and Tensor.

This operator call linalg::Div(const T &lc, const Tensor &Rt) to perform the division between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of division.
See also
linalg::Div(const T &lc, const Tensor &Rt)
Precondition
The divisor cannot be zero.

◆ operator/() [5/8]

Tensor cytnx::operator/ ( const Tensor lhs,
const Scalar::Sproxy &  rhs 
)

◆ operator/() [6/8]

Tensor cytnx::operator/ ( const Tensor lhs,
const Tensor::Tproxy rhs 
)

◆ operator/() [7/8]

template<class T >
Tensor cytnx::operator/ ( const Tensor Lt,
const T &  rc 
)

The division operator between Tensor and a template type.

This operator call linalg::Div(const Tensor &Lt, const T &rc) to perform the division between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of division.
See also
linalg::Div(const Tensor &Lt, const T &rc)
Precondition
The divisor cannot be zero.

◆ operator/() [8/8]

Tensor cytnx::operator/ ( const Tensor Lt,
const Tensor Rt 
)

The division operator for Tensor.

This operator call linalg::Div(const Tensor &Lt, const Tensor &Rt) to perform the division.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of division.
See also
linalg::Div(const Tensor &Lt, const Tensor &Rt)
Precondition
  1. The divisor cannot be zero.
  2. Lt and Rt must have the same shape.

◆ operator==() [1/3]

template<class T >
Tensor cytnx::operator== ( const T &  lc,
const Tensor Rt 
)

The comparison operator between a template type and Tensor.

This operator call linalg::Cpr(const T &lc, const Tensor &Rt) to perform the comparison between a template type and Tensor.

Parameters
[in]lcLeft template type.
[in]RtRight Tensor.
Returns
[Tensor] the result of comparison.
See also
linalg::Cpr(const T &lc, const Tensor &Rt)

◆ operator==() [2/3]

template<class T >
Tensor cytnx::operator== ( const Tensor Lt,
const T &  rc 
)

The comparison operator between Tensor and a template type.

This operator call linalg::Cpr(const Tensor &Lt, const T &rc) to perform the comparison between Tensor and a template type.

Parameters
[in]LtLeft Tensor.
[in]rcRight template type.
Returns
[Tensor] the result of comparison.
See also
linalg::Cpr(const Tensor &Lt, const T &rc)

◆ operator==() [3/3]

Tensor cytnx::operator== ( const Tensor Lt,
const Tensor Rt 
)

The comparison operator for Tensor.

This operator call linalg::Cpr(const Tensor &Lt, const Tensor &Rt) to perform the comparison.

Parameters
[in]LtLeft Tensor.
[in]RtRight Tensor.
Returns
[Tensor] the result of comparison.
See also
linalg::Cpr(const Tensor &Lt, const Tensor &Rt)

◆ set_mkl_ilp64()

int cytnx::set_mkl_ilp64 ( )

◆ zeros() [1/2]

Tensor cytnx::zeros ( const cytnx_uint64 Nelem,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an rank-1 Tensor with all the elements are initialized with zero.

Parameters
Nelemthe number of elements
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

◆ zeros() [2/2]

Tensor cytnx::zeros ( const std::vector< cytnx_uint64 > &  Nelem,
const unsigned int &  dtype = Type.Double,
const int &  device = Device.cpu 
)

create an Tensor with all the elements are initialized with zero.

Parameters
Nelemthe shape of the Tensor
dtypethe dtype of the Tensor. It can be any type defined in cytnx::Type
devicethe device that the Tensor is put on. It can be any device defined in cytnx::Device
Returns
[Tensor]

Variable Documentation

◆ __blasINTsize__

int cytnx::__blasINTsize__
extern

◆ Device

Device_class cytnx::Device
extern

data on which devices.

This is the variable about the data on which devices .
You can use it as following:

int device = Device.cpu;
Device_class Device
data on which devices.

The supported enumerations are as following:

enumeration description
cpu -1, on cpu
cuda 0, on cuda

◆ SymType

SymmetryType_class cytnx::SymType
extern

Symmetry type.

It is about the type of the Symmetry object The supported enumerations are as following:

enumeration description
Void -99, void type (that means not initialized)
U -1, U1 symmetry
Z 0, Zn symmetry
See also
Symmetry::stype(), Symmetry::stype_str()

◆ Type

Type_class cytnx::Type
extern

data type

This is the variable about the data type of the UniTensor, Tensor, ... .
You can use it as following:

int type = Type.Double;
Type_class Type
data type

The supported enumerations are as following:

enumeration description
Void the data type is void (nothing)
ComplexDouble complex double type with 128 bits
ComplexFloat complex float type with 64 bits
Double double float type with 64 bits
Float single float type with 32 bits
Int64 long long integer type with 64 bits
Uint64 unsigned long long integer type with 64 bits
Int32 integer type with 32 bits
Uint32 unsigned integer type with 32 bits
Int16 short integer type with 16 bits
Uint16 undigned short integer with 16 bits
Bool boolean type

◆ User_debug

bool cytnx::User_debug
extern

◆ UTenType

UniTensorType_class cytnx::UTenType
extern

UniTensor type.

It is about the type of the UniTensor.
The supported enumerations are as following:

enumeration description
Void -1, void UniTensor
Dense 0, dense UniTensor
Sparse 1, sparse UniTensor (deprecated)
Block 2, block UniTensor
Warning
the type Sparse is deprecated. Use Block instead.
See also
UniTensor::uten_type(), UniTensor::uten_type_str()