contents

Table of Contents

Compare Algorithmic Differentiation Packages

1 Get Started Using cmpad
2 Getting AD Packages
2.1 Create and Activate cmpad Environment
2.2 Getting Optional C++ Packages
2.3 Getting Optional Python Packages
3 The cmpad Main Program
3.1 The cmpad Csv File Columns
3.2 Example and Test Using Main Programs
4 Algorithms Used to Compare Packages
4.1 Determinant Using Expansion by Minors
4.2 An ODE Solution
4.2.1 A Fourth Runge-Kutta ODE Step
4.3 Linear Least Squares Objective
5 C++ Algorithmic Differentiation
5.1 Main Program C++ Implementation
5.1.1 Parse Command Line Arguments
5.2 Preprocessor Definitions and Configured Types
5.3 C++ Abstract Class For Calculating Gradient
5.3.1 Example and Test of Gradient
5.3.1.1 Check C++ Gradient of Determinant
5.3.1.2 C++ Check Gradient of an_ode
5.3.1.3 Check C++ Gradient of Determinant
5.3.1.4 Example and Test of Gradient Using adept
5.3.1.5 Example and Test of Gradient Using adolc
5.3.1.6 Example and Test of Gradient Using autodiff
5.3.1.7 Example and Test of Gradient Using codi
5.3.1.8 Example and Test of Gradient Using cppad
5.3.1.9 Example and Test of Gradient Using cppad_jit
5.3.1.10 Example and Test of Gradient Using cppadcg
5.3.1.11 Example and Test of Gradient Using sacado
5.3.1.12 Example and Test of Gradient Using xad
5.3.2 Calculate Gradient Using Adept
5.3.3 Calculate Gradient Using ADOL-C
5.3.4 Calculate Gradient Using autodiff
5.3.5 Calculate Gradient Using CoDiPack
5.3.6 Gradients Using CppAD
5.3.6.1 Calculate Gradient Using CppAD
5.3.6.2 Special Version of Gradient Using CppAD
5.3.7 Calculate Gradient Using CppAD Jit
5.3.8 Calculate Gradient Using CppAD CodeGen
5.3.9 Calculate Gradient Using Sacado
5.3.10 Calculate Gradient Using XAD
5.4 C++ Algorithms Used to Compare Packages
5.4.1 C++ Determinant Using Expansion by Minors
5.4.1.1 C++ det_by_minor: Source Code
5.4.1.2 C++ Determinant of a Minor
5.4.1.2.1 det_of_minor: Source Code
5.4.1.2.2 C++ Example and Test of det_of_minor
5.4.1.3 Example and Test of det_by_minor
5.4.2 Use C++ Runge-Kutta Method to Solve an ODE
5.4.2.1 an_ode: Source Code
5.4.2.2 Example and Test of an_ode
5.4.2.3 A C++ Fourth Order Runge Kutta Solver
5.4.2.3.1 C++ runge_kutta Source Code
5.4.2.3.2 Example and Test of C++ runge_kutta
5.4.3 C++ Linear Least Squares Objective
5.4.3.1 C++ llsq_obj: Source Code
5.4.3.2 C++ valvector Special Version of llsq_obj
5.4.3.3 Example and Test of llsq_obj
5.4.3.3.1 Example and Test of CppAD Special llsq_obj
5.5 Simple Types
5.5.1 The Option Type
5.5.2 The cmpad Vector Template Type
5.5.3 Vector of Vector of String Type
5.5.4 The New Abstract Class for a C++ Function Object
5.5.4.1 Example and Test of fun_obj
5.5.5 Including CppAD and CppADCodeGen
5.6 General Purpose C++ Utilities
5.6.1 Determine C++ Execution Speed
5.6.1.1 Example and Test of fun_speed
5.6.2 C++ Check That Values are Nearly Equal
5.6.2.1 Example and Test of C++ near_equal
5.6.3 Read a Csv File
5.6.3.1 Example and Test of csv_read
5.6.4 Record a C++ Speed Result in a Csv File
5.6.4.1 Example and Test of C++ csv_speed
5.6.5 Write a Csv File
5.6.5.1 Example and Test of csv_write
5.6.6 Simulate a [0,1] Uniform Random Variate
5.6.6.1 Example and Test of uniform_01
6 Python Algorithmic Differentiation
6.1 Main Program Python Implementation
6.2 Python Function Object
6.3 Python Algorithms Used to Compare Packages
6.3.1 Python Determinant Using Expansion by Minors
6.3.1.1 Python det_by_minor: Source Code
6.3.1.2 Python Example and Test of det_by_of_minor
6.3.1.3 Python Determinant of a Minor
6.3.1.3.1 Python det_of_minor: Source Code
6.3.1.3.2 Python Example and Test of det_of_minor
6.3.2 Use Python Runge-Kutta Method to Solve an ODE
6.3.2.1 an_ode: Python Source Code
6.3.2.2 Example and Test of an_ode
6.3.2.3 Python Fourth Order Runge Kutta Method
6.3.2.3.1 Python runge_kutta Source Code
6.3.2.3.2 Example and Test of Python runge_kutta
6.3.3 Python Linear Least Squares Objective
6.3.3.1 Python Example and Test of llsq_obj
6.3.4 The Like Numpy Vector Concept
6.4 Python Gradient Calculation
6.4.1 Calculate Gradient Using Autograd
6.4.1.1 Example and Test of autograd Gradient
6.4.2 Calculate Gradient Using cppad_py
6.4.2.1 Example and Test of cppad_py Gradient
6.4.3 Calculate Gradient Using JAX
6.4.3.1 Example and Test of jax Gradient
6.4.4 Calculate Gradient Using PyTorch
6.4.4.1 Example and Test of Torch Gradient
6.4.5 Check Python Gradient of Determinant
6.4.6 Python Check Gradient of an_ode
6.4.7 Python Check Gradient of Linear Least Squares Objective
6.5 General Purpose Python Utilities
6.5.1 Determine Python Execution Speed
6.5.1.1 Example and Test of Python fun_speed
6.5.2 Python: Check That Values are Nearly Equal
6.5.2.1 Example and Test of Python near_equal
6.5.3 Record a Python Speed Result in a Csv File
6.5.3.1 Example and Test of Python csv_speed
7 Compare AD Release Notes
7.1 Release Notes for 2024