High-Performance Automatic Differentiation for Python
Project description
XAD is a library designed for automatic differentiation, aimed at both beginners and advanced users. It is intended for use in production environments, emphasizing performance and ease of use. The library facilitates the computation of derivatives within computer programs, making the process efficient and straightforward for a wide range of mathematical functions, from simple arithmetic to complex calculations, ensuring accurate and automatic derivative computations.
The Python bindings for XAD offer the following features:
- Support for both forward and adjoint modes at the first order.
- Strong exception-safety guarantees.
- High performance, as demonstrated in extensive production use.
For more details and to integrate XAD into your projects, consult the comprehensive documentation.
Application Areas
Automatic differentiation has many application areas, for example:
- Machine Learning and Deep Learning: Training neural networks or other machine learning models.
- Optimization: Solving optimization problems in engineering and finance.
- Numerical Analysis: Enhancing numerical solution methods for differential equations.
- Scientific Computing: Simulating physical systems and processes.
- Risk Management and Quantitative Finance: Assessing and hedging risk in financial models.
- Computer Graphics: Optimizing rendering algorithms.
- Robotics: Improving control and simulation of robotic systems.
- Meteorology: Enhancing weather prediction models.
- Biotechnology: Modeling biological processes and systems.
Getting Started
Install:
pip install xad
Calculate first-order derivatives in adjoint mode:
import xad.adj_1st as xadj
# set independent variables
x0_ad = xadj.Real(1.0)
x1_ad = xadj.Real(1.5)
x2_ad = xadj.Real(1.3)
x3_ad = xadj.Real(1.2)
with xadj.Tape() as tape:
# and register them
tape.registerInput(x0_ad)
tape.registerInput(x1_ad)
tape.registerInput(x2_ad)
tape.registerInput(x3_ad)
# start recording derivatives
tape.newRecording()
# calculate the output
y = x0_ad + x1_ad - x2_ad * x3_ad
# register and seed adjoint of output
tape.registerOutput(y)
y.derivative = 1.0
# compute all other adjoints
tape.computeAdjoints()
# output results
print(f"y = {y}")
print(f"first order derivatives:\n")
print(f"dy/dx0 = {x0_ad.derivative}")
print(f"dy/dx1 = {x1_ad.derivative}")
print(f"dy/dx2 = {x2_ad.derivative}")
print(f"dy/dx3 = {x3_ad.derivative}")
For more information, see the Documentation.
Related Projects
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 Distributions
Built Distributions
File details
Details for the file xad-1.5.2-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: xad-1.5.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 370.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 216f945ad5449bbb3d9fd5ca4accbf85f6bf478a77be9658794f060fa7aa7ff9 |
|
MD5 | 6e8e79fbb16e3c1e73cab72d71cd8300 |
|
BLAKE2b-256 | d3a8c2fae2245cb4fe77f6b73e92e5187a20db93a01c0fbaee3df4b043e4e334 |
File details
Details for the file xad-1.5.2-cp312-cp312-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp312-cp312-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 793.6 kB
- Tags: CPython 3.12, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a53f53dddd0d14295d19179f430caaa850eaca4e04d36e988f2699fc06250a2 |
|
MD5 | 0e7f399e4aff7f38b1b3767f8e4d598b |
|
BLAKE2b-256 | 6814db8796d22aca64e5c29004d24f8ea59ff4be6278ea185be394c5a0731052 |
File details
Details for the file xad-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 268.9 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aae7c74644142e6b5aa0b8b1f5bf7144a88b01d123fd3757708f3de9b8aded7 |
|
MD5 | f9427b96eabe598b8e3623323a707723 |
|
BLAKE2b-256 | ec674c179880f1a45e6eb5be5ccc63217b0a41f4391c4dd2c6f621dbdec5d91f |
File details
Details for the file xad-1.5.2-cp312-cp312-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp312-cp312-macosx_12_0_x86_64.whl
- Upload date:
- Size: 234.2 kB
- Tags: CPython 3.12, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f785b1ca120980871e2779ecaf88c63e2d5b4744f4d51a970c5bcfb493427feb |
|
MD5 | a272475ec22bfeb47090e8778987f88e |
|
BLAKE2b-256 | 68a77af209897be34d3293724296ed6def6643b055fee8a801a51d03e74d391a |
File details
Details for the file xad-1.5.2-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: xad-1.5.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 371.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c3abfaf0ea3a26edf74a9bcd8602f39dbdd4be055861558d866e62742cd9d3 |
|
MD5 | b6f7725b57d073e37bdb6971b2317635 |
|
BLAKE2b-256 | 54cf78867743d0cfb78b163c9c6615d3f3b83e5385c5c7da4fd233d14919410d |
File details
Details for the file xad-1.5.2-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 790.5 kB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c167c24b8f549b6ca070b6b9cfe6bf95484bd2e90690d97ff45f737fb93752b8 |
|
MD5 | 4454ed6dce6fb5e131156c939949febf |
|
BLAKE2b-256 | 88a77dfb356e01806160714d9780d1cf30a371131a2ce990c00c1d420842c3bc |
File details
Details for the file xad-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 266.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b59aa97b907b92c42feb2aa5fd1a33a05ada12abd548e94627a281058c002f1c |
|
MD5 | e84d90109139d8dade08caa9b7452410 |
|
BLAKE2b-256 | c7ff5f09ebd40cd2e9f4e21849fd5462a4898900af020be2a751887a0fedfeee |
File details
Details for the file xad-1.5.2-cp311-cp311-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp311-cp311-macosx_12_0_x86_64.whl
- Upload date:
- Size: 222.8 kB
- Tags: CPython 3.11, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f609ec12a59f3edd1785ebf8e570f6f5c2650cc8206e02037e0586a288f835fe |
|
MD5 | 65674eb8de12c9bea42ff2b64248bd4e |
|
BLAKE2b-256 | f6fde1de4348bcbfa6927fc2da00a8f4b03887d97c90f71aa5c56c382fd4051d |
File details
Details for the file xad-1.5.2-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: xad-1.5.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 369.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1335fb82f769b3fd2c4ff3dcd8e4baa816c3b691df10fcc677d14e2a23b187a4 |
|
MD5 | 49bf90940e9155641ffb5ef5e94c8be6 |
|
BLAKE2b-256 | bf243379c5cfd288a77da9a35c6a8fb27002348bee61c5e453aa20d99ab7169a |
File details
Details for the file xad-1.5.2-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 789.4 kB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f6eda6f79d263147781507e10b54e27a15e30683a6d7ec8ccaf9409a58effab |
|
MD5 | 3d43efd4a051765297f6783acb9a86f2 |
|
BLAKE2b-256 | 9fad5a5931bd51ad46c5182bdd70c87539588a6371ec8a693628e1c22ecf22ec |
File details
Details for the file xad-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 264.4 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8c77fcec1ca9dc1d34900aa703fa05dd779feb10cb1f23643bc4d910d52c58f |
|
MD5 | bd086ddeef9c1a3977672a74a1a7f7b0 |
|
BLAKE2b-256 | 39b5fd6e514dd120319da762709aeb10cf09ce22d9218415ce5fea37b068e6da |
File details
Details for the file xad-1.5.2-cp310-cp310-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp310-cp310-macosx_12_0_x86_64.whl
- Upload date:
- Size: 221.3 kB
- Tags: CPython 3.10, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccf6a13780632033b291598d3d52e05dba11ebca373b7dfcfc13cd9926b974f |
|
MD5 | 83ca810436a492c80b2d31366be693ab |
|
BLAKE2b-256 | 6cb9be1dc3fda0810dddca34d5ae797375604638171eb2ab01b29ff6654f2f0d |
File details
Details for the file xad-1.5.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: xad-1.5.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 354.3 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beaad7338325d2c1caad6752e14ce20f10c3c4ab715f4c8d48c2e9492e9e0473 |
|
MD5 | e518928020c0ee35b6f15b49086f88a8 |
|
BLAKE2b-256 | 28bf71ca2a73f4550cbee80073fc8a58fce93ccef2b09870593c5dbd949a074b |
File details
Details for the file xad-1.5.2-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 788.9 kB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cccd0478dabdc81a2cb7fece892e0195d4e0f11958e45bb79bffc4d21e5a14a |
|
MD5 | f44ce93919beb4cc377abe33ac3e8e7b |
|
BLAKE2b-256 | 8e773a01fcfa7d73d1cbdc5a22015b7d1853346b9506ba218df75e14ba02e957 |
File details
Details for the file xad-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 264.9 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d900d14f5c9cc06300c7696eccd71f4f4d650f2393899a7391de8366e3fe33f |
|
MD5 | ea515376e7ebbfac1d38c3881afce94a |
|
BLAKE2b-256 | 8c21e722e2e3c7aaebac30879e4e59b01cad1cf1486bf5781a7f1b1698cfa4ff |
File details
Details for the file xad-1.5.2-cp39-cp39-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp39-cp39-macosx_12_0_x86_64.whl
- Upload date:
- Size: 221.4 kB
- Tags: CPython 3.9, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d35dcf0dce9dab1c294e1364e07d32ead1d01ddff5dfc952e90a133691326a5 |
|
MD5 | 0ee9a3ea647070d0a9f51ee60454b550 |
|
BLAKE2b-256 | e26edafaeacf4971fdca43e49fe562c4b3cbcd94fa26910493b819c69831651c |
File details
Details for the file xad-1.5.2-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: xad-1.5.2-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 369.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f43b75fba4b48f7204fbab60ce1957203f5188e330f6e4ea9cb374dd25d30f3 |
|
MD5 | 1c46dffdd3c8150f86170e84dd72e393 |
|
BLAKE2b-256 | 8b2033d1e048cf94fc67d1f23e629b0d6fc25c5710e6a72d0ffc54b8ede4420a |
File details
Details for the file xad-1.5.2-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 788.9 kB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00a8f5ac391850879c68de4f3063cbf5f47f4f60395f6c9193ef14010592ab95 |
|
MD5 | 9e2bf803ff1f7371fa8e4c75ed70597c |
|
BLAKE2b-256 | a7f3a3e22ee4ac22fdbf5001b5731e3bf81bf4ab5b73cad3e2fed06c7312ce06 |
File details
Details for the file xad-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: xad-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 264.2 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7610f6b778585061dc7f88b086ec3e1d52369c8605b3043565230937415a29b3 |
|
MD5 | ad077e84f7597cc4e7f1a446c4c8479d |
|
BLAKE2b-256 | 9f69fe3ac62354618f95b681ec47295cd477f002e898765d77c5b8963f606f3e |