quimb.tensor.circuit.pepo¶
PEPO simple-update circuit simulator.
Classes¶
Quantum circuit simulator that evolves an observable backwards in time, |
Module Contents¶
- class quimb.tensor.circuit.pepo.CircuitPEPOSimpleUpdate(N=None, *, edges=None, gates=None, max_bond=None, cutoff=1e-10, gate_contract='reduce-split', gate_opts=None, **circuit_opts)[source]¶
Bases:
quimb.tensor.circuit.simple_update.CircuitSimpleUpdateQuantum circuit simulator that evolves an observable backwards in time, in the Heisenberg picture, by representing it as an arbitrary geometry PEPO and applying the gates with the simple update rule.
Rather than evolving a state forwards, gates are simply recorded as they are applied; no contraction happens until an expectation value is requested. When
local_expectation()(orget_evolved_operator()) is called, the local observable is built as a bond dimension 1 PEPO on the suppliededgesand the recorded gates are applied in reverse order as \(O \rightarrow G^\dagger O G\), usingtensor_network_ag_gate_simple()(Vidal-style gauging plus compression). Gates that fall outside the reverse lightcone of the observable are skipped, since \(G^\dagger G = 1\). The evolved operator is finally projected onto the|00...0>initial state.This is the Heisenberg-picture companion to
CircuitPEPSSimpleUpdate, useful on lattices where evolving the full state is intractable but a single local observable can be evolved in a truncated, gauged operator network.- Parameters:
N (int, optional) – The number of qubits. If not given it is inferred from the geometry. Supply it to pad the geometry up to
Nsites.edges (sequence[tuple[hashable, hashable]], optional) – The edges defining the geometry. A bond is placed between each pair of sites, and two-qubit gates are only supported on these edges. If not given the geometry is inferred from the two-qubit
gates.gates (sequence, optional) – If
edgesis not given, infer the geometry from the two-qubit gates in this sequence (the gates are only inspected here, not applied).max_bond (int, optional) – The maximum bond dimension to compress the operator to as gates are applied during the backwards evolution.
cutoff (float, optional) – The singular value cutoff to use when compressing.
gate_contract (str, optional) – How to split a two site gate, see
tensor_network_ag_gate_simple().gate_opts (dict, optional) – Default options forwarded to
gate_simple_such asmax_bond,cutoffandrenorm. This is the single source of truth for the compression options;max_bondandcutoffare also exposed as properties.
Examples
>>> import quimb.tensor as qtn >>> edges = [(0, 1), (1, 2), (2, 3)] >>> circ = qtn.CircuitPEPOSimpleUpdate(edges=edges, max_bond=16) >>> circ.apply_gates(gates) # no computation happens here >>> circ.local_expectation(qu.pauli("Z"), 1) # evolve + contract here
See also
CircuitPEPSSimpleUpdate,CircuitMPS- property max_bond¶
The maximum bond dimension to compress to.
- property cutoff¶
The singular value cutoff to use when compressing.
- _apply_gate(gate, tags=None, **gate_opts)[source]¶
Apply a
Gateto thisCircuit. This is the main method that all calls to apply a gate should go through.
- apply_gates(gates, progbar=False, **gate_opts)[source]¶
Apply a sequence of gates to this tensor network quantum circuit.
- Parameters:
gates (Sequence[Gate] or Sequence[Tuple]) – The sequence of gates to apply.
gate_opts – Supplied to
apply_gate().
- _initial_operator(G, where)[source]¶
Build the bond dimension 1 PEPO of
Gacting atwhereand the identity elsewhere, on the circuit geometry.
- get_evolved_operator(G, where, *, max_bond=None, cutoff=None)[source]¶
Evolve the local observable
Gatwherebackwards through the recorded circuit, returning the Heisenberg-picture operator \(U^\dagger G U\) as a gauged PEPO. Gates outside the reverse lightcone of the observable are skipped.- Parameters:
G (array_like) – The local operator acting on the site(s) in
where.where (hashable or sequence[hashable]) – The site or sites the operator acts on.
max_bond (optional) – Override the compression options for this call.
cutoff (optional) – Override the compression options for this call.
- Return type:
- get_evolved_operator_with_state(G, where, *, max_bond=None, cutoff=None)[source]¶
Return the evolved operator \(U^\dagger G U\) projected onto the
|00...0>initial state on both sides, i.e. the tensor network whose full contraction is \(\langle 0 | U^\dagger G U | 0 \rangle\). The physical indices are projected withisel; the caller can contract the returned network however they like.
- local_expectation(G, where, *, max_bond=None, cutoff=None, optimize='auto-hq', **contract_opts)[source]¶
Compute \(\langle 0 | U^\dagger G U | 0 \rangle\), the expectation of the local operator
Gatwherein the state prepared by the recorded circuitUacting on|00...0>.- Parameters:
G (array_like) – The local operator acting on the site(s) in
where.where (hashable or sequence[hashable]) – The site or sites the operator acts on.
max_bond (optional) – Override the compression options for this call.
cutoff (optional) – Override the compression options for this call.
optimize (str, optional) – The contraction path optimizer for the final contraction.
contract_opts – Supplied to the final
contract().
- Return type: