[CppAD] handling special functions in CppAD

Brad Bell bradbell at seanet.com
Tue Jan 3 07:14:18 EST 2012


I forgot to mention in my previous post that the simplest approach is to 
program up an approximation for the log gamma function and then let 
CppAD do the rest.

For example, see how the error function is approximated at
     https://projects.coin-or.org/CppAD/browser/trunk/cppad/local/erf.hpp
You would probably only need to implement the log gamma function for 
AD<double> arguments, instead of for an arbitrary base type as is done 
for the error function.

There are two reasons you might want to take the user atomic function 
approach, as opposed to this simple approach. One is that you want to 
improve speed and reduce memory usage. The other is that you have 
routines written in double for the log gamma and its derivative and you 
do not wish to make an AD<double> implementation.

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/20120103/ef960448/attachment.html>


More information about the CppAD mailing list