Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ Release notes for `quimb`.
- add [`CircuitPEPSSimpleUpdate`](#CircuitPEPSSimpleUpdate): a high level quantum circuit simulator that keeps the state as an arbitrary geometry PEPS and applies nearest-neighbor gates with 'simple update' style gauging. The geometry is given by a set of ``edges``, inferred from the ``gates`` or read from a ``psi0``; the accuracy is set by ``max_bond``; gauges can be periodically re-equilibrated with ``equilibrate``; local expectations are computed with the cluster approximation.
- add [`CircuitPEPOSimpleUpdate`](#CircuitPEPOSimpleUpdate): the Heisenberg-picture companion to [`CircuitPEPSSimpleUpdate`](#CircuitPEPSSimpleUpdate). Gates are recorded lazily, then a local observable is built as a bond dimension 1 PEPO on the ``edges`` and evolved backwards through them with simple update gauging and compression (skipping gates outside its reverse lightcone), exposing the evolved operator via ``get_evolved_operator`` and its ``|00...0>`` expectation via ``local_expectation``.
- add [`CircuitBase`](#CircuitBase): the shared, representation-agnostic base for all circuit simulators, holding the gate-application front-end and convenience gate methods, named-parameter management, the ``from_*`` constructors and drawing. The exact, MPS, PEPS and PEPO simulators now compose it instead of inheriting the exact [`Circuit`](#Circuit). The state is exposed via a single ``get_psi`` method that each representation implements, and which the ``psi`` property calls. Representation-specific options such as the PEPS/PEPO geometry ``edges`` can be passed through all the ``from_*`` constructors.
- add an infinite, translation-invariant 2D tensor-network family (`quimb.tensor.tn2dinf`) for infinite-PEPS ground states via simple update: [`GeometryInfinite2D`](#GeometryInfinite2D) defines a unit cell from a set of ``edges``, with sites labelled ``(cell, site_type)`` and bonds canonicalized into translation classes (``bond_type``); [`PEPSInfinite2D`](#PEPSInfinite2D) (and its base [`TensorNetworkInfinite2DFlat`](#TensorNetworkInfinite2DFlat)) stores a single tensor per site, keeping all translates in sync via shared tensors and indices; [`LocalHamInfinite2D`](#LocalHamInfinite2D) defines a Hamiltonian per ``bond_type`` (its geometry may extend beyond the state's, e.g. longer-range terms on a nearest-neighbor PEPS); and [`SimpleUpdateInfinite2D`](#SimpleUpdateInfinite2D) drives imaginary-time simple update by reusing [`SimpleUpdateGen`](#SimpleUpdateGen). Local expectations use a cluster (``max_distance``) or cheaper generalized-loop (``gloops``) approximation, and the dense, abelian-symmetric and fermionic (`symmray`) backends are all supported.
- add [`GeometryInfinite2D.square`](#GeometryInfinite2D.square): build a square-lattice unit cell of any ``N`` by ``M`` size and neighbor range in one call, the range given as ``couplings`` (an int number of shells, ``1`` for nearest-neighbor, ``2`` to also include next-nearest, ..., or an explicit list of ``(dx, dy)`` site-step displacements) or a ``radius`` cutoff, both in basis-independent square-lattice distance, with sites placed at the 0-based lattice points.
- [`TensorNetwork.gauge_all_simple`](#TensorNetwork.gauge_all_simple): add a ``fuse_multibonds`` option for updating gauges while preserving multi-index bonds, supported by explicit bond-index selection in [`tensor_compress_bond`](#tensor_compress_bond).
- add [`tensor_gauge_simple_bond`](#tensor_gauge_simple_bond): the single-bond 'simple update' gauging step extracted from [`gauge_all_simple`](#TensorNetwork.gauge_all_simple), for gauging an individual bond between two tensors against a shared ``gauges`` dict.
- [`tensor_network_ag_gate_simple`](#tensor_network_ag_gate_simple) (the ``gate_simple`` / ``gate_simple_`` methods): support long-range gates between sites that are not directly bonded, dispatching to the new [`tensor_network_ag_gate_simple_long_range`](#tensor_network_ag_gate_simple_long_range), which splits the gate into a matrix-product operator and applies it along a path of sites with simple-update gauging and recompression.
- [`tensor_canonize_bond`](#tensor_canonize_bond): add a ``swap_inds`` option to relocate one or more indices onto the other tensor while canonizing (e.g. to 'move' a physical index), plus a ``bond_ind`` option for explicit bond-index selection, matching [`tensor_compress_bond`](#tensor_compress_bond).
- [`SimpleUpdateGen`](#SimpleUpdateGen): gauge with ``fuse_multibonds=False`` so simple update preserves multi-index bond structure.
- [`LocalHamGen.get_auto_ordering`](#LocalHamGen.get_auto_ordering): support ``group=True`` (return commuting layers) for the ``sort`` / ``random`` / ``None`` strategies, and for ``order="random-ungrouped"`` chunk the shuffled terms into commuting layers sequentially (preserving the random order rather than greedily packing each layer).
- add [`LatticeBondMap`](#LatticeBondMap): helper for consistently assigning lattice bond indices across ordinary and periodic boundaries, use it in PEPS, PEPO, PEPS3D, scalar 2D/3D lattice tensor-network construction, and classical Ising tensor-network construction.
- [`eigh_truncated`](#eigh_truncated): add a ``shift`` option for optional diagonal regularization.
- [`CircuitMPSLazy`](#CircuitMPSLazy): add a MPS-based circuit simulator using lazily evaluated gates and periodic automated compression, performing better compared to `CircuitMPS` for long-range gates when using `src` compression method.
Expand Down
16 changes: 16 additions & 0 deletions quimb/tensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,17 @@
LocalHam2D,
SimpleUpdate,
)
from .tn2dinf.core import (
PEPSInfinite2D,
TensorNetworkInfinite2DFlat,
)
from .tn2dinf.geometry import (
GeometryInfinite2D,
)
from .tn2dinf.tebd import (
LocalHamInfinite2D,
SimpleUpdateInfinite2D,
)
from .tn3d.core import (
PEPS3D,
TensorNetwork3D,
Expand Down Expand Up @@ -282,6 +293,7 @@
"Gate",
"gen_2d_bonds",
"gen_3d_bonds",
"GeometryInfinite2D",
"get_contract_backend",
"get_contract_strategy",
"get_symbol",
Expand Down Expand Up @@ -311,6 +323,7 @@
"LocalHam2D",
"LocalHam3D",
"LocalHamGen",
"LocalHamInfinite2D",
"LatticeBondMap",
"MatrixProductOperator",
"MatrixProductState",
Expand Down Expand Up @@ -349,6 +362,7 @@
"PEPO_product_operator",
"PEPS",
"PEPS3D",
"PEPSInfinite2D",
"PTensor",
"rand_phased",
"rand_tensor",
Expand All @@ -359,6 +373,7 @@
"set_tensor_linop_backend",
"SimpleUpdate",
"SimpleUpdateGen",
"SimpleUpdateInfinite2D",
"SpinHam",
"SpinHam1D",
"superop_TN_1D",
Expand Down Expand Up @@ -396,6 +411,7 @@
"TensorNetworkGen",
"TensorNetworkGenOperator",
"TensorNetworkGenVector",
"TensorNetworkInfinite2DFlat",
"TN_classical_partition_function_from_edges",
"TN_dimer_covering_from_edges",
"TN_from_edges_and_fill_fn",
Expand Down
12 changes: 12 additions & 0 deletions quimb/tensor/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ def from_sequence(cls, it):
def tids(self):
return self._tids

@property
def num_tensors(self):
return len(self._tids)

@property
def inds(self):
return self._inds

@property
def num_indices(self):
return len(self._inds)

def __iter__(self):
return itertools.chain(self._tids, self._inds)

Expand Down Expand Up @@ -439,6 +447,10 @@ def get_path_between_tids(tn, tida, tidb):
"""
# expand from both points
path_a0 = NetworkPath((tida,))

if tidb == tida:
return path_a0

path_b0 = NetworkPath((tidb,))
queue_a = collections.deque((path_a0,))
queue_b = collections.deque((path_b0,))
Expand Down
21 changes: 21 additions & 0 deletions quimb/tensor/tn2dinf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Infinite, translation-invariant 2D tensor networks defined by a unit cell,
e.g. infinite PEPS and their imaginary-time simple update.

Some notable definitions and conventions of terms used in this subpackage:

- "site": a concrete (cell, site_type) pair defining a location site in the
infinite lattice.
- "cell": (dx, dy) integer unit-cell translation (not a position).
- "site_type": label of a site within the unit cell, all sites with the same
site_type share data.
- "bond_type": a bond's translation class, canonicalized with the first
endpoint anchored at cell (0, 0) and the pair sorted.
- "bond index": the concrete index name on one specific translated bond.
- "canonical": the (0, 0) anchored representative keying a translation class.
- "fragment": the finite materialized TN patch standing in for the infinite
network, that operations act on and are synced from.
- "shared_tensors" / "shared_indices": the set of tensors or indices in the
fragment sharing the same site_type or bond_type, respectively.
- "position": the cartesian coordinate of a site, defined by the unit cell's
basis and the site_type's fractional offset within the unit cell.
"""
Loading