[Developers] trying to compare autodif with cppad

dave fournier davef at otter-rsch.com
Tue Aug 12 20:26:23 PDT 2014


    There has been a lot of material about TMB lately.  I think that TMB 
uses cppad as its underlying AD engine.   I am interested in
trying to understand if cppad is superior to autodif and if so whether 
ADMB could be modified to use cppad.

As a first attempt I have been working at reproducing the LU 
decomposition to calculate the log of
(the absolutevalue of ) the determinant of a matrix.  The code is 
attached.  myreverse.cpp calculates the log det and
the gradient via reverse model AD using cppad.  myreverse_admb.cpp does 
the same thing using autodif.

For a 300x300 matrix the time required for these calculations is 
approximately  .25 seconds for autodif and 19 seconds for cppad so that
autodif is about 75 times faster.  Obviously there may be techniques 
which can speed up cppad or I may have made
some beginners error.  Perhaps the experts among us could comment.

I could not compare matrices larger than 300x300 because the cppad code 
crashed.  The autodif version
could do a 500x500 matrix in 1.23 seconds and a 1000x1000 matrix in 11 
seconds.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: myreverse_admb.cpp
Type: text/x-c++src
Size: 1243 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myreverse.cpp
Type: text/x-c++src
Size: 3464 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment-0001.cpp>


More information about the Developers mailing list