Closed jeff-regier closed 8 years ago
The only way I can think of is to use the rdiff
method working on expressions (not the one working on functions) and edit the generated expression (replacing the dx = zeros(..)
with fill!(dx,0.)
),
dx
being the preallocated variable.
If you want to wrap the resulting expression in a function you can either create dx
in a closure around the function or require the user to pass it in the function arguments.
I'll do that. Thanks for the suggestion!
Is there a way to pre-allocate an array to store derivatives, and have ReverseDiffSource write derivatives to that array, rather than allocating new memory at every call?