ad3(2rheolef) | rheolef-7.0 | ad3(2rheolef) |
ad3 - automatic differentiation with respect to variables in R^3
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.
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;
Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr> GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
rheolef-7.0 | rheolef-7.0 |