vgvassilev/clad
clad -- automatic differentiation for C/C++
What it solves
Clad provides automatic differentiation (AD) for C++, allowing developers to automatically generate C++ code for computing derivatives of mathematical functions. This eliminates the need to manually derive and code the gradient, Hessian, or Jacobian of complex functions, which is often error-prone and tedious.
How it works
Clad is implemented as a plugin for the Clang compiler and is based on the LLVM compiler infrastructure. It uses source-transformation to analyze C++ source code and automatically generate the corresponding C++ code for the derivative. It supports both forward-mode and reverse-mode AD, as well as combinations of both for higher-order derivatives.
Who it’s for
It is designed for C++ developers and researchers who need to compute derivatives of mathematical functions for optimization, machine learning, or scientific computing, and those who need to estimate floating-point errors in their programs.
Highlights
- Multiple AD Modes: Supports forward-mode, reverse-mode, and combined modes for Hessian and Jacobian matrices.
- Comprehensive API: Provides dedicated functions like
clad::differentiate,clad::gradient,clad::hessian, andclad::jacobian. - Floating-Point Error Estimation: Includes a specialized tool (
clad::estimate_error) to compute the floating-point error of a program. - Compiler Integration: Works as a Clang plugin or within Jupyter Notebooks via the xeus-cpp kernel.
- C++ Feature Support: Extensive coverage of modern C++ features with a robust fallback and recovery system.
Related
- Project
- Project
- Project
- Project
- Project