|
Cytnx v0.9.1
|
A class to represent a scalar. More...
#include <Scalar.hpp>
Public Member Functions | |
| Scalar () | |
| default constructor | |
| Scalar (const cytnx_complex128 &in) | |
| init a Scalar with a cytnx::cytnx_complex128 | |
| Scalar (const cytnx_complex64 &in) | |
| init a Scalar with a cytnx::cytnx_complex64 | |
| Scalar (const cytnx_double &in) | |
| init a Scalar with a cytnx::cytnx_double | |
| Scalar (const cytnx_float &in) | |
| init a Scalar with a cytnx::cytnx_float | |
| Scalar (const cytnx_uint64 &in) | |
| init a Scalar with a cytnx::cytnx_uint64 | |
| Scalar (const cytnx_int64 &in) | |
| init a Scalar with a cytnx::cytnx_int64 | |
| Scalar (const cytnx_uint32 &in) | |
| init a Scalar with a cytnx::cytnx_uint32 | |
| Scalar (const cytnx_int32 &in) | |
| init a Scalar with a cytnx::cytnx_int32 | |
| Scalar (const cytnx_uint16 &in) | |
| init a Scalar with a cytnx::cytnx_uint16 | |
| Scalar (const cytnx_int16 &in) | |
| init a Scalar with a cytnx::cytnx_int16 | |
| Scalar (const cytnx_bool &in) | |
| init a Scalar with a cytnx::cytnx_bool | |
| template<class T > | |
| Scalar (const T &in, const unsigned int &dtype) | |
| The constructor of the Scalar class. | |
| Scalar (const Sproxy &prox) | |
| Scalar (Scalar_base *in) | |
| Scalar (const Scalar &rhs) | |
| The copy constructor of the Scalar class. | |
| Scalar & | operator= (const Scalar &rhs) |
| The copy assignment of the Scalar class. | |
| Scalar & | operator= (const cytnx_complex128 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_complex128 rhs. | |
| Scalar & | operator= (const cytnx_complex64 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_complex64 rhs. | |
| Scalar & | operator= (const cytnx_double &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_double rhs. | |
| Scalar & | operator= (const cytnx_float &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_float rhs. | |
| Scalar & | operator= (const cytnx_uint64 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint64 rhs. | |
| Scalar & | operator= (const cytnx_int64 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int64 rhs. | |
| Scalar & | operator= (const cytnx_uint32 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint32 rhs. | |
| Scalar & | operator= (const cytnx_int32 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int32 rhs. | |
| Scalar & | operator= (const cytnx_uint16 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint16 rhs. | |
| Scalar & | operator= (const cytnx_int16 &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int16 rhs. | |
| Scalar & | operator= (const cytnx_bool &rhs) |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_bool rhs. | |
| Scalar | astype (const unsigned int &dtype) const |
| Type conversion function. | |
| Scalar | conj () const |
| Get the conjugate of the Scalar. That means return \( c^* \) if the Scalar is \( c \). | |
| Scalar | imag () const |
| Get the imaginary part of the Scalar. That means return \( \Im(c) \) if the Scalar is \( c \). | |
| Scalar | real () const |
| Get the real part of the Scalar. That means return \( \Re(c) \) if the Scalar is \( c \). | |
| int | dtype () const |
| Get the dtype of the Scalar (see cytnx::Type for more details). | |
| void | print () const |
| Print the Scalar to the standard output. | |
| operator cytnx_double () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_double. | |
| operator cytnx_float () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_float. | |
| operator cytnx_uint64 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_uint64. | |
| operator cytnx_int64 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_int64. | |
| operator cytnx_uint32 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_uint32. | |
| operator cytnx_int32 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_int32. | |
| operator cytnx_uint16 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_uint16. | |
| operator cytnx_int16 () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_int16. | |
| operator cytnx_bool () const | |
| The explicit casting operator of the Scalar class to cytnx::cytnx_bool. | |
| ~Scalar () | |
| The destructor of the Scalar class. | |
| template<class T > | |
| void | operator+= (const T &rc) |
| The addition assignment operator of the Scalar class with a given number (template). | |
| void | operator+= (const Scalar &rhs) |
| The addition assignment operator of the Scalar class with a given Scalar. | |
| template<class T > | |
| void | operator-= (const T &rc) |
| The subtraction assignment operator of the Scalar class with a given number (template). | |
| void | operator-= (const Scalar &rhs) |
| The subtraction assignment operator of the Scalar class with a given Scalar. | |
| template<class T > | |
| void | operator*= (const T &rc) |
| The multiplication assignment operator of the Scalar class with a given number (template). | |
| void | operator*= (const Scalar &rhs) |
| The multiplication assignment operator of the Scalar class with a given Scalar. | |
| template<class T > | |
| void | operator/= (const T &rc) |
| The division assignment operator of the Scalar class with a given number (template). | |
| void | operator/= (const Scalar &rhs) |
| The division assignment operator of the Scalar class with a given Scalar. | |
| void | iabs () |
| Set the Scalar to absolute value. (inplace) | |
| void | isqrt () |
| Set the Scalar to square root. (inplace) | |
| Scalar | abs () const |
| The member function to get the absolute value of the Scalar. | |
| Scalar | sqrt () const |
| The member function to get the square root of the Scalar. | |
| template<class T > | |
| bool | less (const T &rc) const |
Return whether the current Scalar is less than a given template number rc. | |
| bool | less (const Scalar &rhs) const |
Return whether the current Scalar is less than a given Scalar rhs. | |
| template<class T > | |
| bool | leq (const T &rc) const |
Return whether the current Scalar is less than or equal to a given template number rc. | |
| bool | leq (const Scalar &rhs) const |
Return whether the current Scalar is less than or equal to a given Scalar rhs. | |
| template<class T > | |
| bool | greater (const T &rc) const |
Return whether the current Scalar is greater than a given template number rc. | |
| bool | greater (const Scalar &rhs) const |
Return whether the current Scalar is greater than a given Scalar rhs. | |
| template<class T > | |
| bool | geq (const T &rc) const |
Return whether the current Scalar is greater than or equal to a given template number rc. | |
| bool | geq (const Scalar &rhs) const |
Return whether the current Scalar is greater than or equal to a given Scalar rhs. | |
| template<class T > | |
| bool | eq (const T &rc) const |
Return whether the current Scalar is equal to a given template number rc. | |
| bool | eq (const Scalar &rhs) const |
Return whether the current Scalar is equal to a given Scalar rhs. | |
| template<class T > | |
| Scalar | radd (const T &rc) const |
Return the addition of the current Scalar and a given template number rc. | |
| Scalar | radd (const Scalar &rhs) const |
Return the addition of the current Scalar and a given Scalar rhs. | |
| template<class T > | |
| Scalar | rmul (const T &rc) const |
Return the multiplication of the current Scalar and a given template number rc. | |
| Scalar | rmul (const Scalar &rhs) const |
Return the multiplication of the current Scalar and a given Scalar rhs. | |
| template<class T > | |
| Scalar | rsub (const T &rc) const |
Return the subtraction of the current Scalar and a given template number rc. | |
| Scalar | rsub (const Scalar &rhs) const |
Return the subtraction of the current Scalar and a given Scalar rhs. | |
| template<class T > | |
| Scalar | rdiv (const T &rc) const |
Return the division of the current Scalar and a given template number rc. | |
| Scalar | rdiv (const Scalar &rhs) const |
Return the division of the current Scalar and a given Scalar rhs. | |
Static Public Member Functions | |
| static Scalar | maxval (const unsigned int &dtype) |
Get the max value of the Scalar with the given dtype. | |
| static Scalar | minval (const unsigned int &dtype) |
Get the min value of the Scalar with the given dtype. | |
Public Attributes | |
| Scalar_base * | _impl |
A class to represent a scalar.
This class is used to represent a scalar. You can construct a Scalar by a given value and a dtype (see cytnx::Type for available dtype).
|
inline |
default constructor
|
inline |
init a Scalar with a cytnx::cytnx_complex128
|
inline |
init a Scalar with a cytnx::cytnx_complex64
|
inline |
init a Scalar with a cytnx::cytnx_double
|
inline |
init a Scalar with a cytnx::cytnx_float
|
inline |
init a Scalar with a cytnx::cytnx_uint64
|
inline |
init a Scalar with a cytnx::cytnx_int64
|
inline |
init a Scalar with a cytnx::cytnx_uint32
|
inline |
init a Scalar with a cytnx::cytnx_int32
|
inline |
init a Scalar with a cytnx::cytnx_uint16
|
inline |
init a Scalar with a cytnx::cytnx_int16
|
inline |
init a Scalar with a cytnx::cytnx_bool
|
inline |
The constructor of the Scalar class.
This constructor is used to init a Scalar with a given template value in and dtype (see cytnx::Type).
dtype can be any of the cytnx::Type. | cytnx::Scalar::Scalar | ( | const Sproxy & | prox | ) |
|
inline |
|
inline |
The destructor of the Scalar class.
|
inline |
|
inline |
Type conversion function.
| [in] | dtype | The type of the output Scalar (see cytnx::Type for more details). |
|
inline |
|
inline |
Get the dtype of the Scalar (see cytnx::Type for more details).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the Scalar to absolute value. (inplace)
|
inline |
|
inline |
Set the Scalar to square root. (inplace)
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Get the max value of the Scalar with the given dtype.
This function is used to get the max value of the Scalar with the given dtype. That is, for example, if you want to get the max value of a Scalar with dtype=cytnx::Type.Int16, then you will get the max value of a 16-bit integer 32767.
| dtype | The data type of the Scalar. |
dtype.
|
inlinestatic |
Get the min value of the Scalar with the given dtype.
This function is used to get the min value of the Scalar with the given dtype. That is, for example, if you want to get the min value of a Scalar with dtype=cytnx::Type.Int16, then you will get the min value of a 16-bit integer -32768.
| [in] | dtype | The data type of the Scalar. |
dtype.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_bool.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_double.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_float.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_int16.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_int32.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_int64.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_uint16.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_uint32.
|
inlineexplicit |
The explicit casting operator of the Scalar class to cytnx::cytnx_uint64.
|
inline |
|
inline |
The multiplication assignment operator of the Scalar class with a given number (template).
|
inline |
|
inline |
The addition assignment operator of the Scalar class with a given number (template).
|
inline |
|
inline |
The subtraction assignment operator of the Scalar class with a given number (template).
|
inline |
|
inline |
The division assignment operator of the Scalar class with a given number (template).
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_bool rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_complex128 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_complex64 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_double rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_float rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int16 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int32 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_int64 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint16 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint32 rhs.
|
inline |
The copy assignment operator of the Scalar class with a given number cytnx::cytnx_uint64 rhs.
The copy assignment of the Scalar class.
|
inline |
Print the Scalar to the standard output.
|
inline |
Return the addition of the current Scalar and a given template number rc.
|
inline |
Return the division of the current Scalar and a given template number rc.
rc must not be zero.
|
inline |
|
inline |
Return the multiplication of the current Scalar and a given template number rc.
|
inline |
Return the subtraction of the current Scalar and a given template number rc.
|
inline |
| Scalar_base* cytnx::Scalar::_impl |