[CppAD] handling special functions in CppAD

Brad Bell bradbell at seanet.com
Mon Jan 2 20:03:10 EST 2012


If you look at the heading Partial Implementation
     http://www.coin-or.org/CppAD/Doc/user_atomic.xml
you will find the following specification: "The forward the routine, for 
the case k = 0, must be implemented. Functions with the correct 
prototype, that just return false, can be used for the other cases 
(unless they are required by your calculations)."

Forward mode with k=0 evaluates function values, with k=1, it evaluates 
derivatives. So it sound to me like you just need to return false for 
all other values of k and all the other functions. An then use first 
order forward mode to evaluation your derivatives
     http://www.coin-or.org/CppAD/Doc/forwardone.xml

If you look at the forward function in the example
     http://www.coin-or.org/CppAD/Doc/user_tan.cpp.xml
it may help to also look at
     http://www.coin-or.org/CppAD/Doc/tan_forward.xml
in order to understand how the derivative of the tangent is calculated 
for this example. It sounds like you will only need first order 
derivatives and can ignore the code for the higher order cases (just 
return false in those cases).

On 01/02/2012 08:41 AM, Michael Braun wrote:
> Hi.  I am started to look into using CppAD for some research projects, and I have a question about defining special functions.  As an example, I often use the log gamma (lgamma) function, and I know that its first derivative is a digamma function.  How can I tell CppAD this?  I see that there is a CPPAD_USER_ATOMIC macro, but this macro seems to want me to encode the specifics of the forward and reverse modes.  Since I am a mere end-user of AD, and not very familiar with the algorithmic details, I am hoping that there is an easier way to do this.
>
> Thanks,
>
> Michael Braun
> braunm _at_ mit.edu
>
>
>
>
>
>
>
>
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cppad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cppad/attachments/20120102/c41f6d01/attachment.html>


More information about the CppAD mailing list