Python library for differentiable linear algebra with block-sparse tensors, supporting abelian symmetries
- Z2 for parity conservation
- U(1) for particle number conservation
- direct product of abelian groups such as Z3xU(1) or U(1)xU(1)xZ2 and so on
- NumPy
- PyTorch
allowing for automatic differentiation (autograd) on backends which provide it.
-
Matrix product states (MPS) and algorithms powered by YASTN
Explore the entire MPS module or try out code examples running DMRG or TDVP optimizations
-
Two-dimensional tensor networks library peps-torch powered by YASTN
Try variational optimization of iPEPS with abelian symmetries for spin models
Jump to full Documentation or get started with Examples
Install using
git clone https://github.com/yastn/yastn.git && cd yastn
pip install .
or just clone and add YASTN root to your Python import path to sucessfully import yastn
.
- Python 3.9
- NumPy
and optionally
- PyTorch 1.11 (for PyTorch backend)
- SciPy (for sparse linear algebra solvers)
- ...
Tests, which are also a good source of examples of usage, can be found in the folder tests
.
To verify that everything works, get pytest
. See Installing pytest
or conda install -c conda-forge pytest
. Then you can test base yastn.Tensor and also yastn.mps modules
cd tests
pytest -v ./tensor
pytest -v ./mps
To test YASTN on PyTorch backend and integration of autograd features
cd tests
pytest --backend torch -v ./tensor
pytest --backend torch -v ./mps
You can build documentation using sphinx
. The prerequisites are
- sphinx
- pydata-sphinx-theme
Get them with your favourite Python package manager. For example, using conda as conda install -c conda-forge sphinx pydata-sphinx-theme
.
Then
cd docs && make html
The generated documentation can be found at docs/build/html/index.html