C++ library enabling automatic differentiation for mathematical computations
Automatic differentiation made easier for C++
autodiff$ clang++ -I$(brew --prefix autodiff)/include myprogram.cpp -o myprogram$ cat > derivative.cpp << 'EOF'
#include <autodiff/forward/dual.hpp>
using namespace autodiff;
int main() {
dual x = 2.0;
dual y = x * x + 2*x + 1;
std::cout << "f(x)=" << y.val << ", f'(x)=" << y.grad << std::endl;
}
EOF
clang++ -I$(brew --prefix autodiff)/include derivative.cpp -o derivative && ./derivative$ echo 'find_package(autodiff REQUIRED)
target_link_libraries(myapp autodiff::autodiff)' >> CMakeLists.txt