mirror of
https://github.com/triqs/dft_tools
synced 2024-12-27 06:43:40 +01:00
2c542647fd
- change : all objects are by default stored now by reference, not by copy any more. Unless the trait force_copy_in_expr is true. - rvalue refs are moved into the tree - simplifies a lot the writing of lazy method, objects. - added a macro for methods - tests ok. Further check needed to control absence of copies... - improved documentation
59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
(expr) ---> (5 * _1)
|
|
(eval( expr, x_=5)) ---> 25
|
|
-------------
|
|
------ start test2 -----------------
|
|
(expr) ---> (_1 + (2 * _2))
|
|
(eval(expr,x_ =1, y_ =2)) ---> 5
|
|
(eval(expr,x_ =1)) ---> (1 + (2 * _2))
|
|
(eval(expr,x_ =x_ + y_)) ---> ((_1 + _2) + (2 * _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 7
|
|
------ start test2 -----------------
|
|
(expr) ---> ((_1 + (2 * _2)) + _1)
|
|
(eval(expr,x_ =1, y_ =2)) ---> 6
|
|
(eval(expr,x_ =1)) ---> ((1 + (2 * _2)) + 1)
|
|
(eval(expr,x_ =x_ + y_)) ---> (((_1 + _2) + (2 * _2)) + (_1 + _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 10
|
|
------ start test2 -----------------
|
|
(expr) ---> ((_1 / 2) + (2 * _2))
|
|
(eval(expr,x_ =1, y_ =2)) ---> 4.5
|
|
(eval(expr,x_ =1)) ---> (0.5 + (2 * _2))
|
|
(eval(expr,x_ =x_ + y_)) ---> (((_1 + _2) / 2) + (2 * _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 5.5
|
|
------ start test2 -----------------
|
|
(expr) ---> F1(_1)
|
|
(eval(expr,x_ =1, y_ =2)) ---> 10
|
|
(eval(expr,x_ =1)) ---> 10
|
|
(eval(expr,x_ =x_ + y_)) ---> F1((_1 + _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 30
|
|
------ start test2 -----------------
|
|
(expr) ---> (F1(_1) + (2 * _2))
|
|
(eval(expr,x_ =1, y_ =2)) ---> 14
|
|
(eval(expr,x_ =1)) ---> (10 + (2 * _2))
|
|
(eval(expr,x_ =x_ + y_)) ---> (F1((_1 + _2)) + (2 * _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 34
|
|
------ start test2 -----------------
|
|
(expr) ---> ((1 / F1(_1)) + (2 * _2))
|
|
(eval(expr,x_ =1, y_ =2)) ---> 4.1
|
|
(eval(expr,x_ =1)) ---> (0.1 + (2 * _2))
|
|
(eval(expr,x_ =x_ + y_)) ---> ((1 / F1((_1 + _2))) + (2 * _2))
|
|
(eval( eval ( expr,x_ =x_ + y_), x_ = 1, y_ = 2)) ---> 4.03333
|
|
4 = 4
|
|
12 = 12
|
|
9 = 9
|
|
9 = 9
|
|
12 = 12
|
|
-------------
|
|
f.v before assign 7
|
|
f.v after assign 8
|
|
-------------
|
|
expr = (F2(_1, _2) + (2 * _2))
|
|
eval(expr,x_ =1, y_ =2) = 16 and it should be 16
|
|
tmp =F2(2, _2)
|
|
another = F2(2, _2)
|
|
another = 12
|
|
-------------
|
|
(eval( if_else( true , 2*x_ , y_) , x_=1, y_=3)) ---> 2
|
|
(eval( if_else( false , 2*x_ , y_) ,x_=1, y_=3)) ---> 3
|
|
(eval( if_else( x_>y_ , 2*x_ , y_) ,x_=1, y_=3)) ---> 3
|
|
(_1 < _2)
|