qat.qpus.MPO
- class qat.qpus.MPO(hardware_model=None, compression_method: str = 'SVD', bond_dimension: int = None, fidelity: float = None, adaptative_strategy: str = 'naive', maximum_adaptative_bond_dimension: int = 1024, compute_fidelity: bool = False, merge_gate: bool = False, progress_bar: bool = False, qubit_grouping: list = None, disable_resource_management: bool = False, verbose: bool = False, heisenberg_picture: bool = False, **kwargs)
Matrix Product Operator simulator QPU for noisy quantum circuits.
Two computation modes exist:
Fixed bond dimension mode: Setting a bond_dimension will compute the MPO and truncate any bond dimension above given bond_dimension value.
Adaptative bond dimension mode: Setting a fidelity will ensure the final quantum state reaches a minima this fidelity | value. The algorithm will adapt dynamically the bond dimension used throughout the calculation to ensure optimal bond | dimension sizes and mnimal error. The fidelity set at the start is guaranteed.
Note
If bond_dimension and fidelity are set to None, the algorithm will not truncate any bond dimension, and the simulation will be exact.
- Parameters
hardware_model (HardwareModel, optional) – A hardware model. If unset, uses the noiseless DefaultHardwareModel.
compression_method (str, optional) – The method of truncation to use. For now only one is available: - “SVD”: Truncation method based on SVD truncations.
bond_dimension (int, optional) – The maximum bond dimension size allowed throughout the tensor network simulation.
fidelity (float, optional) – Required precision for the truncation of the density matrix. If set to None, no precision goal will be set for each truncation. If set to a value, the set bond dimension will be allowed to increase to reach this specific truncation fidelity.
adaptative_strategy (str, optional) –
Strategy to adopt when selecting the target truncation fidelity of each quantum gate. The list of strategy includes:
”naive”: The fidelity goal is defined at the start of the simulation and is not dynamically updated.
”nearest”: The fidelity goal is updated from neighbour to neighbour. The first truncation fidelity computed updates the next nearest target truncation fidelity, while enforcing a total simulation fidelity higher than set input fidelity goal.
”global”: The fidelity is updated globally. Every computed truncation fidelity updates every remaining target truncation fidelity.
maximum_adaptative_bond_dimension (int, optional) – Maximum bond dimension the adaptative truncation scheme is allowed to reach. Falls back to maximum bond dimension truncation scheme if exceeded. In that case, the input fidelity is not guaranteed.
compute_fidelity (bool, optional) – If True, each truncation fidelity will be stored for each truncation and each qubit, and added to the Result metadata.
merge_gate (bool, optional) – In some cases, the noise is added to noiseless gates by adding a noise gate just after it in the circuit. This is seen within the truncation algorithm as another gate, leading to truncation. To avoid truncating such gates, the merge_gate flag can be set to True. This prevents the truncation of every second gates being applied. Note that if a limit bond_dimension is set, the maximum bond dimension reached will be bond_dimension * 4.
progress_bar (bool, optional) – If a progress bar should be displayed during the circuit simulation.
qubit_grouping (List[int], optional) – grouping of the qubits. E.g (4, 5, 2) for 3 groups with a total of 4+5+2=11 qubits. Defaults to None: no grouping, i.e (1, 1, …) (nqbits 1’s)
disable_resource_management (bool, optional) – If True, disable the resource management and set no limit on how much memory the QPU can use.
Mathematical description
Any mixed state can be described by a density matrix \(\hat{\rho}\):
with \(C_{\sigma_{1}\sigma'_{1},...,\sigma_{N}\sigma'_{N}}\) a 2D tensor containing \(2^N \times 2^N\) complex values and \(\{|\sigma_i\rangle\}\) forming an orthonormal basis.
\(\hat{\rho}\) can be cast into an matrix product operator [Schollwoeck2010], via successive SVD decompositions:
We obtain a product of \(N\) complex-valued tensors \(\{A^{[i]\sigma_i}\}\), separated by bond dimensions \(\{\chi_1, \chi_2, ..., \chi_{N-1}\}\). Assuming the \(\chi\) are bounded by a maximum bond dimension \(\chi_{max}\), the number of values contained in the MPO scales in \(\mathcal{O}(N^2\chi_{max}^3)\) with \(N\) the number of qubits of the system.
Essentially, applying operators (the quantum gates) increases bond dimensions throughout the simulation, and truncating these bond dimensions allows us to approximate the state. For more informations on the two truncation modes we provide, please refer to our user guide on MPO.
In sample mode with a finite number of shots, samples are obtained efficiently using the OPES algorithm [Ballarin2024].