Boost logo

Boost :

Subject: Re: [boost] [math] Please give me some advice.
From: Dongfei Yin (yin.dongfei_at_[hidden])
Date: 2009-03-09 10:19:54


Hi,
    I just write some simple example in the main.cpp. now, I have an idea, what about to initialize the variable or
assign before the expression. like this,
    variable<0> x(3.0);
    double x1 = (x + x * x)(); // x1 == 12
    x = 4.0;
    double x2 = d(x + x * x, x)(); // x2 == 9

from the example, you can see that some of the expression is simplified from the output.
that means the result of d(x + x, x) is 2 before running.

I don't want to use variable<0>::type to define a variable, so some overload operator is needed.
now, I use const_<N>() to define compile time variable, it seems not so convenient.

what do you think about it. I will improve it according to your advice.

BTW, I think it is easier than existing tools for automatic differentiation, right?

Dongfei.


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