Challenge: Automatic differentiation in D

Bill Baxter wbaxter at gmail.com
Tue May 12 10:59:45 PDT 2009


On Tue, May 12, 2009 at 10:48 AM, Steve Teale
<steve.teale at britseyeview.com> wrote:
> Bill Baxter Wrote:
>
>> If I had the time I'd love to play around with automatic differentiation in D.
>> http://en.wikipedia.org/wiki/Automatic_differentiation
>>
>> I played around with it a bit in C++ before, using the operator
>> overloading approach, but didn't go much beyond basic polynomials with
>> it.
>> The page above offers something of a challenge for a potential D implementation:
>> """
>> Operator overloading for forward accumulation is easy to implement,
>> and also possible for reverse accumulation. However, current compilers
>> lag behind in optimizing the code when compared to forward
>> accumulation.
>> """
>>
>>[...]
>> Just throwing this out there, because occasionally there are folks
>> looking for little self-contained projects to undertake.  And because
>> I think AD is nifty.
>>
>> --bb
>
> Bill,
>
> D4 maybe. In the present mood I think you are spitting in the wind!

I'm just proposing it as a fun project if anyone is interested.
Shouldn't require any compiler changes.  Unless roadblocks are found
that require some compiler changes, in which case it's better to know
about those now than later on.   I see AD as a category of interesting
numerical techniques that a sufficiently advanced compiler can make
much less painful to use.  Like expression templates.  I think D2 has
most of what would be needed already.  The basic idea of AD (forward
AD, anyway) is pretty simple and quite elegant IMO, and worth learning
about anyway, for anyone interested in numerical computing,
computational physics, etc.

--bb



More information about the Digitalmars-d mailing list