|
Boost : |
From: j.adelman_at_[hidden]
Date: 2002-02-12 15:13:15
Quoting Peter Schmitteckert
<boost_at_[hidden]>:
> Salut,
>
> On Tuesday 12 February 2002 20:20,
j.adelman_at_[hidden] wrote:
>
> > Does anyone else see a need for a template-
based
> > library for these kind of calculations? If it
> > works, it won't be pretty, but it'll save some
>
> Why won't it be pretty ? Have I missed
something ?
> I like my aproach because it's simple.
>
> > anguish from when the paper-and-pencil method
> > fails you. The obvious question is whether
the
>
> That's one benefit: reducing typos. On does not
need to
> type the derivative of a function.
>
> > speed benefit is worth it. I think it is when
> > the calculation will occur in the inner loop
of a
> > program which takes 4 days to run, and that's
the
> > cut-down version I ran when I realised how
long
> > the full version would take to run.
>
> Well, a typical application would be an inner
loop of a
> differential equation solver. These tend to run
very long
> if you have to apply them on a grid.
> And yes, I'd be happy if my application would
finish it 4 days :).
>
> Best wishes,
> Peter
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.
James
-------------------------------------------------
This mail sent through UK Online webmail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk