quimb is a versatile Python library for quantum information and many-body physics, offering tools for exact diagonalization, tensor networks (Matrix Product States, PEPS, etc.), quantum circuits, and general quantum mechanics simulations. It is currently at version 1.13.0 and maintains an active release cadence, with major and minor updates often arriving monthly or bi-monthly, frequently including breaking changes.
pip install quimbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a random state vector and a simple Matrix Product State (MPS) using quimb's core and tensor network modules, along with basic operations like calculating norm and contraction.
Ensure your Python environment is 3.11 or greater. Consider using pyenv or conda for managing Python versions.
If using these Hamiltonian generation functions, review your energy calculations and potentially adjust signs in your code to match the new convention (refer to official docs for details).
Update your import statements from `from quimb.operatorbuilder import OperatorBuilder` to `from quimb.operator import OperatorBuilder`.
Adjust import paths from `from quimb.tensor import belief_propagation` (or specific functions) to `from quimb.tensor.belief_propagation import ...`.
Update calls from `mps.partial_trace(...)` to `mps.partial_trace_to_mpo(...)`.
For performance, consider installing `opt_einsum` and `cotengra` (`pip install quimb[tensor,cut]`). For specific problems, manually specify `optimize` strategies (e.g., `'optimal'`, `'greedy'`, or use a `ContractionTree` object) for `tn.contract()`.
Change your import statement to `from quimb.operator import OperatorBuilder`.
Upgrade your Python installation to version 3.11 or higher. For example, using `conda create -n quimb_env python=3.11` or `pyenv install 3.11`.
Carefully review the indices of your tensors and the `output_inds` argument passed to `tn.contract()`. Ensure all internal indices are matched for summation and only desired external indices are left.
Upgrade both `numba` and `numpy` to their latest compatible versions. Use `pip install --upgrade numba numpy`.