Fast, transparent first- and second-order automatic differentiation
Project description
ad
Fast, transparent first- and second-order automatic differentiation for Python
Overview
The ad package allows you to easily and transparently perform first- and
second-order automatic differentiation. Advanced math involving trigonometric,
logarithmic, hyperbolic, and related functions can be evaluated directly using
the ad.admath submodule.
All base numeric types are supported (int, float, complex, etc.). The
package is designed so underlying numeric types interact as they normally do
during calculations. In practice, ad behaves like a lightweight wrapper that
tracks derivatives while preserving standard numeric behavior.
From the Wikipedia entry on Automatic differentiation:
"AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, and accurate to working precision."
See the package documentation for details and examples.
Main Features
- Transparent calculations with derivatives, requiring little or no modification to existing code (including NumPy-based code).
- Broad mathematical operation support, including most functions from
mathandcmath, plus convenience trigonometric, hyperbolic, and logarithmic helpers (csc,acoth,ln, etc.). Comparison operators follow the same rules as the wrapped numeric values. - Seamless real and complex arithmetic through
ad.admathcounterparts. - Automatic gradient and Hessian function generator for optimization workflows
with
scipy.optimizeviagh(your_func_here). - Linear algebra routines in
ad.linalgsimilar to NumPy'slinalg, without LAPACK dependency.
Linear Algebra Routines
Decompositions
chol: Cholesky decompositionlu: LU decompositionqr: QR decomposition
Solving equations and matrix inversion
solve: General solver for linear systemslstsq: Least-squares solver for linear systemsinv: Multiplicative inverse of a matrix
Installation
uv pip install ad
Requires Python 3.10+. See the full installation guide.
Documentation
- Theory — mathematical background, hierarchical basis, algorithms
- Quickstart — runnable examples
- API Reference — class and function signatures
- References — literature citations
License
BSD-3-Clause.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ad-1.4.1.tar.gz.
File metadata
- Download URL: ad-1.4.1.tar.gz
- Upload date:
- Size: 147.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cb709bd9a6ebc8d13bbb563cb61dc18a72d9a07694a9e3b87564bc162e5348c
|
|
| MD5 |
83e6a8bfa36bf9f9c03184998daa0aab
|
|
| BLAKE2b-256 |
dc79c3419d1af4592d2b6ceca022539932cf8f88731604558c1d4e8dea8bdeee
|
Provenance
The following attestation bundles were made for ad-1.4.1.tar.gz:
Publisher:
publish_dist.yml on eggzec/ad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ad-1.4.1.tar.gz -
Subject digest:
3cb709bd9a6ebc8d13bbb563cb61dc18a72d9a07694a9e3b87564bc162e5348c - Sigstore transparency entry: 1494822329
- Sigstore integration time:
-
Permalink:
eggzec/ad@14c46c8bda09abfb2da827ae8acd4d1036f7dec4 -
Branch / Tag:
- Owner: https://github.com/eggzec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_dist.yml@14c46c8bda09abfb2da827ae8acd4d1036f7dec4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ad-1.4.1-py3-none-any.whl.
File metadata
- Download URL: ad-1.4.1-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68508ae707c2dad18081e37416dbad8a5c628360cb8bbb08f2d3f7b3b976b2f3
|
|
| MD5 |
8ad854f4c6f65f6f53e69a7a6a081007
|
|
| BLAKE2b-256 |
d72bdf1b410b0dffa9b4a5e814374004abd942215168c48ae5d31fe622568185
|
Provenance
The following attestation bundles were made for ad-1.4.1-py3-none-any.whl:
Publisher:
publish_dist.yml on eggzec/ad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ad-1.4.1-py3-none-any.whl -
Subject digest:
68508ae707c2dad18081e37416dbad8a5c628360cb8bbb08f2d3f7b3b976b2f3 - Sigstore transparency entry: 1494822407
- Sigstore integration time:
-
Permalink:
eggzec/ad@14c46c8bda09abfb2da827ae8acd4d1036f7dec4 -
Branch / Tag:
- Owner: https://github.com/eggzec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_dist.yml@14c46c8bda09abfb2da827ae8acd4d1036f7dec4 -
Trigger Event:
release
-
Statement type: