Catalog PyPI
PACKAGE EXPLORERView in registry

ad

PyPI

Fast, transparent first- and second-order automatic differentiation

algebralgorithmicautomaticcomputationalderivativedifferentiationfirstlinearoptimizationorderpythonsecond
Versions collected1
Direct dependencies1From release 1.5.1
Last observed20 Oct, 18:45 UTC

README

Version 1.5.1 documentation

AD

AD

Fast, transparent first- and second-order automatic differentiation for Python

Tests Documentation Ruff

codecov Quality Gate Status License: BSD-3

PyPI Downloads Python versions

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 math and cmath, 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.admath counterparts.
  • Automatic gradient and Hessian function generator for optimization workflows with scipy.optimize via gh(your_func_here).
  • Linear algebra routines in ad.linalg similar to NumPy's linalg, without LAPACK dependency.

Linear Algebra Routines

Decompositions

  • chol: Cholesky decomposition
  • lu: LU decomposition
  • qr: QR decomposition

Solving equations and matrix inversion

  • solve: General solver for linear systems
  • lstsq: Least-squares solver for linear systems
  • inv: Multiplicative inverse of a matrix

Installation

uv pip install ad

Requires Python 3.10+. See the full installation guide.

Documentation

License

BSD-3-Clause.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.5.119 Aug 20261

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
eggzec/ad

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:45 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5738b9ba74f44d148bd2990cd33628a7938bf0e885589c6af4354072c534e115