Skip to main content

ADPY is a Python library for algorithmic differentiation

Project description

ADPY
====

##Description


ADPY is a Python library for algorithmic differentiation (http://en.wikipedia.org/wiki/Automatic_differentiation).
It aims to provide an easy way to extract partial derivatives of vector valued function (Jacobian matrix). In addition it allows to created callable function for obtaining function values using computational graphs.

Features:

* optimize numerical evaluation by using computational graph
* create callable function from Sympy expressions (calls lambdify once and creates a computational graph)
* extract partial derivatives using forward or reverse algorithmic differentiation
* bonus: a small nonlinear solver using all advantages mentioned above



##How to use

Due the small amount of features the handling is quite easy.

For the easiest use you need a callable function which takes a list of float numbers and returns a list.

def f(x):
return [x[0]**2,2*x[1]]

You need a valid values for x which cause no singularities while evaluating the function.

x1 = [1.,2.]

Initialize the ADFUN object.

from ADPY import adfun
adpy_test = adfun(f,x1)

Now you have a callable function with computational graph optimization.

y1 = adpy_test(x1)

If you want to use derivatives just do

adpy_test.init_reverse_jac()

or

adpy_test.init_forward_jac()

Now you can evaluate them using

J_forward = adpy_test.jac_reverse(x1)

or

J_forward = adpy_test.jac_forward(x1)


For more information see the attached examples.

##Install

clone git

git clone https://github.com/zwenson/ADPY
and run setup.py

python setup.py install

or use easy_install

easy_install ADPY

##How it works

Without going in to detail. It uses an overloaded class "adfloat" to record a list of the mathematical operations required to obtain the result. This list is then translated in to python expressions and made executable. The list is also used to perform automatic differentiation.


##To do
* more testing
* add more operations
* maybe add Hessian matrix?
* add Taylor arithmetic?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ADPY-0.11.alpha.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ADPY-0.11.alpha-py2.6.egg (23.1 kB view details)

Uploaded Egg

File details

Details for the file ADPY-0.11.alpha.tar.gz.

File metadata

  • Download URL: ADPY-0.11.alpha.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ADPY-0.11.alpha.tar.gz
Algorithm Hash digest
SHA256 0c985a56598e2003bd1019806164f93b9a2d9a6bcd230c9b3171298496f06978
MD5 d00a4cf569ebbe850357acd023330317
BLAKE2b-256 a824d23fce4bec3ad52d0271d3ff6f69872a4a54271ef6606a2fa56acb281297

See more details on using hashes here.

File details

Details for the file ADPY-0.11.alpha-py2.6.egg.

File metadata

  • Download URL: ADPY-0.11.alpha-py2.6.egg
  • Upload date:
  • Size: 23.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ADPY-0.11.alpha-py2.6.egg
Algorithm Hash digest
SHA256 0789fbbb4773c3bf88e0fcfbac2c929292883b30a86c684162eb108fba326999
MD5 b00778d4ce62922f713622e59f6c0222
BLAKE2b-256 7f025e1894c534ee156fb55c7eb617c58b99db4cf99c03a1bc212d40b2e30af2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page