From 385867cca984f6b9ee0bae42ec17bd0640ec6874 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Mon, 16 Dec 2024 09:44:55 +0400 Subject: [PATCH 1/5] fix doc --- src/qibo/models/circuit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index 31f8570d88..8c89611305 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -120,9 +120,12 @@ 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. + Example: - .. testcode:: + .. code-block:: python + from qibo import Circuit + c = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] c = Circuit(["A", "B", "C", "D", "E"]) c = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) From 32c470002a480372d7e042d36a3fa9037efa5cba Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Mon, 16 Dec 2024 09:44:33 +0000 Subject: [PATCH 2/5] Update src/qibo/models/circuit.py --- src/qibo/models/circuit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index 8c89611305..747a8208f6 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -126,9 +126,9 @@ class Circuit: from qibo import Circuit - c = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] - c = Circuit(["A", "B", "C", "D", "E"]) - c = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) + circuit = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] + circuit = Circuit(["A", "B", "C", "D", "E"]) + circuit = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) c = Circuit(wire_names=["A", "B", "C", "D", "E"]) Args: From f5b93b430e740c7c2608f7ff38240549106021b8 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Mon, 16 Dec 2024 13:46:36 +0400 Subject: [PATCH 3/5] fix --- src/qibo/models/circuit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index 747a8208f6..5e2de220b7 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -129,7 +129,7 @@ class Circuit: circuit = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] circuit = Circuit(["A", "B", "C", "D", "E"]) circuit = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) - c = Circuit(wire_names=["A", "B", "C", "D", "E"]) + circuit = Circuit(wire_names=["A", "B", "C", "D", "E"]) Args: nqubits (int | list, optional): Number of qubits in the circuit or a list of wire names. From b33ed3528e14050d00a8fc2eb1b142cf4e90746c Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Mon, 16 Dec 2024 15:24:25 +0400 Subject: [PATCH 4/5] merge master --- src/qibo/models/circuit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index 396f911093..af3c750bc2 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -133,6 +133,7 @@ class Circuit: from qibo import Circuit + # Every circuit initialization below is valid circuit = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] circuit = Circuit(["A", "B", "C", "D", "E"]) circuit = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) From 9a173f49ef0439897fd1cdc43c8349708882c92d Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Mon, 16 Dec 2024 15:27:06 +0400 Subject: [PATCH 5/5] short command --- src/qibo/models/circuit.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index af3c750bc2..597d0d2c9d 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -127,17 +127,15 @@ class Circuit: - ``nqubits`` and ``wire_names`` must be consistent with each other. - Example: - - .. code-block:: python + Example:: - from qibo import Circuit + from qibo import Circuit - # Every circuit initialization below is valid - circuit = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] - circuit = Circuit(["A", "B", "C", "D", "E"]) - circuit = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) - circuit = Circuit(wire_names=["A", "B", "C", "D", "E"]) + # Every circuit initialization below is valid + circuit = Circuit(5) # Default wire names are [0, 1, 2, 3, 4] + circuit = Circuit(["A", "B", "C", "D", "E"]) + circuit = Circuit(5, wire_names=["A", "B", "C", "D", "E"]) + circuit = Circuit(wire_names=["A", "B", "C", "D", "E"]) Args: nqubits (int | list, optional): Number of qubits in the circuit or a list of wire names.