Skip to main content

No project description provided

Project description

grast

Automatic differentiation of generic fields for Python

Install

pip install grast

Usage

Create function R^n -> R

from grast import var

x = var('x')
y = var('y')

f = x/y + y**x

Get gradient

df = f.grad()
df_dx = df['x']
df_dy = df['y']

Evaluate with specific arguments

args = dict(x=-3, y=5)
f(args)
df_dx(args)
df_dy(args)

View in symbolic format

print(str(f))
print(str(df_dx))
print(str(df_dy))

References

  1. F. Krawiec, S. Peyton Jones, N. Krishnaswami, T. Ellis, R. A. Eisenberg, A. Fitzgibbon. 2022. Provably correct, asymptotically efficient, higher-order reverse-mode automatic differentiation. Proc. ACM Program. Lang., 6, POPL (2022), 1–30. https://doi.org/10.1145/3498710

  2. Jerzy Karczmarczuk. 1998. Functional Differentiation of Computer Programs. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (Baltimore, Maryland, USA) (ICFP ’98). Association for Computing Machinery, New York, NY, USA, 195-203. https://doi.org/10.1145/289423.289442

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

grast-0.1.1.tar.gz (11.1 kB view hashes)

Uploaded Source

Built Distribution

grast-0.1.1-py3-none-any.whl (14.7 kB view hashes)

Uploaded Python 3

Supported by

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