Adept is a combined automatic differentiation and array software library for the C++ programming language. The automatic differentiation capability facilitates the development of applications involving mathematical optimization. Adept is notable for having applied the template metaprogramming technique of expression templates to speed-up the differentiation of mathematical statements. Along with the efficient way that it stores the differential information, this makes it significantly faster than most other C++ tools that provide similar functionality (e.g. ADOL-C, CppAD and FADBAD), although comparable performance has been reported for Stan and in some cases Sacado. Differentiation may be in forward mode, reverse mode (for use with a Quasi-Newton minimization scheme), or the full Jacobian matrix may be computed (for use with the Levenberg-Marquardt or Gauss-Newton minimization schemes).
Applications of Adept have included computer functionality in the financial field, computational fluid dynamics, physical chemistry, parameter estimation and meteorology. Adept is free software distributed under the Apache License.
Example.
Adept implements automatic differentiation using an operator overloading approach, in which scalars to be differentiated are written as codice_1, indicating an "active" version of the normal codice_2, and vectors to be differentiated are written as codice_3. The following simple example uses these types to differentiate a 3-norm calculation on a small vector:
int main(int argc, const char** argv) {
 using namespace adept;
 Stack stack; // Object to store differential statements
 aVector x(3); // Independent variables: active vector with 3 elements
 x « 1.0, 2.0, 3.0; // Fill vector x
 stack.new_recording(); // Clear any existing differential statements
 adouble J = cbrt(sum(abs(x * x * x))); // Compute dependent variable: 3-norm in this case
 J.set_gradient(1.0); // Seed the dependent variable
 stack.reverse(); // Reverse-mode differentiation
 std::cout « "dJ/dx = "
 « x.get_gradient() « "\n"; // Print the vector of partial derivatives dJ/dx
 return 0;
When compiled and executed, this program reports the derivative as:
References.
 ;templatestyles src="Reflist/styles.css" / ;