pepsy is a Python package for circuit simulation and related DMRG fitting workflows.
Current package version: 0.1.1 (from pyproject.toml / pepsy.__version__).
src/pepsy/: installable library codeboundary_states.py: boundary state initialization (BdyMPS)boundary_sweeps.py: sweep/contraction runner (CompBdy)boundary_metrics.py: input preparation + contraction (build_bra_ket,contract_boundary,BoundaryContractResult)gates.py: gate application (gate,gate_simple,renorm_gauge) with long-range SWAP routingcore.py: lattice maps (OneDMap), state/MPO/PEPO builders, backend defaultsham.py: Hamiltonian helpersoptimize_sweep.py,optimize_global.py,optimize_energy.py: optimizersoptimize_mps.py,optimize_mpo.py:MpsOptimizer,MpoOptimizergradient_solver.py,ft_solver.py: gradient-based and FT/FD solverssampler.py:MpsSamplerand related sampling utilitiesfit.py,_backend_utils.py,_backend_linalg.py,_backend_linalg_torch.py,_backend_linalg_jax.py
examples/: runnable examples (e.g.MpsMagnetization/2D ITF Trotter MPS evolution)docs/: Sphinx documentation sourcetests/: package tests
pip install -U --no-deps -e .
# Optional backends:
# pip install -e .[torch]
# pip install -e .[solvers]
# jax backend (manual, platform-specific wheels):
# pip install jax jaxlib
# Optional plotting helpers:
# pip install -e .[viz]import pepsy
import quimb.tensor as qtn
ket = qtn.PEPS.rand(Lx=3, Ly=3, bond_dim=2, seed=1, dtype="complex128")
ket_tagged, norm = pepsy.build_bra_ket(ket=ket)
bdy = pepsy.BdyMPS(tn_flat=ket_tagged, tn_double=norm, chi=32, single_layer=False)
res = pepsy.contract_boundary(norm=norm, bdy=bdy, direction="y", n_iter=2)
print(pepsy.__version__, res.cost)Build docs locally:
pip install -e .[docs]
NUMBA_CACHE_DIR=/tmp PYTHONPYCACHEPREFIX=/tmp \
sphinx-build -W -b html docs docs/_build/htmlMain docs sections:
getting_startedtutorials/howto/api/
.gitattributesmarks notebooks as binary to avoid noisy diffs..gitignoreexcludes checkpoints, caches,cash/, andnohup.out.