ket.mps¶
Matrix Product State (MPS) Quantum Simulator Backend.
This module provides the MPS backend, which leverages Tensor Networks
(via quimb.tensor) and JAX’s Automatic Differentiation to simulate quantum circuits
with a 1D linear topology. It supports calculating exact expectation values and their gradients,
making it suitable for running parameterized quantum algorithms like VQE efficiently.
Summary¶
Classes
Matrix Product State (MPS) backend simulator. |
Classes¶
- class MPS(
- num_qubits: int,
- max_bond: int = None,
- double_precision: bool = False,
- execution: Literal['live', 'batch'] | None = None,
- gradient: bool = False,
Bases:
BatchExecution,LiveExecutionMatrix Product State (MPS) backend simulator.
The
MPSbackend is specialized for executing quantum circuits with 1D linear topologies. It uses tensor network contractions via thequimblibrary, augmented by JAX to support exact parameter gradient evaluations for parameterized circuits.- Parameters:
num_qubits – Total number of qubits to simulate.
max_bond – Maximum bond dimension for SVD truncations during the simulation. If specified, it restricts entanglement and keeps the MPS strictly 1D, enabling the simulation of large numbers of qubits. However, this dynamically changes tensor shapes and disables JAX’s
jitcompilation, which may result in slower evaluations. IfNone, the network is built in 2D and contracted fully at the end, which is JIT-compatible but may scale poorly with depth. Defaults toNone.double_precision – Whether to enable 64-bit floating point precision (double precision) in JAX. Defaults to
False. Set toTruefor higher accuracy in deep circuits.
- sample(*args)[source]¶
Execute the circuit and sample the given qubits.
Warning
This method is called by Libket and should not be called directly.