bradbell / cppad_py

A C++ Object Library and Python Interface to Cppad
https://cppad-py.readthedocs.io
15 stars 3 forks source link

cppad_py: A Python Interface To CppAD

Documentation

https://cppad-py.readthedocs.io

Description

cppad_py contains the following:

Simple Example

# BEGIN PYTHON
import numpy
import cppad_py
x    = numpy.array( [ 1, 2], dtype = float)
ax   = cppad_py.independent(x)
ay   = ax * ax
f    = cppad_py.d_fun(ax, ay)
x[0] = 2.0
x[1] = 3.0
y    = f.forward(0, x)
assert all( y == x * x )
J    = f.jacobian(x)
assert J.shape == (2,2)
assert J[0,0] == 2.0 * x[0]
assert J[0,1] == 0.0
assert J[1,0] == 0.0
assert J[1,1] == 2.0 * x[1]
# END PYTHON

Install

setup.py

Error

If you get a warning or error message during the install process; see install error