Cytnx v1.0.0
Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions | Variables
cytnx Namespace Reference

Namespaces

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

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...
 

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...
 
enum  SymmetryType : int {
  Void = -99 , U = -1 , Z = 0 , fPar = -2 ,
  fNum = -3
}
 Symmetry type. More...
 
enum  fermionParity : bool { EVEN = false , ODD = true }
 fermionParity 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 a 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)
 
cytnx::UniTensor operator+ (const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
 The addition operator between two UniTensor.
 
template<class T >
cytnx::UniTensor operator+ (const T &lc, const cytnx::UniTensor &Rt)
 The addition operator between a template type and a UniTensor.
 
template<class T >
cytnx::UniTensor operator+ (const cytnx::UniTensor &Lt, const T &rc)
 The addition 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 Contract (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.
 
UniTensor Contracts (const std::vector< UniTensor > &TNs, const std::string &order, const bool &optimal)
 
template<class... T>
UniTensor Contract (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.
 
template<class... T>
UniTensor Contracts (const UniTensor &in, const T &...args, const std::string &order, const bool &optimal)
 

Variables

Device_class Device
 data on which devices.
 
UniTensorType_class UTenType
 UniTensor type.
 

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

◆ fermionParity

enum cytnx::fermionParity : bool

fermionParity

the parity of fermionis EVEN For bosons or an even number of fermions ODD For an even number of fermions

Enumerator
EVEN 
ODD 

◆ SymmetryType

enum cytnx::SymmetryType : int

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
fPar -2, fermionParity symmetry
fNum -3, fermionNumber symmetry
See also
Symmetry::stype(), Symmetry::stype_str()
Enumerator
Void 
fPar 
fNum 

Function Documentation

◆ 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() [1/3]

UniTensor cytnx::Contract ( 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

◆ Contract() [2/3]

template<class... T>
UniTensor cytnx::Contract ( 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

◆ Contract() [3/3]

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 
)

◆ Contracts() [2/2]

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

◆ eye()

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

create a 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().

◆ 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 the linalg::Mod(const cytnx::UniTensor &Lt, const cytnx::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 cytnx::UniTensor &Lt, const cytnx::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 the linalg::Mod(const cytnx::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 cytnx::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 the linalg::Mod(const T &lc, const cytnx::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 cytnx::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 the linalg::Mul(const cytnx::UniTensor &Lt, const cytnx::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 cytnx::UniTensor &Lt, const cytnx::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 the linalg::Mul(const cytnx::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 cytnx::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 the linalg::Mul(const T &lc, const cytnx::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 cytnx::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 addition operator between two UniTensor.

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

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

◆ operator+() [2/8]

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

The addition operator between a UniTensor and a template type.

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

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

◆ operator+() [3/8]

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

The addition operator between a template type and a UniTensor.

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

Parameters
[in]lcThe left template type.
[in]RtThe right UniTensor.
Returns
[UniTensor] The result of the addition.
See also
linalg::Add(const T &lc, const cytnx::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 the linalg::Sub(const cytnx::UniTensor &Lt, const cytnx::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 cytnx::UniTensor &Lt, const cytnx::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 the linalg::Sub(const cytnx::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 cytnx::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 the linalg::Sub(const T &lc, const cytnx::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 cytnx::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 the linalg::Div(const cytnx::UniTensor &Lt, const cytnx::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 cytnx::UniTensor &Lt, const cytnx::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 the linalg::Div(const cytnx::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 cytnx::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 the linalg::Div(const T &lc, const cytnx::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 cytnx::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)

◆ 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

◆ 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

◆ 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
BlockFermionic 3, fermionic UniTensor (block form)
Warning
the type Sparse is deprecated. Use Block instead.
See also
UniTensor::uten_type(), UniTensor::uten_type_str()