-
Notifications
You must be signed in to change notification settings - Fork 82
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
std::vector as generator argument #205
Comments
ddemidov
added a commit
that referenced
this issue
May 7, 2016
With e2fad48 you should be able to do what you need: vex::generator::kernel K(ctx, "kernel_name");
// Register symbolic variables as kernel parameters:
K.add_param(sym_X);
K.add_param(sym_Y);
// Pass the recorded body, build the kernel:
K.build(body.str());
// Set the actual parameters, launch the kernel:
K.push_arg(X);
K.push_arg(Y);
K(); The existing API still works, so the above is equivalent to auto K = vex::generator::build_kernel(ctx, "kernel_name", body.str(), sym_X, sym_Y);
K(X, Y); |
Works great! Thanks again. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Denis,
After playing with vex::symbolic some more w/ what we talked about in #203, I am beginning to wonder if there would be an advantage to overloading vex::generator::build_kernel to take std::vector arguments. If you could, I think it would make kernel generation much more flexible. For example, consider the case of solving ODE's. Doing this would allow somebody to write a generic simulation framework that does not have the number of states and system parameters hardcoded, enabling applications where the system may not be known at compile time.
In your symbolic examples you do:
I would like to be able to do something like this:
I'm not familiar enough with your code to see how to implement this or even if it is possible, but one thought I had is that you could simply "unpack" the states and parameters when calling
build_kernel
and then pass them to the your existing implementation asvectorArg1[0], vectorArg1[2],...vectorArg2[0], vectorArg2[1],...
. The same could be done w/ the resulting kernel object.The text was updated successfully, but these errors were encountered: