\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
contents#
Table of Contents#
A C++ Object Library and Python Interface to CppAD
1 Installing cppad_py
1.1 Install cppad_py Python Module
1.1.1 setup.py Error Messages
1.2 Settings Used by Install and Test Scripts
1.3 Use System Package Manager to Install Some Dependencies
1.4 Get cppad
1.4.1 Uninstall get_cppad.sh
1.5 Get cppad_mixed
1.5.1 Uninstall get_cppad_mixed.sh
1.6 Old Configure and Build the cppad_py Python Module
1.6.1 Error Messages During Installation
2 Numerical Examples
2.1 An AD Compatible Matrix Inverse Routine
2.1.1 Example Computing Derivatives of Matrix Inversion
2.2 One Fourth Order Runge-Kutta ODE Step
2.2.1 Example Computing Derivative A Runge-Kutta Ode Solution
2.3 One Third Order Rosenbrock ODE Step
2.3.1 Example Computing Derivative A Rosenbrock Ode Solution
2.4 Multiple Ode Steps
2.4.1 Example Computing Derivative A Runge-Kutta Ode Solution
2.5 A Helper Class That Defines Functions Needed for Optimization
2.5.1 Example Using optimize_fun_class with Scipy Optimization
2.6 A Susceptible Exposed Infectious Recovered and Death Model
2.6.1 Example Using seris_model
2.7 Example Fitting an SEIRWD Model for Covid-19
3 The CppAD Py Libraries
3.1 The Python Library
3.1.1 CppAD Py AD Functions
3.1.1.1 Declare Independent Variables and Start Recording
3.1.1.1.1 Python: Using Dynamic Parameters: Example and Test
3.1.1.2 Abort Recording
3.1.1.2.1 Python: Abort Recording a_double Operations: Example and Test
3.1.1.3 Stop Current Recording and Store Function Object
3.1.1.3.1 Python: Purpose of a_fun Objects: Example and Test
3.1.1.4 Properties of a Function Object
3.1.1.4.1 Python: d_fun Properties: Example and Test
3.1.1.5 Check for Nan in a Function Object
3.1.1.5.1 Python: Example Turning of Checking For Nan
3.1.1.6 New Dynamic Parameters
3.1.1.7 Jacobian of an AD Function
3.1.1.7.1 Python: Dense Jacobian Using AD: Example and Test
3.1.1.8 Hessian of an AD Function
3.1.1.8.1 Python: Dense Hessian Using AD: Example and Test
3.1.1.9 Forward Mode AD
3.1.1.9.1 Python: Forward Mode AD: Example and Test
3.1.1.10 Reverse Mode AD
3.1.1.10.1 Python: Reverse Mode AD: Example and Test
3.1.1.11 Optimize an AD Function
3.1.1.11.1 Python: Optimize an d_fun: Example and Test
3.1.1.12 Json Representation of AD Computation Graph
3.1.1.12.1 Python to_json: Example and Test
3.1.1.12.2 Python from_json: Example and Test
3.1.2 Python Sparsity Routines
3.1.2.1 Sparsity Patterns
3.1.2.1.1 Python: Sparsity Patterns: Example and Test
3.1.2.2 Sparse Matrices
3.1.2.2.1 Python: Sparsity Patterns: Example and Test
3.1.2.3 Jacobian Sparsity Patterns
3.1.2.3.1 Python: Jacobian Sparsity Patterns: Example and Test
3.1.2.4 Hessian Sparsity Patterns
3.1.2.4.1 Python: Hessian Sparsity Patterns: Example and Test
3.1.2.5 Computing Sparse Jacobians
3.1.2.5.1 Python: Computing Sparse Jacobians: Example and Test
3.1.2.6 Computing Sparse Hessians
3.1.2.6.1 Python: Hessian Sparsity Patterns: Example and Test
3.1.3 Python Utilities
3.1.3.1 Convert a Numpy Array to a cppad_py Vector
3.1.3.2 Convert a cppad_py Vector to a Numpy Array
3.1.4 Laplace Approximation of Mixed Effects Models
3.1.4.1 Mixed Class Constructor
3.1.4.1.1 Mixed Class Constructor: Example and Test
3.1.4.2 Mixed Class Warnings
3.1.4.2.1 Warnings: Example and Test
3.1.4.3 Mixed Class Fatal Errors
3.1.4.3.1 fatal_error: Example and Test
3.1.4.4 Fixed Effects Likelihood
3.1.4.4.1 fix_likelihood: Example and Test
3.1.4.5 Fixed Effects Constraint Function
3.1.4.5.1 fix_constraint: Example and Test
3.1.4.6 Random Effects Likelihood
3.1.4.6.1 ran_likelihood: Example and Test
3.1.4.7 Optimize The Fixed Effects
3.1.4.7.1 A Very Simple Optimize Fixed Effects: Example and Test
3.1.4.7.2 The Ipopt Example Problem: Example and Test
3.1.4.8 Optimize The Random Effects
3.1.4.8.1 optimize_random: Example and Test
3.1.4.9 Hessian of Fixed Effects Objective
3.1.4.9.1 ran_likelihood: Example and Test
3.1.4.10 Hessian of Random Effects Objective
3.1.4.10.1 ran_likelihood: Example and Test
3.1.5 Steps To Add More Python Functions
3.2 The C++ Library
3.2.1 Converting CppAD Errors To Python Exceptions
3.2.1.1 Python: Example CppAD Error Message
3.2.2 CppAD Py AD Functions
3.2.2.1 Declare Independent Variables and Start Recording
3.2.2.1.1 C++: Using Dynamic Parameters: Example and Test
3.2.2.2 Abort Recording
3.2.2.2.1 C++: Abort Recording a_double Operations: Example and Test
3.2.2.3 Stop Current Recording and Store Function Object
3.2.2.4 Properties of a Function Object
3.2.2.4.1 C++: function Properties: Example and Test
3.2.2.5 Change The Dynamic Parameters
3.2.2.6 Jacobian of an AD Function
3.2.2.6.1 C++: Dense Jacobian Using AD: Example and Test
3.2.2.7 Hessian of an AD Function
3.2.2.7.1 C++: Dense Hessian Using AD: Example and Test
3.2.2.8 Forward Mode AD
3.2.2.8.1 C++: Forward Mode AD: Example and Test
3.2.2.9 Reverse Mode AD
3.2.2.9.1 C++: Reverse Mode AD: Example and Test
3.2.2.10 Optimize an AD Function
3.2.2.10.1 C++: Optimize an d_fun: Example and Test
3.2.2.11 Json Representation of AD Computational Graph
3.2.2.11.1 C++: to_json: Example and Test
3.2.2.11.2 C++: from_json: Example and Test
3.2.2.12 Check For Nan In Function or Derivative Results
3.2.2.12.1 C++: Check For Nan in Function Result: Example and Test
3.2.3 CppAD Py Sparse Calculation
3.2.3.1 Sparsity Patterns
3.2.3.1.1 C++: Sparsity Patterns: Example and Test
3.2.3.2 Sparse Matrices
3.2.3.2.1 C++: Sparsity Patterns: Example and Test
3.2.3.3 Jacobian Sparsity Patterns
3.2.3.3.1 C++: Jacobian Sparsity Patterns: Example and Test
3.2.3.4 Hessian Sparsity Patterns
3.2.3.4.1 C++: Hessian Sparsity Patterns: Example and Test
3.2.3.5 Computing Sparse Jacobians
3.2.3.5.1 C++: Computing Sparse Jacobians: Example and Test
3.2.3.6 Computing Sparse Hessians
3.2.3.6.1 C++: Hessian Sparsity Patterns: Example and Test
3.2.4 C++ Utilities
3.2.4.1 Convert Objects Between cppad_mixed and cppad_py
3.2.4.1.1 Convert AD Vector From Standard to CppAD
3.2.4.1.2 Convert AD Vector From CppAD to Standard
3.2.4.1.3 Convert double Vector From Standard to CppAD
3.2.4.1.4 Convert double Vector From CppAD to Standard
3.2.4.1.5 Convert Sparse Matrix from cppad_mixed to cppad_py
3.2.4.2 Exception Handling
3.2.4.2.1 C++: CppAD Py Exception Handling: Example and Test
3.2.4.2.2 Python: CppAD Py Exception Handling: Example and Test
3.2.4.3 Get The cppad_py build_type
3.3 CppAD Py AD Scalars
3.3.1 The a_double Constructor
3.3.2 a_double Unary Plus and Minus
3.3.2.1 C++: a_double Unary Plus and Minus: Example and Test
3.3.2.2 Python: a_double Unary Plus and Minus: Example and Test
3.3.3 Properties of an a_double Object
3.3.3.1 C++: a_double Properties: Example and Test
3.3.3.2 Python: a_double Properties: Example and Test
3.3.4 a_double Binary Operators with an AD Result
3.3.4.1 Python: a_double Binary Operators With AD Result: Example and Test
3.3.4.2 C++: a_double Binary Operators With AD Result: Example and Test
3.3.5 a_double Comparison Operators
3.3.5.1 C++: a_double Comparison Operators: Example and Test
3.3.5.2 Python: a_double Comparison Operators: Example and Test
3.3.6 a_double Assignment Operators
3.3.6.1 C++: a_double Assignment Operators: Example and Test
3.3.6.2 Python: a_double Assignment Operators: Example and Test
3.3.7 Unary Functions with AD Result
3.3.7.1 C++: a_double Unary Functions with AD Result: Example and Test
3.3.7.2 Python: a_double Unary Functions with AD Result: Example and Test
3.3.8 AD Conditional Assignment
3.4 CppAD Py Vectors
3.5 Add New Features to cppad_py
4 CppAD Py Release Notes