Skip to main content

sparsegrad

Travis-CI-badge Readthedocs-badge

sparsegrad automatically and efficiently calculates analytical sparse Jacobian of arbitrary numpy vector valued functions. It is designed to be useful for solving large systems of non-linear equations. sparsegrad is memory efficient because it does not use the graph of computation. Arbitrary computations are supported through indexing, matrix multiplication, branching, and custom functions.

Taking Jacobian with respect to variable x is done by replacing numerical value of x with sparsegrad seed

>>> import numpy as np
>>> import sparsegrad.forward as ad
>>> def f(x):
...       return x-x[::-1]
>>> x=np.linspace(0,1,3)
>>> print(f(ad.seed(x)).dvalue)
(0, 0)      1.0
(0, 2)      -1.0
(2, 0)      -1.0
(2, 2)      1.0

sparsegrad is written in pure Python. For easy installation and best portability, it does not contain extension modules. In realistic problems, it can provide similar or better performance than ADOL-C best case of repeated calculation. This is possible thanks to algorithmic optimizations and optimizations to avoid slow parts of scipy.sparse.

sparsegrad relies on numpy and scipy for computations. It is compatible with both Python 2.7 and 3.x.

Installation

pip install sparsegrad

It is recommended to run test suite after installing

python -c "import sparsegrad; sparsegrad.test()"

Metadata

Release files for sparsegrad 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparsegrad 0.0.15
File Size Uploaded Provenance Actions
sparsegrad-0.0.15.tar.gz 95.4 kB Without provenance Details for sparsegrad-0.0.15.tar.gz

Release files / sparsegrad-0.0.15.tar.gz

Download URL sparsegrad-0.0.15.tar.gz
Size 95.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ab202f2bb8561b774b8d0a8b9142d65a07acff82f8bc2ed84d734621c4096ac4
BLAKE2b-256 checksum
How to use checksums
fbe9e7f507dc7d6bd0c1f61742d695227853a48797e81dd7628af5bfbab578fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

Security for sparsegrad 0.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page