You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have a number of for loops in my algorithm. They have a fixed iteration number, hence work perfectly fine with CppAD codegen, but they produce a lot of (unnecessary?) temporary variables in the generated code and massively bloat the size of the code.
Is there a way to declare such for loops explicitly to CppADGC such that it results also in loop expressions in the generated code? I found some references to loops in CppADCodeGen/include/cppad/cg/model/patterns , but I'm not sure if it's for this purpose.
A tiny example how to use such functionality would be great :) Thank you!
The text was updated successfully, but these errors were encountered:
You can create loops with CppADCodeGen.
Unfortunately, they cannot be defined explicitly.
CppADCodeGen can, however, attempt to detect these loops (and reuse temporary variables) if you provide some hints to CppADCodeGen.
The key method is:
CppadCodeGen will detect and then create loops in the generated source code if each iteration is independent, that is, if the results from one iteration are not used by the next to determine dependent variable. That is, if it is possible to write something like:
Hi,
I have a number of for loops in my algorithm. They have a fixed iteration number, hence work perfectly fine with CppAD codegen, but they produce a lot of (unnecessary?) temporary variables in the generated code and massively bloat the size of the code.
Is there a way to declare such for loops explicitly to CppADGC such that it results also in loop expressions in the generated code? I found some references to loops in CppADCodeGen/include/cppad/cg/model/patterns , but I'm not sure if it's for this purpose.
A tiny example how to use such functionality would be great :) Thank you!
The text was updated successfully, but these errors were encountered: