From e485312fdc6ee3111338e04ef5ed9f9168b854a1 Mon Sep 17 00:00:00 2001 From: changsookim <> Date: Thu, 28 Nov 2024 17:20:21 +0400 Subject: [PATCH] fix: circuit docstring --- src/qibo/models/circuit.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index 4bd6562446..9c70a61796 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -120,8 +120,17 @@ class Circuit: A specific backend has to be used for performing calculations. Circuits can be created with a specific number of qubits and wire names. + + - Either ``nqubits`` or ``wire_names`` must be provided. + - If only ``nqubits`` is provided, wire names will default to ``[0, 1, ..., nqubits - 1]``. + - If only ``wire_names`` is provided, ``nqubits`` will be set to the length of ``wire_names``. + - ``nqubits`` and ``wire_names`` must be consistent with each other. + + Example: + .. testcode:: + from qibo import Circuit c = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] c = Circuit(["A", "B", "C", "D", "E"]) @@ -130,12 +139,7 @@ class Circuit: Args: nqubits (int | list, optional): Number of qubits in the circuit or a list of wire names. - wire_names (list, optional): List of wire names. - - Either ``nqubits`` or ``wire_names`` must be provided. - - If only ``nqubits`` is provided, wire names will default to [``0``, ``1``, ..., ``nqubits - 1``]. - - If only ``wire_names`` is provided, ``nqubits`` will be set to the length of ``wire_names``. - - ``nqubits`` and ``wire_names`` must be consistent with each other. - + wire_names (list, optional): List of wire names init_kwargs (dict): a dictionary with the following keys - *nqubits*