Re: [boost] [math] Please give me some advice.

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.
participants (1)
-
Dongfei Yin