Differentiable scientific computing library
Project Links
Meta
Author: mfkasim1
Requires Python: >=3.8.1,<3.12
Classifiers
Intended Audience
- Science/Research
License
- OSI Approved :: MIT License
Programming Language
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.8
- Python :: 3.9
Topic
- Scientific/Engineering
- Scientific/Engineering :: Mathematics
- Scientific/Engineering :: Physics
xitorch: differentiable scientific computing library
xitorch is a PyTorch-based library of differentiable functions and functionals that
can be widely used in scientific computing applications as well as deep learning.
The documentation can be found at: https://xitorch.readthedocs.io/
Example
Finding root of a function:
import torch
from xitorch.optimize import rootfinder
def func1(y, A): # example function
return torch.tanh(A @ y + 0.1) + y / 2.0
# set up the parameters and the initial guess
A = torch.tensor([[1.1, 0.4], [0.3, 0.8]]).requires_grad_()
y0 = torch.zeros((2, 1)) # zeros as the initial guess
# finding a root
yroot = rootfinder(func1, y0, params=(A,))
# calculate the derivatives
dydA, = torch.autograd.grad(yroot.sum(), (A,), create_graph=True)
grad2A, = torch.autograd.grad(dydA.sum(), (A,), create_graph=True)
Modules
linalg: Linear algebra and sparse linear algebra moduleoptimize: Optimization and root finder moduleintegrate: Quadrature and integration moduleinterpolate: Interpolation
Requirements
- python >=3.8.1,<3.12
- pytorch 1.13.1 or higher (install here)
Getting started
After fulfilling all the requirements, type the commands below to install xitorch
python -m pip install xitorch
Or to install from GitHub:
python -m pip install git+https://github.com/xitorch/xitorch.git
Finally, if you want to make an editable install from source:
git clone https://github.com/xitorch/xitorch.git
cd xitorch
python -m pip install -e .
Note that the last option is only available per PEP 660, so you will require pip >= 23.1
Used in
- Differentiable Quantum Chemistry (DQC): https://dqc.readthedocs.io/
Gallery
Neural mirror design (example 01):

Initial velocity optimization in molecular dynamics (example 02):

0.5.1
Feb 24, 2023
0.5.0
Feb 23, 2023
0.4.0
Feb 23, 2023
0.3.0
May 26, 2021
0.2.0
Mar 10, 2021
0.1.1
Oct 02, 2020
0.1.0
Oct 02, 2020
0.0.0
Feb 23, 2023