[SciPy-User] [ANN] ALGOPY 0.21, algorithmic differentiation in Python
Sebastian Walter
sebastian.walter@gmail....
Sun Aug 1 07:05:58 CDT 2010
I'm happy to announce the first official release of ALGOPY in version 0.2.1.
Rationale:
~~~~~~~~
The purpose of ALGOPY is the evaluation of higher-order derivatives in
the forward and reverse mode of Algorithmic Differentiation (AD) using
univariate Taylor polynomial arithmetic. Particular focus are
functions that contain numerical linear algebra functions (e.g. inv,
dot, eigh, qr, cholesky,...) as they often appear in statistically
motivated functions.
Download:
~~~~~~~~~
http://pypi.python.org/pypi/algopy/0.2.1
or bleeding edge versions from from http://github.com/b45ch1/algopy
Documentation:
~~~~~~~~~~~~
available at http://packages.python.org/algopy/
OS Support:
~~~~~~~~~~
Linux, Windows (tested with pythonxy), should also work on Mac
Software Dependencies:
~~~~~~~~~~~~~~~~~~~~
for the core: numpy, scipy
for testing: nose
Exampe Session:
~~~~~~~~~~~~~
Consider the contrived example where it is the goal to compute the
directional derivative df/dx_1 :
>>> import numpy; from numpy import log, exp, sin, cos
>>> import algopy; from algopy import UTPM, dot, inv, zeros
>>>
>>> def f(x):
... A = zeros((2,2),dtype=x)
... A[0,0] = numpy.log(x[0]*x[1])
... A[0,1] = numpy.log(x[1]) + exp(x[0])
... A[1,0] = sin(x[1])**2 + cos(x[0])**3.1
... A[1,1] = x[0]**cos(x[1])
... return log( dot(x.T, dot( inv(A), x)))
...
>>>
>>> x = UTPM(zeros((2,1,2),dtype=float))
>>> x.data[0,0] = [1,2]
>>> x.data[1,0] = [1,0]
>>> y = f(x)
>>>
>>> print 'normal function evaluation f(x) = ',y.data[0,0]
normal function evaluation f(x) = 0.641250189986
>>> print 'directional derivative df/dx1 = ',y.data[1,0]
directional derivative df/dx1 = 1.62982340133
More information about the SciPy-User
mailing list