Boost logo

Boost :

From: Martin Weiser (weiser_at_[hidden])
Date: 2002-02-13 04:42:44


On Tuesday, 12. February 2002 21:13, James Adelman wrote:

> Sorry, I was unclear. I was suggesting something
> different from what your code does -- a tool for
> differentiating expressions into closed form at
> compile time. Something that would look like:
>
> typedef
> reciprocal<sub<constant<1>,exp<negate<var<0> > >
>
> > > logistic; // 1/(1-exp(-x))
>
> //...
> deriv<logistic,1>(x);
>
> I think that qualifies at messy before I even
> think about implementing it.

A few months ago I implemented something similar. Well, the
implementation is somewhat messy, but a nice intellectual challenge, as
most template metaprogramming tasks tend to be.

Using this kind of "compile time automatic" or "static symbolic" or
"expression template" differentiation is, however, quite simple. And it
works fine out of the box. The major drawback is that it takes *really
long* to compile, which renders it almost useless for practical
applications.

If you'd like to take a look, you can find the header files containing
all the expression template differentiation code as well as some test
files at http://www.zib.de/weiser/etd/etd.tar.gz

It's somewhat commented, but not really documented.

Martin

-- 
Dr. Martin Weiser            Zuse Institute Berlin
weiser_at_[hidden]                Scientific Computing
http://www.zib.de/weiser     Numerical Analysis and Modelling

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk