vgvassilev/clad

clad -- automatic differentiation for C/C++

What it solves

Clad automates the process of calculating derivatives for mathematical functions written in C++. Instead of manually deriving complex formulas or relying on numerical approximations, it uses source-code transformation to generate efficient, accurate C++ code for derivatives.

How it works

Clad operates as a plugin for the Clang compiler. By using the LLVM infrastructure, it analyzes your C++ source code and injects the necessary logic to compute derivatives. It supports multiple modes, including forward-mode (for directional derivatives), reverse-mode (for gradients), and combined modes for calculating Hessian and Jacobian matrices. It also includes a tool for estimating floating-point errors.

Who it’s for

It is designed for C++ developers and researchers working in fields like scientific computing, machine learning, or physics, where high-performance mathematical differentiation is required.

Highlights

  • Supports both forward-mode and reverse-mode automatic differentiation.
  • Capable of computing Hessian and Jacobian matrices.
  • Includes a utility for estimating floating-point errors in programs.
  • Integrates directly into the Clang compiler as a plugin.
  • Compatible with Jupyter Notebooks via the xeus-cpp kernel for interactive development.

Related

  • Project
  • Project
  • Project
  • Project
  • Project