# CppADCodeGen

A C++ library that extends CppAD to generate C/C++ source code for computing derivatives of mathematical models, combining operator-overloading with compiled, source-generated derivatives.

CppADCodeGen extends the CppAD automatic differentiation library so that, instead of only evaluating derivatives through operator overloading, it can generate C/C++ source code that computes them, which the project describes as a hybrid form of automatic differentiation. Evaluating a compiled derivative model this way can be orders of magnitude faster than a plain operator-overloading approach.

Besides C/C++ source, it can generate LaTeX for documentation, HTML with MathML for displaying an algorithm in a browser, and dot source files for graphing a model with Graphviz. It supports both double and float model types, efficient handling of sparse Jacobians and Hessians, and differentiation-index reduction for Differential Algebraic Equations using several named methods. Generated source can be compiled statically ahead of time and linked, or JIT-compiled at runtime using Clang/LLVM. It is a header-only C++14 library requiring CppAD and a C++14 compiler, with Clang/LLVM needed only for JIT compilation and Eigen 3 needed only for DAE index reduction, and is dual-licensed under the EPL and GPL so it can be used in open-source or closed-source projects.

Website: https://github.com/joaoleal/CppADCodeGen
