Documentation | Build status | Coverage |
---|---|---|
Python library for differentiable linear algebra with block-sparse tensors, supporting abelian symmetries. It supports a range of Projected Entangled Pair States (PEPS) and Matrix Product States (MPS) algorithms employing the core symmetric Tensor class.
- 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
It allows automatic differentiation (autograd) on backends which support it.
- Quickstarts for a few end-to-end examples of PEPS calculations.
- Benchmarks, including basic DMRG example.
- Full documentation for multiple further examples.
- Two-dimensional tensor networks library peps-torch. It includes variational optimization of iPEPS with abelian symmetries for spin models powered by YASTN tensor.
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 successfully import yastn
(see pyproject.toml
for dependencies).
Tests, which are also a good source of usage examples, can be found in the folder tests
.
To verify that everything works, get pytest
. To test specific elements of the repository, run
pytest -v ./tests/tensor
pytest -v ./tests/operators
pytest -v ./tests/mps
pytest -v ./tests/peps
To test YASTN on PyTorch backend and integration of autograd features (assuming PyTorch is installed)
pytest -v --backend torch
To execute the tests on a GPU
pytest -v --backend torch --device cuda
If you find this package useful for a project published in an academic journal, you can consider citing the release paper, with the following BibTex entry
@Article{YASTN,
title={{YASTN: Yet another symmetric tensor networks; A Python library for Abelian symmetric tensor network calculations}},
author={Marek M. Rams and Gabriela Wójtowicz and Aritra Sinha and Juraj Hasik},
journal={SciPost Phys. Codebases},
pages={52},
year={2025},
publisher={SciPost},
doi={10.21468/SciPostPhysCodeb.52},
url={https://scipost.org/10.21468/SciPostPhysCodeb.52},
}