ad32rheolef
Automatic differentiation with respect to variables in r^3
Overview
The ad3 class defines a forward automatic differentiation in R^3 for computing automatically the gradient of a function from R^3 to R. The implementation uses a simple forward automatic differentiation method.
Examples
template<class T>
T f (const point_basic<T>& x) { return sqr(x[0]) + x[0]*x[1] + 1/x[2]; }
...
point_basic<ad3> x_ad = ad3::point (x);
ad3 y_ad = f(x_ad);
cout << "f ="<<y_ad <<endl
<< "gradq(f)="<<y_ad.grad() <<endl;