[CppAD] Arbitrary levels of autodifferentiation

Brad Bell bradbell at seanet.com
Wed Sep 19 17:58:08 EDT 2018


There is a new feature in CppAD that should enable arbitrary levels of AD; see the heading 09-19 on
     https://coin-or.github.io/CppAD/doc/whats_new_18.htm

Note that this required dynamic parameters to really work well.
You can see this in the example
      https://coin-or.github.io/CppAD/doc/base2ad.cpp.htm
Where the dynamic parameters in one function are the independent variables for another.

On 06/03/2018 04:35 PM, Andrew Spielberg wrote:
> Hi all,
>
> I am trying to come up with a way to get arbitrary levels of AutoDifferentiation using CppAD.  
> Given a function f : R-->R, I would like to be able to differentiate expressions such as, say:
>
> g(x) = (f'(x) + f''(x)) * f(x)
>
> in order to get dg/dx.
>
> Now, obviously, I can try to rewrite this as a single function just in f whose derivative will be 
> equal to dg/dx, but it that is not always possible.  To this end, I am aware of the multiple 
> levels example:
>
> https://coin-or.github.io/CppAD/doc/mul_level.cpp.htm 
> <https://coin-or.github.io/CppAD/doc/mul_level.cpp.htm>
>
> However, as far as I can tell, the number of differentiations here must be known a priori, and the 
> correct number of nestings of ADFun must be chosen up front.  In some cases though (say, when 
> dealing with series of unknown length), that number won't be known up front.
>
> I am wondering if there is a way to get arbitrary levels of autodifferentiation somehow, so that I 
> can treat gradients not unlike an arithmetic function.  I was thinking, it might be possible with 
> only two levels of ADFun - every time a ADFun<ADFun<T>> is differentiated, it returns an ADFun<T> 
> - and then maybe this can be rewrapped in a new ADFun< > before being reused.  I don't know if 
> this works though.
>
> Are arbitrary levels possible?  If not, is there another way to achieve what I want?
>
>
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/cppad



More information about the CppAD mailing list