From c1612474826022fb31485f8d56d80717db402993 Mon Sep 17 00:00:00 2001 From: abbycross Date: Thu, 16 Jan 2025 13:33:37 -0500 Subject: [PATCH] simplify circuit Co-authored-by: Frank Harkins --- qiskit/circuit/quantumcircuit.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 2c60822e7dc..fb2d0b9abe5 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -4435,15 +4435,11 @@ def global_phase(self) -> ParameterValueType: :nofigs: :context: reset - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qreg_q = QuantumRegister(2, 'q') - creg_c = ClassicalRegister(2, 'c') - circuit = QuantumCircuit(qreg_q, creg_c) - - circuit.h(qreg_q[0]) - circuit.cx(qreg_q[0], qreg_q[1]) + from qiskit import QuantumCircuit + circuit = QuantumCircuit(2) + circuit.h(0) + circuit.cx(0, 1) print(circuit.global_phase) # find the global phase of the current circuit .. code-block:: text