9#include <initializer_list>
29 Scalar_base(): _dtype(
Type.Void){};
31 virtual cytnx_float to_cytnx_float()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
32 virtual cytnx_double to_cytnx_double()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
35 virtual cytnx_int64 to_cytnx_int64()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
36 virtual cytnx_uint64 to_cytnx_uint64()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
37 virtual cytnx_int32 to_cytnx_int32()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
38 virtual cytnx_uint32 to_cytnx_uint32()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
39 virtual cytnx_int16 to_cytnx_int16()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
40 virtual cytnx_uint16 to_cytnx_uint16()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;};
41 virtual cytnx_bool to_cytnx_bool()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot cast to anytype!!%s",
"\n");
return 0;}
43 virtual void iadd(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
44 virtual void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
45 virtual void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
46 virtual void iadd(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
47 virtual void iadd(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
48 virtual void iadd(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
49 virtual void iadd(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
50 virtual void iadd(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
51 virtual void iadd(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
52 virtual void iadd(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
53 virtual void iadd(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
54 virtual void iadd(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
56 virtual void isub(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
57 virtual void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
58 virtual void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
59 virtual void isub(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
60 virtual void isub(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
61 virtual void isub(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
62 virtual void isub(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
63 virtual void isub(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
64 virtual void isub(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
65 virtual void isub(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
66 virtual void isub(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
67 virtual void isub(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
69 virtual void imul(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
70 virtual void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
71 virtual void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
72 virtual void imul(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
73 virtual void imul(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
74 virtual void imul(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
75 virtual void imul(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
76 virtual void imul(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
77 virtual void imul(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
78 virtual void imul(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
79 virtual void imul(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
80 virtual void imul(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
82 virtual void idiv(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
83 virtual void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
84 virtual void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
85 virtual void idiv(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
86 virtual void idiv(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
87 virtual void idiv(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
88 virtual void idiv(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
89 virtual void idiv(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
90 virtual void idiv(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
91 virtual void idiv(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
92 virtual void idiv(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
93 virtual void idiv(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
96 virtual bool less(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
97 virtual bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
98 virtual bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
99 virtual bool less(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
100 virtual bool less(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
101 virtual bool less(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
102 virtual bool less(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
103 virtual bool less(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
104 virtual bool less(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
105 virtual bool less(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
106 virtual bool less(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
107 virtual bool less(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
109 virtual bool greater(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
110 virtual bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
111 virtual bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
112 virtual bool greater(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
113 virtual bool greater(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
114 virtual bool greater(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
115 virtual bool greater(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
116 virtual bool greater(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
117 virtual bool greater(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
118 virtual bool greater(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
119 virtual bool greater(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
120 virtual bool greater(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
124 virtual void iabs(){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
126 virtual void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
127 virtual void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
128 virtual void assign_selftype(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
129 virtual void assign_selftype(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
130 virtual void assign_selftype(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
131 virtual void assign_selftype(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
132 virtual void assign_selftype(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
133 virtual void assign_selftype(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
134 virtual void assign_selftype(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
135 virtual void assign_selftype(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
136 virtual void assign_selftype(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");}
138 virtual Scalar_base* astype(
const unsigned int &dtype){
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");
return nullptr;}
140 virtual void* get_raw_address()
const{
cytnx_error_msg(
true,
"[ERROR] Void Type Scalar cannot have operation!!%s",
"\n");
return nullptr;}
142 virtual void print(std::ostream& os)
const{};
143 virtual Scalar_base* copy()
const{
144 Scalar_base *tmp =
new Scalar_base();
153 typedef Scalar_base* (*pScalar_init)();
157 class Scalar_init_interface:
public Type_class{
159 std::vector<pScalar_init> UScIInit;
160 Scalar_init_interface();
162 extern Scalar_init_interface
__ScII;
166 class ComplexDoubleScalar:
public Scalar_base{
171 ComplexDoubleScalar(): _elem(0){this->_dtype =
Type.ComplexDouble;};
172 ComplexDoubleScalar(
const cytnx_complex128 &in):_elem(0){
173 this->_dtype =
Type.ComplexDouble;
189 void assign_selftype(
const cytnx_complex128 &c){this->_elem = c;}
190 void assign_selftype(
const cytnx_complex64 &c){this->_elem = c;}
191 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
192 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
193 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
194 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
195 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
196 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
197 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
198 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
199 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
201 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_complex128();}
202 void iadd(
const cytnx_complex128 &c){this->_elem += c;}
203 void iadd(
const cytnx_complex64 &c){this->_elem += c;}
204 void iadd(
const cytnx_double &c){this->_elem += c;}
205 void iadd(
const cytnx_float &c){this->_elem += c;}
206 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
207 void iadd(
const cytnx_int64 &c){this->_elem += c;}
208 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
209 void iadd(
const cytnx_int32 &c){this->_elem += c;}
210 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
211 void iadd(
const cytnx_int16 &c){this->_elem += c;}
212 void iadd(
const cytnx_bool &c){this->_elem += c;}
214 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_complex128();}
215 void isub(
const cytnx_complex128 &c){this->_elem -= c;}
216 void isub(
const cytnx_complex64 &c){this->_elem -= c;}
217 void isub(
const cytnx_double &c){this->_elem -= c;}
218 void isub(
const cytnx_float &c){this->_elem -= c;}
219 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
220 void isub(
const cytnx_int64 &c){this->_elem -= c;}
221 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
222 void isub(
const cytnx_int32 &c){this->_elem -= c;}
223 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
224 void isub(
const cytnx_int16 &c){this->_elem -= c;}
225 void isub(
const cytnx_bool &c){this->_elem -= c;}
227 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_complex128();}
228 void imul(
const cytnx_complex128 &c){this->_elem *= c;}
229 void imul(
const cytnx_complex64 &c){this->_elem *= c;}
230 void imul(
const cytnx_double &c){this->_elem *= c;}
231 void imul(
const cytnx_float &c){this->_elem *= c;}
232 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
233 void imul(
const cytnx_int64 &c){this->_elem *= c;}
234 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
235 void imul(
const cytnx_int32 &c){this->_elem *= c;}
236 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
237 void imul(
const cytnx_int16 &c){this->_elem *= c;}
238 void imul(
const cytnx_bool &c){this->_elem *= c;}
240 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_complex128();}
241 void idiv(
const cytnx_complex128 &c){this->_elem /= c;}
242 void idiv(
const cytnx_complex64 &c){this->_elem /= c;}
243 void idiv(
const cytnx_double &c){this->_elem /= c;}
244 void idiv(
const cytnx_float &c){this->_elem /= c;}
245 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
246 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
247 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
248 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
249 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
250 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
251 void idiv(
const cytnx_bool &c){this->_elem /= c;}
256 bool less(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
257 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
258 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
259 bool less(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
260 bool less(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
261 bool less(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
262 bool less(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
263 bool less(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
264 bool less(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
265 bool less(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
266 bool less(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
267 bool less(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
269 bool greater(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
270 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
271 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
272 bool greater(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
273 bool greater(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
274 bool greater(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
275 bool greater(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
276 bool greater(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
277 bool greater(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
278 bool greater(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
279 bool greater(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
280 bool greater(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
283 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
285 Scalar_base* astype(
const unsigned int &dtype){
286 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
287 tmp->assign_selftype(this->_elem);
291 Scalar_base* copy()
const{
292 ComplexDoubleScalar *tmp =
new ComplexDoubleScalar(this->_elem);
295 void print(std::ostream& os)
const{
296 os <<
"< " << this->_elem <<
" >";
300 class ComplexFloatScalar:
public Scalar_base{
305 ComplexFloatScalar(): _elem(0){this->_dtype =
Type.ComplexFloat;};
306 ComplexFloatScalar(
const cytnx_complex64 &in): _elem(0){
307 this->_dtype =
Type.ComplexFloat;
323 void assign_selftype(
const cytnx_complex128 &c){this->_elem = c;}
324 void assign_selftype(
const cytnx_complex64 &c){this->_elem = c;}
325 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
326 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
327 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
328 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
329 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
330 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
331 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
332 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
333 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
336 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_complex64();}
337 void iadd(
const cytnx_complex128 &c){this->_elem += c;}
338 void iadd(
const cytnx_complex64 &c){this->_elem += c;}
339 void iadd(
const cytnx_double &c){this->_elem += c;}
340 void iadd(
const cytnx_float &c){this->_elem += c;}
341 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
342 void iadd(
const cytnx_int64 &c){this->_elem += c;}
343 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
344 void iadd(
const cytnx_int32 &c){this->_elem += c;}
345 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
346 void iadd(
const cytnx_int16 &c){this->_elem += c;}
347 void iadd(
const cytnx_bool &c){this->_elem += c;}
349 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_complex64();}
350 void isub(
const cytnx_complex128 &c){this->_elem -= c;}
351 void isub(
const cytnx_complex64 &c){this->_elem -= c;}
352 void isub(
const cytnx_double &c){this->_elem -= c;}
353 void isub(
const cytnx_float &c){this->_elem -= c;}
354 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
355 void isub(
const cytnx_int64 &c){this->_elem -= c;}
356 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
357 void isub(
const cytnx_int32 &c){this->_elem -= c;}
358 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
359 void isub(
const cytnx_int16 &c){this->_elem -= c;}
360 void isub(
const cytnx_bool &c){this->_elem -= c;}
362 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_complex64();}
363 void imul(
const cytnx_complex128 &c){this->_elem *= c;}
364 void imul(
const cytnx_complex64 &c){this->_elem *= c;}
365 void imul(
const cytnx_double &c){this->_elem *= c;}
366 void imul(
const cytnx_float &c){this->_elem *= c;}
367 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
368 void imul(
const cytnx_int64 &c){this->_elem *= c;}
369 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
370 void imul(
const cytnx_int32 &c){this->_elem *= c;}
371 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
372 void imul(
const cytnx_int16 &c){this->_elem *= c;}
373 void imul(
const cytnx_bool &c){this->_elem *= c;}
375 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_complex64();}
376 void idiv(
const cytnx_complex128 &c){this->_elem /= c;}
377 void idiv(
const cytnx_complex64 &c){this->_elem /= c;}
378 void idiv(
const cytnx_double &c){this->_elem /= c;}
379 void idiv(
const cytnx_float &c){this->_elem /= c;}
380 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
381 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
382 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
383 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
384 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
385 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
386 void idiv(
const cytnx_bool &c){this->_elem /= c;}
389 bool less(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
390 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
391 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
392 bool less(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
393 bool less(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
394 bool less(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
395 bool less(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
396 bool less(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
397 bool less(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
398 bool less(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
399 bool less(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
400 bool less(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
402 bool greater(
const Scalar_base* c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
403 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
404 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
405 bool greater(
const cytnx_double &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
406 bool greater(
const cytnx_float &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
407 bool greater(
const cytnx_uint64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
408 bool greater(
const cytnx_int64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
409 bool greater(
const cytnx_uint32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
410 bool greater(
const cytnx_int32 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
411 bool greater(
const cytnx_uint16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
412 bool greater(
const cytnx_int16 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
413 bool greater(
const cytnx_bool &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
417 void iabs(){this->_elem=std::abs(this->_elem);}
419 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
420 Scalar_base* astype(
const unsigned int &dtype){
421 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
422 tmp->assign_selftype(this->_elem);
426 Scalar_base* copy()
const{
427 ComplexFloatScalar *tmp =
new ComplexFloatScalar(this->_elem);
430 void print(std::ostream& os)
const{
431 os <<
"< " << this->_elem <<
" >";
435 class DoubleScalar:
public Scalar_base{
440 DoubleScalar(): _elem(0){this->_dtype =
Type.Double;};
441 DoubleScalar(
const cytnx_double &in): _elem(0){
442 this->_dtype =
Type.Double;
446 cytnx_float to_cytnx_float()
const{
return this->_elem;};
447 cytnx_double to_cytnx_double()
const{
return this->_elem;};
450 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
451 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
452 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
453 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
454 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
455 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
456 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
458 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
459 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
460 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
461 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
462 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
463 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
464 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
465 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
466 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
467 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
468 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
471 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_double();}
472 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
473 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
474 void iadd(
const cytnx_double &c){this->_elem += c;}
475 void iadd(
const cytnx_float &c){this->_elem += c;}
476 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
477 void iadd(
const cytnx_int64 &c){this->_elem += c;}
478 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
479 void iadd(
const cytnx_int32 &c){this->_elem += c;}
480 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
481 void iadd(
const cytnx_int16 &c){this->_elem += c;}
482 void iadd(
const cytnx_bool &c){this->_elem += c;}
484 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_double();}
485 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
486 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
487 void isub(
const cytnx_double &c){this->_elem -= c;}
488 void isub(
const cytnx_float &c){this->_elem -= c;}
489 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
490 void isub(
const cytnx_int64 &c){this->_elem -= c;}
491 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
492 void isub(
const cytnx_int32 &c){this->_elem -= c;}
493 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
494 void isub(
const cytnx_int16 &c){this->_elem -= c;}
495 void isub(
const cytnx_bool &c){this->_elem -= c;}
497 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_double();}
498 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
499 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
500 void imul(
const cytnx_double &c){this->_elem *= c;}
501 void imul(
const cytnx_float &c){this->_elem *= c;}
502 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
503 void imul(
const cytnx_int64 &c){this->_elem *= c;}
504 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
505 void imul(
const cytnx_int32 &c){this->_elem *= c;}
506 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
507 void imul(
const cytnx_int16 &c){this->_elem *= c;}
508 void imul(
const cytnx_bool &c){this->_elem *= c;}
510 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_double();}
511 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
512 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
513 void idiv(
const cytnx_double &c){this->_elem /= c;}
514 void idiv(
const cytnx_float &c){this->_elem /= c;}
515 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
516 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
517 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
518 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
519 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
520 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
521 void idiv(
const cytnx_bool &c){this->_elem /= c;}
523 void iabs(){this->_elem=std::abs(this->_elem);}
525 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_double();}
526 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
527 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
528 bool less(
const cytnx_double &c){
return this->_elem < c;}
529 bool less(
const cytnx_float &c){
return this->_elem < c;}
530 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
531 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
532 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
533 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
534 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
535 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
536 bool less(
const cytnx_bool &c){
return this->_elem < c;}
538 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_double();}
539 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
540 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
541 bool greater(
const cytnx_double &c){
return this->_elem > c;}
542 bool greater(
const cytnx_float &c){
return this->_elem > c;}
543 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
544 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
545 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
546 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
547 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
548 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
549 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
551 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
552 Scalar_base* astype(
const unsigned int &dtype){
553 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
554 tmp->assign_selftype(this->_elem);
557 Scalar_base* copy()
const{
558 DoubleScalar *tmp =
new DoubleScalar(this->_elem);
561 void print(std::ostream& os)
const{
562 os <<
"< " << this->_elem <<
" >";
566 class FloatScalar:
public Scalar_base{
571 FloatScalar(): _elem(0){this->_dtype =
Type.Float;};
572 FloatScalar(
const cytnx_float &in): _elem(0){
573 this->_dtype =
Type.Float;
577 cytnx_float to_cytnx_float()
const{
return this->_elem;};
578 cytnx_double to_cytnx_double()
const{
return this->_elem;};
581 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
582 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
583 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
584 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
585 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
586 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
587 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
589 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
590 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
591 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
592 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
593 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
594 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
595 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
596 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
597 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
598 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
599 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
601 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_float();}
602 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
603 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
604 void iadd(
const cytnx_double &c){this->_elem += c;}
605 void iadd(
const cytnx_float &c){this->_elem += c;}
606 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
607 void iadd(
const cytnx_int64 &c){this->_elem += c;}
608 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
609 void iadd(
const cytnx_int32 &c){this->_elem += c;}
610 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
611 void iadd(
const cytnx_int16 &c){this->_elem += c;}
612 void iadd(
const cytnx_bool &c){this->_elem += c;}
614 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_float();}
615 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
616 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
617 void isub(
const cytnx_double &c){this->_elem -= c;}
618 void isub(
const cytnx_float &c){this->_elem -= c;}
619 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
620 void isub(
const cytnx_int64 &c){this->_elem -= c;}
621 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
622 void isub(
const cytnx_int32 &c){this->_elem -= c;}
623 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
624 void isub(
const cytnx_int16 &c){this->_elem -= c;}
625 void isub(
const cytnx_bool &c){this->_elem -= c;}
627 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_float();}
628 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
629 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
630 void imul(
const cytnx_double &c){this->_elem *= c;}
631 void imul(
const cytnx_float &c){this->_elem *= c;}
632 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
633 void imul(
const cytnx_int64 &c){this->_elem *= c;}
634 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
635 void imul(
const cytnx_int32 &c){this->_elem *= c;}
636 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
637 void imul(
const cytnx_int16 &c){this->_elem *= c;}
638 void imul(
const cytnx_bool &c){this->_elem *= c;}
640 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_float();}
641 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
642 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
643 void idiv(
const cytnx_double &c){this->_elem /= c;}
644 void idiv(
const cytnx_float &c){this->_elem /= c;}
645 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
646 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
647 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
648 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
649 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
650 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
651 void idiv(
const cytnx_bool &c){this->_elem /= c;}
655 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_float();}
656 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
657 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
658 bool less(
const cytnx_double &c){
return this->_elem < c;}
659 bool less(
const cytnx_float &c){
return this->_elem < c;}
660 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
661 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
662 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
663 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
664 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
665 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
666 bool less(
const cytnx_bool &c){
return this->_elem < c;}
668 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_float();}
669 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
670 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
671 bool greater(
const cytnx_double &c){
return this->_elem > c;}
672 bool greater(
const cytnx_float &c){
return this->_elem > c;}
673 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
674 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
675 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
676 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
677 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
678 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
679 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
683 void iabs(){this->_elem=std::abs(this->_elem);}
685 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
686 Scalar_base* astype(
const unsigned int &dtype){
687 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
688 tmp->assign_selftype(this->_elem);
691 Scalar_base* copy()
const{
692 FloatScalar *tmp =
new FloatScalar(this->_elem);
695 void print(std::ostream& os)
const{
696 os <<
"< " << this->_elem <<
" >";
700 class Int64Scalar:
public Scalar_base{
705 Int64Scalar(): _elem(0){this->_dtype =
Type.Int64;};
706 Int64Scalar(
const cytnx_int64 &in): _elem(0){
707 this->_dtype =
Type.Int64;
711 cytnx_float to_cytnx_float()
const{
return this->_elem;};
712 cytnx_double to_cytnx_double()
const{
return this->_elem;};
715 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
716 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
717 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
718 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
719 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
720 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
721 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
723 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
724 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
725 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
726 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
727 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
728 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
729 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
730 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
731 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
732 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
733 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
735 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_int64();}
736 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
737 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
738 void iadd(
const cytnx_double &c){this->_elem += c;}
739 void iadd(
const cytnx_float &c){this->_elem += c;}
740 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
741 void iadd(
const cytnx_int64 &c){this->_elem += c;}
742 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
743 void iadd(
const cytnx_int32 &c){this->_elem += c;}
744 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
745 void iadd(
const cytnx_int16 &c){this->_elem += c;}
746 void iadd(
const cytnx_bool &c){this->_elem += c;}
748 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_int64();}
749 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
750 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
751 void isub(
const cytnx_double &c){this->_elem -= c;}
752 void isub(
const cytnx_float &c){this->_elem -= c;}
753 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
754 void isub(
const cytnx_int64 &c){this->_elem -= c;}
755 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
756 void isub(
const cytnx_int32 &c){this->_elem -= c;}
757 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
758 void isub(
const cytnx_int16 &c){this->_elem -= c;}
759 void isub(
const cytnx_bool &c){this->_elem -= c;}
761 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_int64();}
762 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
763 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
764 void imul(
const cytnx_double &c){this->_elem *= c;}
765 void imul(
const cytnx_float &c){this->_elem *= c;}
766 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
767 void imul(
const cytnx_int64 &c){this->_elem *= c;}
768 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
769 void imul(
const cytnx_int32 &c){this->_elem *= c;}
770 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
771 void imul(
const cytnx_int16 &c){this->_elem *= c;}
772 void imul(
const cytnx_bool &c){this->_elem *= c;}
775 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_int64();}
776 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
777 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
778 void idiv(
const cytnx_double &c){this->_elem /= c;}
779 void idiv(
const cytnx_float &c){this->_elem /= c;}
780 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
781 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
782 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
783 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
784 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
785 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
786 void idiv(
const cytnx_bool &c){this->_elem /= c;}
788 void iabs(){this->_elem=std::abs(this->_elem);}
791 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_int64();}
792 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
793 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
794 bool less(
const cytnx_double &c){
return this->_elem < c;}
795 bool less(
const cytnx_float &c){
return this->_elem < c;}
796 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
797 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
798 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
799 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
800 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
801 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
802 bool less(
const cytnx_bool &c){
return this->_elem < c;}
804 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_int64();}
805 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
806 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
807 bool greater(
const cytnx_double &c){
return this->_elem > c;}
808 bool greater(
const cytnx_float &c){
return this->_elem > c;}
809 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
810 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
811 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
812 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
813 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
814 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
815 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
818 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
819 Scalar_base* astype(
const unsigned int &dtype){
820 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
821 tmp->assign_selftype(this->_elem);
824 Scalar_base* copy()
const{
825 Int64Scalar *tmp =
new Int64Scalar(this->_elem);
828 void print(std::ostream& os)
const{
829 os <<
"< " << this->_elem <<
" >";
832 class Uint64Scalar:
public Scalar_base{
837 Uint64Scalar(): _elem(0){this->_dtype =
Type.Uint64;};
838 Uint64Scalar(
const cytnx_uint64 &in): _elem(0){
839 this->_dtype =
Type.Uint64;
843 cytnx_float to_cytnx_float()
const{
return this->_elem;};
844 cytnx_double to_cytnx_double()
const{
return this->_elem;};
847 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
848 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
849 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
850 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
851 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
852 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
853 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
855 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
856 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
857 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
858 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
859 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
860 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
861 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
862 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
863 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
864 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
865 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
867 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_uint64();}
868 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
869 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
870 void iadd(
const cytnx_double &c){this->_elem += c;}
871 void iadd(
const cytnx_float &c){this->_elem += c;}
872 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
873 void iadd(
const cytnx_int64 &c){this->_elem += c;}
874 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
875 void iadd(
const cytnx_int32 &c){this->_elem += c;}
876 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
877 void iadd(
const cytnx_int16 &c){this->_elem += c;}
878 void iadd(
const cytnx_bool &c){this->_elem += c;}
880 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_uint64();}
881 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
882 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
883 void isub(
const cytnx_double &c){this->_elem -= c;}
884 void isub(
const cytnx_float &c){this->_elem -= c;}
885 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
886 void isub(
const cytnx_int64 &c){this->_elem -= c;}
887 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
888 void isub(
const cytnx_int32 &c){this->_elem -= c;}
889 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
890 void isub(
const cytnx_int16 &c){this->_elem -= c;}
891 void isub(
const cytnx_bool &c){this->_elem -= c;}
893 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_uint64();}
894 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
895 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
896 void imul(
const cytnx_double &c){this->_elem *= c;}
897 void imul(
const cytnx_float &c){this->_elem *= c;}
898 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
899 void imul(
const cytnx_int64 &c){this->_elem *= c;}
900 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
901 void imul(
const cytnx_int32 &c){this->_elem *= c;}
902 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
903 void imul(
const cytnx_int16 &c){this->_elem *= c;}
904 void imul(
const cytnx_bool &c){this->_elem *= c;}
906 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_uint64();}
907 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
908 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
909 void idiv(
const cytnx_double &c){this->_elem /= c;}
910 void idiv(
const cytnx_float &c){this->_elem /= c;}
911 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
912 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
913 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
914 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
915 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
916 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
917 void idiv(
const cytnx_bool &c){this->_elem /= c;}
919 void iabs(){this->_elem=std::abs(
cytnx_double(this->_elem));}
922 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_uint64();}
923 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
924 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
925 bool less(
const cytnx_double &c){
return this->_elem < c;}
926 bool less(
const cytnx_float &c){
return this->_elem < c;}
927 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
928 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
929 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
930 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
931 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
932 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
933 bool less(
const cytnx_bool &c){
return this->_elem < c;}
935 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_uint64();}
936 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
937 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
938 bool greater(
const cytnx_double &c){
return this->_elem > c;}
939 bool greater(
const cytnx_float &c){
return this->_elem > c;}
940 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
941 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
942 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
943 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
944 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
945 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
946 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
949 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
950 Scalar_base* astype(
const unsigned int &dtype){
951 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
952 tmp->assign_selftype(this->_elem);
955 Scalar_base* copy()
const{
956 Uint64Scalar *tmp =
new Uint64Scalar(this->_elem);
959 void print(std::ostream& os)
const{
960 os <<
"< " << this->_elem <<
" >";
963 class Int32Scalar:
public Scalar_base{
968 Int32Scalar(): _elem(0){this->_dtype =
Type.Int32;};
969 Int32Scalar(
const cytnx_int32 &in): _elem(0){
970 this->_dtype =
Type.Int32;
974 cytnx_float to_cytnx_float()
const{
return this->_elem;};
975 cytnx_double to_cytnx_double()
const{
return this->_elem;};
978 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
979 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
980 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
981 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
982 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
983 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
984 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
987 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
988 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
989 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
990 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
991 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
992 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
993 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
994 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
995 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
996 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
997 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
999 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_int32();}
1000 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1001 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1002 void iadd(
const cytnx_double &c){this->_elem += c;}
1003 void iadd(
const cytnx_float &c){this->_elem += c;}
1004 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
1005 void iadd(
const cytnx_int64 &c){this->_elem += c;}
1006 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
1007 void iadd(
const cytnx_int32 &c){this->_elem += c;}
1008 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
1009 void iadd(
const cytnx_int16 &c){this->_elem += c;}
1010 void iadd(
const cytnx_bool &c){this->_elem += c;}
1012 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_int32();}
1013 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1014 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1015 void isub(
const cytnx_double &c){this->_elem -= c;}
1016 void isub(
const cytnx_float &c){this->_elem -= c;}
1017 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
1018 void isub(
const cytnx_int64 &c){this->_elem -= c;}
1019 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
1020 void isub(
const cytnx_int32 &c){this->_elem -= c;}
1021 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
1022 void isub(
const cytnx_int16 &c){this->_elem -= c;}
1023 void isub(
const cytnx_bool &c){this->_elem -= c;}
1025 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_int32();}
1026 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1027 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1028 void imul(
const cytnx_double &c){this->_elem *= c;}
1029 void imul(
const cytnx_float &c){this->_elem *= c;}
1030 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
1031 void imul(
const cytnx_int64 &c){this->_elem *= c;}
1032 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
1033 void imul(
const cytnx_int32 &c){this->_elem *= c;}
1034 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
1035 void imul(
const cytnx_int16 &c){this->_elem *= c;}
1036 void imul(
const cytnx_bool &c){this->_elem *= c;}
1038 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_int32();}
1039 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1040 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1041 void idiv(
const cytnx_double &c){this->_elem /= c;}
1042 void idiv(
const cytnx_float &c){this->_elem /= c;}
1043 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
1044 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
1045 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
1046 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
1047 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
1048 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
1049 void idiv(
const cytnx_bool &c){this->_elem /= c;}
1051 void iabs(){this->_elem=std::abs(this->_elem);}
1054 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_int32();}
1055 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1056 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1057 bool less(
const cytnx_double &c){
return this->_elem < c;}
1058 bool less(
const cytnx_float &c){
return this->_elem < c;}
1059 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
1060 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
1061 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
1062 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
1063 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
1064 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
1065 bool less(
const cytnx_bool &c){
return this->_elem < c;}
1068 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_int32();}
1069 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1070 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1071 bool greater(
const cytnx_double &c){
return this->_elem > c;}
1072 bool greater(
const cytnx_float &c){
return this->_elem > c;}
1073 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
1074 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
1075 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
1076 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
1077 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
1078 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
1079 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
1081 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
1083 Scalar_base* astype(
const unsigned int &dtype){
1084 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
1085 tmp->assign_selftype(this->_elem);
1088 Scalar_base* copy()
const{
1089 Int32Scalar *tmp =
new Int32Scalar(this->_elem);
1092 void print(std::ostream& os)
const{
1093 os <<
"< " << this->_elem <<
" >";
1096 class Uint32Scalar:
public Scalar_base{
1101 Uint32Scalar(): _elem(0){this->_dtype =
Type.Uint32;};
1102 Uint32Scalar(
const cytnx_uint32 &in): _elem(0){
1103 this->_dtype =
Type.Uint32;
1107 cytnx_float to_cytnx_float()
const{
return this->_elem;};
1108 cytnx_double to_cytnx_double()
const{
return this->_elem;};
1111 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
1112 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
1113 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
1114 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
1115 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
1116 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
1117 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
1119 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1120 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1121 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
1122 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
1123 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
1124 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
1125 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
1126 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
1127 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
1128 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
1129 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
1131 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_uint32();}
1132 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1133 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1134 void iadd(
const cytnx_double &c){this->_elem += c;}
1135 void iadd(
const cytnx_float &c){this->_elem += c;}
1136 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
1137 void iadd(
const cytnx_int64 &c){this->_elem += c;}
1138 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
1139 void iadd(
const cytnx_int32 &c){this->_elem += c;}
1140 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
1141 void iadd(
const cytnx_int16 &c){this->_elem += c;}
1142 void iadd(
const cytnx_bool &c){this->_elem += c;}
1144 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_uint32();}
1145 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1146 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1147 void isub(
const cytnx_double &c){this->_elem -= c;}
1148 void isub(
const cytnx_float &c){this->_elem -= c;}
1149 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
1150 void isub(
const cytnx_int64 &c){this->_elem -= c;}
1151 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
1152 void isub(
const cytnx_int32 &c){this->_elem -= c;}
1153 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
1154 void isub(
const cytnx_int16 &c){this->_elem -= c;}
1155 void isub(
const cytnx_bool &c){this->_elem -= c;}
1157 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_uint32();}
1158 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1159 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1160 void imul(
const cytnx_double &c){this->_elem *= c;}
1161 void imul(
const cytnx_float &c){this->_elem *= c;}
1162 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
1163 void imul(
const cytnx_int64 &c){this->_elem *= c;}
1164 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
1165 void imul(
const cytnx_int32 &c){this->_elem *= c;}
1166 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
1167 void imul(
const cytnx_int16 &c){this->_elem *= c;}
1168 void imul(
const cytnx_bool &c){this->_elem *= c;}
1170 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_uint32();}
1171 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1172 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1173 void idiv(
const cytnx_double &c){this->_elem /= c;}
1174 void idiv(
const cytnx_float &c){this->_elem /= c;}
1175 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
1176 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
1177 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
1178 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
1179 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
1180 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
1181 void idiv(
const cytnx_bool &c){this->_elem /= c;}
1183 void iabs(){this->_elem=std::abs(
cytnx_double(this->_elem));}
1186 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_uint32();}
1187 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1188 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1189 bool less(
const cytnx_double &c){
return this->_elem < c;}
1190 bool less(
const cytnx_float &c){
return this->_elem < c;}
1191 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
1192 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
1193 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
1194 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
1195 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
1196 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
1197 bool less(
const cytnx_bool &c){
return this->_elem < c;}
1199 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_uint32();}
1200 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1201 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1202 bool greater(
const cytnx_double &c){
return this->_elem > c;}
1203 bool greater(
const cytnx_float &c){
return this->_elem > c;}
1204 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
1205 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
1206 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
1207 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
1208 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
1209 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
1210 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
1215 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
1216 Scalar_base* astype(
const unsigned int &dtype){
1217 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
1218 tmp->assign_selftype(this->_elem);
1221 Scalar_base* copy()
const{
1222 Uint32Scalar *tmp =
new Uint32Scalar(this->_elem);
1225 void print(std::ostream& os)
const{
1226 os <<
"< " << this->_elem <<
" >";
1229 class Int16Scalar:
public Scalar_base{
1234 Int16Scalar(): _elem(0){this->_dtype =
Type.Int16;};
1235 Int16Scalar(
const cytnx_int16 &in): _elem(0){
1236 this->_dtype =
Type.Int16;
1240 cytnx_float to_cytnx_float()
const{
return this->_elem;};
1241 cytnx_double to_cytnx_double()
const{
return this->_elem;};
1244 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
1245 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
1246 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
1247 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
1248 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
1249 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
1250 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
1252 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1253 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1254 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
1255 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
1256 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
1257 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
1258 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
1259 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
1260 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
1261 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
1262 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
1265 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_int16();}
1266 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1267 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1268 void iadd(
const cytnx_double &c){this->_elem += c;}
1269 void iadd(
const cytnx_float &c){this->_elem += c;}
1270 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
1271 void iadd(
const cytnx_int64 &c){this->_elem += c;}
1272 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
1273 void iadd(
const cytnx_int32 &c){this->_elem += c;}
1274 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
1275 void iadd(
const cytnx_int16 &c){this->_elem += c;}
1276 void iadd(
const cytnx_bool &c){this->_elem += c;}
1278 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_int16();}
1279 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1280 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1281 void isub(
const cytnx_double &c){this->_elem -= c;}
1282 void isub(
const cytnx_float &c){this->_elem -= c;}
1283 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
1284 void isub(
const cytnx_int64 &c){this->_elem -= c;}
1285 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
1286 void isub(
const cytnx_int32 &c){this->_elem -= c;}
1287 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
1288 void isub(
const cytnx_int16 &c){this->_elem -= c;}
1289 void isub(
const cytnx_bool &c){this->_elem -= c;}
1291 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_int16();}
1292 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1293 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1294 void imul(
const cytnx_double &c){this->_elem *= c;}
1295 void imul(
const cytnx_float &c){this->_elem *= c;}
1296 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
1297 void imul(
const cytnx_int64 &c){this->_elem *= c;}
1298 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
1299 void imul(
const cytnx_int32 &c){this->_elem *= c;}
1300 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
1301 void imul(
const cytnx_int16 &c){this->_elem *= c;}
1302 void imul(
const cytnx_bool &c){this->_elem *= c;}
1304 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_int16();}
1305 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1306 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1307 void idiv(
const cytnx_double &c){this->_elem /= c;}
1308 void idiv(
const cytnx_float &c){this->_elem /= c;}
1309 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
1310 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
1311 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
1312 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
1313 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
1314 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
1315 void idiv(
const cytnx_bool &c){this->_elem /= c;}
1317 void iabs(){this->_elem=std::abs(this->_elem);}
1320 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_int16();}
1321 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1322 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1323 bool less(
const cytnx_double &c){
return this->_elem < c;}
1324 bool less(
const cytnx_float &c){
return this->_elem < c;}
1325 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
1326 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
1327 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
1328 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
1329 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
1330 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
1331 bool less(
const cytnx_bool &c){
return this->_elem < c;}
1333 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_int16();}
1334 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1335 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1336 bool greater(
const cytnx_double &c){
return this->_elem > c;}
1337 bool greater(
const cytnx_float &c){
return this->_elem > c;}
1338 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
1339 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
1340 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
1341 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
1342 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
1343 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
1344 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
1347 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
1348 Scalar_base* astype(
const unsigned int &dtype){
1349 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
1350 tmp->assign_selftype(this->_elem);
1353 Scalar_base* copy()
const{
1354 Int16Scalar *tmp =
new Int16Scalar(this->_elem);
1357 void print(std::ostream& os)
const{
1358 os <<
"< " << this->_elem <<
" >";
1361 class Uint16Scalar:
public Scalar_base{
1366 Uint16Scalar(): _elem(0){this->_dtype =
Type.Uint16;};
1367 Uint16Scalar(
const cytnx_uint16 &in): _elem(0){
1368 this->_dtype =
Type.Uint16;
1372 cytnx_float to_cytnx_float()
const{
return this->_elem;};
1373 cytnx_double to_cytnx_double()
const{
return this->_elem;};
1376 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
1377 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
1378 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
1379 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
1380 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
1381 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
1382 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
1384 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1385 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1386 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
1387 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
1388 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
1389 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
1390 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
1391 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
1392 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
1393 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
1394 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
1396 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_uint16();}
1397 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1398 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1399 void iadd(
const cytnx_double &c){this->_elem += c;}
1400 void iadd(
const cytnx_float &c){this->_elem += c;}
1401 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
1402 void iadd(
const cytnx_int64 &c){this->_elem += c;}
1403 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
1404 void iadd(
const cytnx_int32 &c){this->_elem += c;}
1405 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
1406 void iadd(
const cytnx_int16 &c){this->_elem += c;}
1407 void iadd(
const cytnx_bool &c){this->_elem += c;}
1409 void isub(
const Scalar_base* c){this->_elem += c->to_cytnx_uint16();}
1410 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1411 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1412 void isub(
const cytnx_double &c){this->_elem += c;}
1413 void isub(
const cytnx_float &c){this->_elem += c;}
1414 void isub(
const cytnx_uint64 &c){this->_elem += c;}
1415 void isub(
const cytnx_int64 &c){this->_elem += c;}
1416 void isub(
const cytnx_uint32 &c){this->_elem += c;}
1417 void isub(
const cytnx_int32 &c){this->_elem += c;}
1418 void isub(
const cytnx_uint16 &c){this->_elem += c;}
1419 void isub(
const cytnx_int16 &c){this->_elem += c;}
1420 void isub(
const cytnx_bool &c){this->_elem += c;}
1422 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_uint16();}
1423 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1424 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1425 void imul(
const cytnx_double &c){this->_elem *= c;}
1426 void imul(
const cytnx_float &c){this->_elem *= c;}
1427 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
1428 void imul(
const cytnx_int64 &c){this->_elem *= c;}
1429 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
1430 void imul(
const cytnx_int32 &c){this->_elem *= c;}
1431 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
1432 void imul(
const cytnx_int16 &c){this->_elem *= c;}
1433 void imul(
const cytnx_bool &c){this->_elem *= c;}
1436 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_uint16();}
1437 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1438 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1439 void idiv(
const cytnx_double &c){this->_elem /= c;}
1440 void idiv(
const cytnx_float &c){this->_elem /= c;}
1441 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
1442 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
1443 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
1444 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
1445 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
1446 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
1447 void idiv(
const cytnx_bool &c){this->_elem /= c;}
1449 void iabs(){this->_elem=std::abs(this->_elem);}
1452 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_uint16();}
1453 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1454 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1455 bool less(
const cytnx_double &c){
return this->_elem < c;}
1456 bool less(
const cytnx_float &c){
return this->_elem < c;}
1457 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
1458 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
1459 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
1460 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
1461 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
1462 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
1463 bool less(
const cytnx_bool &c){
return this->_elem < c;}
1465 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_uint16();}
1466 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1467 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1468 bool greater(
const cytnx_double &c){
return this->_elem > c;}
1469 bool greater(
const cytnx_float &c){
return this->_elem > c;}
1470 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
1471 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
1472 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
1473 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
1474 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
1475 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
1476 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
1480 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
1481 Scalar_base* astype(
const unsigned int &dtype){
1482 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
1483 tmp->assign_selftype(this->_elem);
1486 Scalar_base* copy()
const{
1487 Uint16Scalar *tmp =
new Uint16Scalar(this->_elem);
1490 void print(std::ostream& os)
const{
1491 os <<
"< " << this->_elem <<
" >";
1494 class BoolScalar:
public Scalar_base{
1499 BoolScalar(): _elem(0){this->_dtype =
Type.Bool;};
1500 BoolScalar(
const cytnx_bool &in): _elem(0){
1501 this->_dtype =
Type.Bool;
1505 cytnx_float to_cytnx_float()
const{
return this->_elem;};
1506 cytnx_double to_cytnx_double()
const{
return this->_elem;};
1509 cytnx_int64 to_cytnx_int64()
const{
return this->_elem;};
1510 cytnx_uint64 to_cytnx_uint64()
const{
return this->_elem;};
1511 cytnx_int32 to_cytnx_int32()
const{
return this->_elem;};
1512 cytnx_uint32 to_cytnx_uint32()
const{
return this->_elem;};
1513 cytnx_int16 to_cytnx_int16()
const{
return this->_elem;};
1514 cytnx_uint16 to_cytnx_uint16()
const{
return this->_elem;};
1515 cytnx_bool to_cytnx_bool()
const{
return this->_elem;};
1517 void assign_selftype(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1518 void assign_selftype(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot convert complex to real%s",
"\n");}
1519 void assign_selftype(
const cytnx_double &c){this->_elem = c;}
1520 void assign_selftype(
const cytnx_float &c){this->_elem = c;}
1521 void assign_selftype(
const cytnx_uint64 &c){this->_elem = c;}
1522 void assign_selftype(
const cytnx_int64 &c){this->_elem = c;}
1523 void assign_selftype(
const cytnx_uint32 &c){this->_elem = c;}
1524 void assign_selftype(
const cytnx_int32 &c){this->_elem = c;}
1525 void assign_selftype(
const cytnx_uint16 &c){this->_elem = c;}
1526 void assign_selftype(
const cytnx_int16 &c){this->_elem = c;}
1527 void assign_selftype(
const cytnx_bool &c){this->_elem = c;}
1529 void iadd(
const Scalar_base* c){this->_elem += c->to_cytnx_bool();}
1530 void iadd(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1531 void iadd(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1532 void iadd(
const cytnx_double &c){this->_elem += c;}
1533 void iadd(
const cytnx_float &c){this->_elem += c;}
1534 void iadd(
const cytnx_uint64 &c){this->_elem += c;}
1535 void iadd(
const cytnx_int64 &c){this->_elem += c;}
1536 void iadd(
const cytnx_uint32 &c){this->_elem += c;}
1537 void iadd(
const cytnx_int32 &c){this->_elem += c;}
1538 void iadd(
const cytnx_uint16 &c){this->_elem += c;}
1539 void iadd(
const cytnx_int16 &c){this->_elem += c;}
1540 void iadd(
const cytnx_bool &c){this->_elem += c;}
1542 void isub(
const Scalar_base* c){this->_elem -= c->to_cytnx_bool();}
1543 void isub(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1544 void isub(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1545 void isub(
const cytnx_double &c){this->_elem -= c;}
1546 void isub(
const cytnx_float &c){this->_elem -= c;}
1547 void isub(
const cytnx_uint64 &c){this->_elem -= c;}
1548 void isub(
const cytnx_int64 &c){this->_elem -= c;}
1549 void isub(
const cytnx_uint32 &c){this->_elem -= c;}
1550 void isub(
const cytnx_int32 &c){this->_elem -= c;}
1551 void isub(
const cytnx_uint16 &c){this->_elem -= c;}
1552 void isub(
const cytnx_int16 &c){this->_elem -= c;}
1553 void isub(
const cytnx_bool &c){this->_elem -= c;}
1555 void imul(
const Scalar_base* c){this->_elem *= c->to_cytnx_bool();}
1556 void imul(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1557 void imul(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1558 void imul(
const cytnx_double &c){this->_elem *= c;}
1559 void imul(
const cytnx_float &c){this->_elem *= c;}
1560 void imul(
const cytnx_uint64 &c){this->_elem *= c;}
1561 void imul(
const cytnx_int64 &c){this->_elem *= c;}
1562 void imul(
const cytnx_uint32 &c){this->_elem *= c;}
1563 void imul(
const cytnx_int32 &c){this->_elem *= c;}
1564 void imul(
const cytnx_uint16 &c){this->_elem *= c;}
1565 void imul(
const cytnx_int16 &c){this->_elem *= c;}
1566 void imul(
const cytnx_bool &c){this->_elem *= c;}
1569 void idiv(
const Scalar_base* c){this->_elem /= c->to_cytnx_bool();}
1570 void idiv(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1571 void idiv(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] cannot operate real and complex values%s",
"\n");}
1572 void idiv(
const cytnx_double &c){this->_elem /= c;}
1573 void idiv(
const cytnx_float &c){this->_elem /= c;}
1574 void idiv(
const cytnx_uint64 &c){this->_elem /= c;}
1575 void idiv(
const cytnx_int64 &c){this->_elem /= c;}
1576 void idiv(
const cytnx_uint32 &c){this->_elem /= c;}
1577 void idiv(
const cytnx_int32 &c){this->_elem /= c;}
1578 void idiv(
const cytnx_uint16 &c){this->_elem /= c;}
1579 void idiv(
const cytnx_int16 &c){this->_elem /= c;}
1580 void idiv(
const cytnx_bool &c){this->_elem /= c;}
1582 void iabs(){this->_elem=std::abs(this->_elem);}
1585 bool less(
const Scalar_base* c){
return this->_elem < c->to_cytnx_bool();}
1586 bool less(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1587 bool less(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1588 bool less(
const cytnx_double &c){
return this->_elem < c;}
1589 bool less(
const cytnx_float &c){
return this->_elem < c;}
1590 bool less(
const cytnx_uint64 &c){
return this->_elem < c;}
1591 bool less(
const cytnx_int64 &c){
return this->_elem < c;}
1592 bool less(
const cytnx_uint32 &c){
return this->_elem < c;}
1593 bool less(
const cytnx_int32 &c){
return this->_elem < c;}
1594 bool less(
const cytnx_uint16 &c){
return this->_elem < c;}
1595 bool less(
const cytnx_int16 &c){
return this->_elem < c;}
1596 bool less(
const cytnx_bool &c){
return this->_elem < c;}
1598 bool greater(
const Scalar_base* c){
return this->_elem > c->to_cytnx_bool();}
1599 bool greater(
const cytnx_complex128 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1600 bool greater(
const cytnx_complex64 &c){
cytnx_error_msg(
true,
"[ERROR] comparison not supported for complex type%s",
"\n");
return 0;}
1601 bool greater(
const cytnx_double &c){
return this->_elem > c;}
1602 bool greater(
const cytnx_float &c){
return this->_elem > c;}
1603 bool greater(
const cytnx_uint64 &c){
return this->_elem > c;}
1604 bool greater(
const cytnx_int64 &c){
return this->_elem > c;}
1605 bool greater(
const cytnx_uint32 &c){
return this->_elem > c;}
1606 bool greater(
const cytnx_int32 &c){
return this->_elem > c;}
1607 bool greater(
const cytnx_uint16 &c){
return this->_elem > c;}
1608 bool greater(
const cytnx_int16 &c){
return this->_elem > c;}
1609 bool greater(
const cytnx_bool &c){
return this->_elem > c;}
1611 void* get_raw_address()
const{
return (
void*)(&this->_elem);}
1612 Scalar_base* astype(
const unsigned int &dtype){
1613 Scalar_base *tmp =
__ScII.UScIInit[dtype]();
1614 tmp->assign_selftype(this->_elem);
1617 Scalar_base* copy()
const{
1618 BoolScalar *tmp =
new BoolScalar(this->_elem);
1621 void print(std::ostream& os)
const{
1622 os <<
"< " << this->_elem <<
" >";
1635 boost::intrusive_ptr<Storage_base> _insimpl;
1638 Sproxy(boost::intrusive_ptr<Storage_base> _ptr,
const cytnx_uint64 &idx) : _insimpl(_ptr), _loc(idx){}
1641 const Sproxy& operator=(
const Scalar &rc);
1652 const Sproxy& operator=(
const cytnx_bool &rc);
1654 const Sproxy& operator=(
const Sproxy &rc);
1670 this->Init_by_number(in);
1675 if(this->_impl!=
nullptr)
delete this->
_impl;
1677 this->_impl->assign_selftype(in);
1681 Scalar(
const Sproxy &prox);
1692 if(this->_impl!=
nullptr)
delete this->
_impl;
1693 this->_impl =
new ComplexDoubleScalar(in);
1696 if(this->_impl!=
nullptr)
delete this->
_impl;
1697 this->_impl =
new ComplexFloatScalar(in);
1700 if(this->_impl!=
nullptr)
delete this->
_impl;
1701 this->_impl =
new DoubleScalar(in);
1704 if(this->_impl!=
nullptr)
delete this->
_impl;
1705 this->_impl =
new FloatScalar(in);
1708 if(this->_impl!=
nullptr)
delete this->
_impl;
1709 this->_impl =
new Int64Scalar(in);
1712 if(this->_impl!=
nullptr)
delete this->
_impl;
1713 this->_impl =
new Uint64Scalar(in);
1716 if(this->_impl!=
nullptr)
delete this->
_impl;
1717 this->_impl =
new Int32Scalar(in);
1720 if(this->_impl!=
nullptr)
delete this->
_impl;
1721 this->_impl =
new Uint32Scalar(in);
1724 if(this->_impl!=
nullptr)
delete this->
_impl;
1725 this->_impl =
new Int16Scalar(in);
1728 if(this->_impl!=
nullptr)
delete this->
_impl;
1729 this->_impl =
new Uint16Scalar(in);
1732 if(this->_impl!=
nullptr)
delete this->
_impl;
1733 this->_impl =
new BoolScalar(in);
1740 if(this->_impl!=
nullptr)
1743 this->_impl = rhs.
_impl->copy();
1748 if(this->_impl!=
nullptr)
1751 this->_impl = rhs.
_impl->copy();
1758 this->Init_by_number(rhs);
1770 return this->_impl->_dtype;
1775 this->_impl->print(std::cout);
1776 std::cout << std::string(
" Scalar dtype: [") <<
Type.getname(this->_impl->_dtype) << std::string(
"]") << std::endl;
1781 return this->_impl->to_cytnx_double();
1784 return this->_impl->to_cytnx_float();
1787 return this->_impl->to_cytnx_uint64();
1790 return this->_impl->to_cytnx_int64();
1793 return this->_impl->to_cytnx_uint32();
1796 return this->_impl->to_cytnx_int32();
1799 return this->_impl->to_cytnx_uint16();
1802 return this->_impl->to_cytnx_int16();
1805 return this->_impl->to_cytnx_bool();
1808 if(this->_impl!=
nullptr)
1815 this->_impl->iadd(rc);
1818 this->_impl->iadd(rhs.
_impl);
1822 this->_impl->isub(rc);
1825 this->_impl->isub(rhs.
_impl);
1829 this->_impl->imul(rc);
1832 this->_impl->imul(rhs.
_impl);
1836 this->_impl->idiv(rc);
1839 this->_impl->idiv(rhs.
_impl);
1844 this->_impl->iabs();
1858 int rid =
Type.cy_typeid(rc);
1859 if( rid < this->
dtype()){
1861 return tmp.
_impl->less(rc);
1863 return this->_impl->less(rc);
1868 if(rhs.
dtype() < this->dtype()){
1872 return this->_impl->less(rhs.
_impl);
1880 int rid =
Type.cy_typeid(rc);
1881 if( rid < this->
dtype()){
1883 return !(tmp.
_impl->greater(rc));
1885 return !(this->_impl->greater(rc));
1890 if(rhs.
dtype() < this->dtype()){
1894 return !(this->_impl->greater(rhs.
_impl));
1903 int rid =
Type.cy_typeid(rc);
1904 if( rid < this->
dtype()){
1906 return tmp.
_impl->greater(rc);
1908 return this->_impl->greater(rc);
1913 if(rhs.
dtype() < this->dtype()){
1917 return this->_impl->greater(rhs.
_impl);
1925 int rid =
Type.cy_typeid(rc);
1926 if( rid < this->
dtype()){
1928 return !(tmp.
_impl->less(rc));
1930 return !(this->_impl->less(rc));
1935 if(rhs.
dtype() < this->dtype()){
1939 return !(this->_impl->less(rhs.
_impl));
1947 int rid =
Type.cy_typeid(rc);
1948 if( this->
dtype() < rid){
1953 out.
_impl->iadd(rc);
1971 int rid =
Type.cy_typeid(rc);
1972 if( this->
dtype() < rid){
1977 out.
_impl->imul(rc);
1995 int rid =
Type.cy_typeid(rc);
1996 if( this->
dtype() < rid){
2001 out.
_impl->isub(rc);
2019 int rid =
Type.cy_typeid(rc);
2020 if( this->
dtype() < rid){
2025 out.
_impl->idiv(rc);
2044 return this->
radd(rc);
2048 return this->
rmul(rc);
2052 return this->
rsub(rc);
2056 return this->
rdiv(rc);
2061 return this->
less(rc);
2072 return this->
leq(rc);
2077 return this->
geq(rc);
2192 Scalar
abs(
const Scalar &c);
2199 std::ostream&
operator<<(std::ostream& os,
const Scalar &in);
Definition Scalar.hpp:1630
void operator-=(const T &rc)
Definition Scalar.hpp:1821
Scalar & operator=(const Scalar &rhs)
Definition Scalar.hpp:1747
bool less(const Scalar &rhs) const
Definition Scalar.hpp:1866
Scalar_base * _impl
Definition Scalar.hpp:1663
bool leq(const T &rc) const
Definition Scalar.hpp:1878
Scalar(const T &in, const unsigned int &dtype)
Definition Scalar.hpp:1674
~Scalar()
Definition Scalar.hpp:1807
Scalar rmul(const T &rc) const
Definition Scalar.hpp:1969
void operator+=(const T &rc)
Definition Scalar.hpp:1814
bool operator<(const T &rc)
Definition Scalar.hpp:2060
Scalar()
Definition Scalar.hpp:1665
Scalar rsub(const T &rc) const
Definition Scalar.hpp:1993
Scalar(const T &in)
Definition Scalar.hpp:1669
bool less(const T &rc) const
Definition Scalar.hpp:1856
Scalar operator*(const T &rc)
Definition Scalar.hpp:2047
int dtype() const
Definition Scalar.hpp:1769
void operator/=(const T &rc)
Definition Scalar.hpp:1835
bool operator>=(const T &rc)
Definition Scalar.hpp:2076
void operator*=(const T &rc)
Definition Scalar.hpp:1828
bool geq(const Scalar &rhs) const
Definition Scalar.hpp:1933
Scalar operator+(const T &rc)
Definition Scalar.hpp:2043
Scalar(Scalar_base *in)
Definition Scalar.hpp:1685
bool greater(const T &rc) const
Definition Scalar.hpp:1901
Scalar & operator=(const T &rhs)
Definition Scalar.hpp:1757
void operator-=(const Scalar &rhs)
Definition Scalar.hpp:1824
bool leq(const Scalar &rhs) const
Definition Scalar.hpp:1888
void iabs()
Definition Scalar.hpp:1843
Scalar abs() const
Definition Scalar.hpp:1847
Scalar rdiv(const T &rc) const
Definition Scalar.hpp:2017
void print() const
Definition Scalar.hpp:1774
bool greater(const Scalar &rhs) const
Definition Scalar.hpp:1911
bool geq(const T &rc) const
Definition Scalar.hpp:1923
bool operator<=(const T &rc)
Definition Scalar.hpp:2071
Scalar operator-(const T &rc)
Definition Scalar.hpp:2051
Scalar rmul(const Scalar &rhs) const
Definition Scalar.hpp:1980
Scalar rdiv(const Scalar &rhs) const
Definition Scalar.hpp:2028
Scalar(const Scalar &rhs)
Definition Scalar.hpp:1739
void operator+=(const Scalar &rhs)
Definition Scalar.hpp:1817
void operator*=(const Scalar &rhs)
Definition Scalar.hpp:1831
void operator/=(const Scalar &rhs)
Definition Scalar.hpp:1838
Scalar rsub(const Scalar &rhs) const
Definition Scalar.hpp:2004
Scalar radd(const Scalar &rhs) const
Definition Scalar.hpp:1956
Scalar radd(const T &rc) const
Definition Scalar.hpp:1945
Scalar operator/(const T &rc)
Definition Scalar.hpp:2055
Scalar astype(const unsigned int &dtype) const
Definition Scalar.hpp:1763
bool operator>(const T &rc)
Definition Scalar.hpp:2065
#define cytnx_error_msg(is_true, format,...)
Definition cytnx_error.hpp:18
Definition Accessor.hpp:12
cytnx_complex128 complex128(const Scalar &in)
Definition Scalar.cpp:6
cytnx::UniTensor operator*(const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
double cytnx_double
Definition Type.hpp:20
uint32_t cytnx_uint32
Definition Type.hpp:23
bool cytnx_bool
Definition Type.hpp:31
std::complex< double > cytnx_complex128
Definition Type.hpp:30
float cytnx_float
Definition Type.hpp:21
std::ostream & operator<<(std::ostream &os, const Scalar &in)
Definition Scalar.cpp:14
int16_t cytnx_int16
Definition Type.hpp:27
Scalar abs(const Scalar &c)
Definition Scalar.cpp:127
std::complex< float > cytnx_complex64
Definition Type.hpp:29
cytnx::UniTensor operator-(const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
int32_t cytnx_int32
Definition Type.hpp:26
Scalar operator<=(const cytnx_complex128 &lc, const Scalar &rs)
Definition Scalar.cpp:101
Scalar operator>(const cytnx_complex128 &lc, const Scalar &rs)
Definition Scalar.cpp:88
uint16_t cytnx_uint16
Definition Type.hpp:24
Scalar operator<(const cytnx_complex128 &lc, const Scalar &rs)
Definition Scalar.cpp:75
uint64_t cytnx_uint64
Definition Type.hpp:22
cytnx_complex64 complex64(const Scalar &in)
Definition Scalar.cpp:10
int64_t cytnx_int64
Definition Type.hpp:25
Type_class Type
Definition Type.cpp:137
cytnx::UniTensor operator+(const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
Scalar_init_interface __ScII
Definition Scalar.cpp:260
cytnx::UniTensor operator/(const cytnx::UniTensor &Lt, const cytnx::UniTensor &Rt)
Scalar operator>=(const cytnx_complex128 &lc, const Scalar &rs)
Definition Scalar.cpp:114