github autodiff/autodiff v0.5.0
Improvement in derivative, gradient, and Jacobian functions

latest releases: v1.1.2, v1.1.1, v1.1.0...
4 years ago

This release introduces BREAKING CHANGES! These are easy to fix, though.
Read below.

From now on, methods derivative, gradient, and jacobian require the
use of auxiliary functions wrt and the newly introduced one at.

Unfortunately, it was not possible to keep the previous version of these functions,
since they conflicted with the newly introduced versions in a way quite difficult to solve.

This release also permits the calculation of gradient and Jacobian with respect to
some variables, instead of all of them.

Examples of how these functions are used now:

// f = f(x)
double dudx = derivative(f, wrt(x), at(x));
// f = f(x, y, z)
double dudx = derivative(f, wrt(x), at(x, y, z));
double dudy = derivative(f, wrt(y), at(x, y, z));
double dudz = derivative(f, wrt(z), at(x, y, z));
// f = f(x), scalar function, where x is an Eigen vector
VectorXd g = gradient(f, wrt(x), at(x));

// Compuring gradient with respect to only some variables
VectorXd gpartial = gradient(f, wrt(x.tail(5)), at(x));
// F = F(x), vector function, where x is an Eigen vector
MatrixXd J = jacobian(f, wrt(x), at(x));

// F = F(x, p), vector function with params, where x and p are Eigen vectors
MatrixXd Jx = jacobian(f, wrt(x), at(x, p));
MatrixXd Jp = jacobian(f, wrt(p), at(x, p));

// Compuring Jacobian with respect to only some variables
MatrixXd Jpartial = jacobian(f, wrt(x.tail(5)), at(x));

This release also permits one to retrieve the evaluated value of function during
a call to the methods derivative, gradient, and jacobian:

// f = f(x)
dual u;
double dudx = derivative(f, wrt(x), at(x), u);
// f = f(x), scalar function, where x is an Eigen vector
dual u;
VectorXd g = gradient(f, wrt(x), at(x), u);
// F = F(x), vector function, where x is an Eigen vector
VectorXdual F;
MatrixXd J = jacobian(f, wrt(x), at(x), F);

Don't miss a new autodiff release

NewReleases is sending notifications on new releases.