-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computational Data Flow Expression / DAG Builder #61
Comments
You can already reuse an expression and evaluate it when needed, however named variables are not supported: xt::array<double> x, y;
auto exp_res1 = x + y + 3; // exp_res1 type is xfunction<....>, not evaluated
auto exp_res2 = exp_res1 / 2; // exp_res2 type is xfunction<...>, not evaluated
// init x and y
x = arr1;
y = arr2;
// Forces evaluation of exp_res1 in res1. exp_res1 remains unchanged.
xt::xarray<double> res1 = exp_res1;
// changes y
y = arr3;
// Forces evaluation of exp_res1 (with new y) in res2. exp_res1 remains unchanged.
xt::xarray<double> res2 = exp_res1;
// Forces evaluation of exp_res1 (with new y) in res2. exp_res1 remains unchanged.
xt::xarray<double> res3 = exp_res2; |
What happens when x, y is not in scope? |
@SylvainCorlay any thought on implementing named variables ? |
Also something like
Also have some predefined standard functions
|
You're not supposed to call xt::array<double> res = xt:xfunction("x + y + 3") should definitely be replaced by: xt::array<double> res = x + y + 3; or auto exp_res = x + y + 3; if you want to keep the expression for a deferred evaluation. Besides, building Almost all the standard mathematical functions defined in the C++ standard library have their counterpart in |
As mentioned before, what if I do not have x and y when I set up the expression. |
That's the same problem as the first one. The solution is to provide a way to retrieve the arguments of an |
Thanks for this @sirinath I am closing this since it is out of scope at the moment. |
I want to be able to do something like the following
Here I am reusing the expression and also doing the evaluation when needed.
The text was updated successfully, but these errors were encountered: