-
-
Notifications
You must be signed in to change notification settings - Fork 191
Add variadic version of scalar_seq_view
#2951
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
Comments
Are you only reading through it once in sequential order? For sequential reads we could just do something where we store a tuple of references to the arguments constructor and the sizes and iterate with a https://godbolt.org/z/cfbEzTY44 Do you need it to have a operator[]? We could just mock that inside of the class and actually when |
Actually can you show me where you need to do that? Idt I like what I wrote there |
Oh interesting, thanks for prototyping! The best example for the use-case is anything that needs to use the
It would likely be iterated through multiple times, and I don't know if it could always be guaranteed to be sequential, so that's why I thought an index-lookup approach would be best |
Description
In the finite-diff framework PR (and some other functions that I'm planning), we need to be able to sequentially iterate through each element of all arguments passed to a function.
The current approach is to use the
serializer
/deserializer
framework which copies all values to a singleEigen::VectorXd
and then re-constructs the arguments to the appropriate shape/size by passing in the original arguments. This obviously introduces pretty significant overhead in both copy and memory costs.A better alternative would be to extend
scalar_seq_view
to take a variadic number of arguments, and then in the[]
/()
index operator use a hash table to map the input index to the appropriate value in the appropriate argumentExample
In Math pseudo-code, something like:
Current Version:
v4.7.0
The text was updated successfully, but these errors were encountered: