From 97d2c793009b17b4b840669e47c8585feb37534c Mon Sep 17 00:00:00 2001 From: MatteoRobbiati Date: Mon, 10 Feb 2025 12:17:37 +0100 Subject: [PATCH] doc: improve docstrings related to TensorNetworkResult --- src/qibotn/backends/qmatchatea.py | 7 +++---- src/qibotn/result.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/qibotn/backends/qmatchatea.py b/src/qibotn/backends/qmatchatea.py index 42559fb..f6b8ad4 100644 --- a/src/qibotn/backends/qmatchatea.py +++ b/src/qibotn/backends/qmatchatea.py @@ -126,9 +126,6 @@ class QMatchaTeaBackend(QibotnBackend, NumpyBackend): prob_type = "U" prob_kwargs = {"num_samples": 500} - # To be sure the setup is correct and no modifications have been done - self._setup_qmatchatea_backend() - # TODO: check circuit = self._qibocirc_to_qiskitcirc(circuit) run_qk_params = qmatchatea.preprocessing.qk_transpilation_params(False) @@ -189,7 +186,9 @@ class QMatchaTeaBackend(QibotnBackend, NumpyBackend): (e.g., `X(0)*Y(1)` or `Z(0)*Z(1) + 1.5*Y(2)`). Returns: - qmatchatea.SimulationResult [TEMPORARY] + qibotn.TensorNetworkResult class, providing methods to retrieve + probabilities, frequencies and state always according to the chosen + simulation setup. """ # From Qibo to Qiskit diff --git a/src/qibotn/result.py b/src/qibotn/result.py index 0d440d3..412dbc0 100644 --- a/src/qibotn/result.py +++ b/src/qibotn/result.py @@ -10,6 +10,20 @@ from qibotn.backends.abstract import QibotnBackend @dataclass class TensorNetworkResult: + """ + Object to store and process the output of a Tensor Network simulation of a quantum circuit. + + Args: + nqubits (int): number of qubits involved in the simulation; + backend (QibotnBackend): specific backend on which the simulation has been performed; + measures (dict): measures (if performed) during the tensor network simulation; + measured_probabilities (Union[dict, ndarray]): probabilities of the final state + according to the simulation; + prob_type (str): string identifying the method used to compute the probabilities. + Especially useful in case the `QmatchateaBackend` is selected. + statevector (ndarray): if computed, the reconstructed statevector. + """ + nqubits: int backend: QibotnBackend measures: dict