diff --git a/qiskit/qpy/binary_io/circuits.py b/qiskit/qpy/binary_io/circuits.py index a50f202afa2a..fe7ff5e00b7d 100644 --- a/qiskit/qpy/binary_io/circuits.py +++ b/qiskit/qpy/binary_io/circuits.py @@ -296,7 +296,11 @@ def _read_instruction(file_obj, circuit, registers, custom_operations, version, "UCRXGate", "UCRYGate", "UCRZGate", +<<<<<<< HEAD + "diagonal", +======= "DiagonalGate", +>>>>>>> 982807e5bc8d7b0b7fa130b4cb2b09064b4224d4 }: gate = gate_class(params) else: diff --git a/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py b/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py index 5b17ca52d190..49e644951075 100644 --- a/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +++ b/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py @@ -257,7 +257,7 @@ def run(self, dag): if gate is not None: new_dag.apply_operation_back(gate, [dag_qubit]) - new_dag.global_phase = _mod_2pi(new_dag.global_phase + sequence_gphase) + new_dag.global_phase = new_dag.global_phase + sequence_gphase return new_dag @@ -268,9 +268,3 @@ def __gate_supported(self, gate: Gate, qarg: int) -> bool: return False -def _mod_2pi(angle: float, atol: float = 0): - """Wrap angle into interval [-π,π). If within atol of the endpoint, clamp to -π""" - wrapped = (angle + np.pi) % (2 * np.pi) - np.pi - if abs(wrapped - np.pi) < atol: - wrapped = -np.pi - return wrapped diff --git a/releasenotes/notes/add-diagonal-to-DiagonalGate-c945e0f8adcd2940.yaml b/releasenotes/notes/add-diagonal-to-DiagonalGate-c945e0f8adcd2940.yaml new file mode 100644 index 000000000000..2d221e30ad5e --- /dev/null +++ b/releasenotes/notes/add-diagonal-to-DiagonalGate-c945e0f8adcd2940.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes initiation of ``DiagonalGate``. Refer to + `#10364 ` for more + details. \ No newline at end of file diff --git a/releasenotes/notes/fix-param-global-phase-300dacb389d2f26c.yaml b/releasenotes/notes/fix-param-global-phase-300dacb389d2f26c.yaml new file mode 100644 index 000000000000..b32966ebd6ea --- /dev/null +++ b/releasenotes/notes/fix-param-global-phase-300dacb389d2f26c.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + 2pi wrapping cannot be applied on a parameterized global phase.Use the + DAGCircuit global_phase setter to wrap the phase for floats only.Refer to + `#10569 ` for more + details. \ No newline at end of file diff --git a/test/qpy_compat/test_qpy.py b/test/qpy_compat/test_qpy.py index 7eb9b1a6dd99..867cc9141a27 100755 --- a/test/qpy_compat/test_qpy.py +++ b/test/qpy_compat/test_qpy.py @@ -575,6 +575,13 @@ def generate_open_controlled_gates(): return circuits +<<<<<<< HEAD +def generate_diagonal_gate_circuit(): + """Generate diagonal gate circuit.""" + diagonal_circuit = QuantumCircuit(2, name="diagonal_circuit") + diagonal_circuit.diagonal([1, -1, -1, 1], [0, 1]) + return diagonal_circuit +======= def generate_acquire_instruction_with_kernel_and_discriminator(): """Test QPY serialization with Acquire instruction with kernel and discriminator.""" from qiskit.pulse import builder, AcquireChannel, MemorySlot, Discriminator, Kernel @@ -707,6 +714,7 @@ def generate_control_flow_expr(): qc4.rz(np.pi, 0) return [qc1, qc2, qc3, qc4] +>>>>>>> 982807e5bc8d7b0b7fa130b4cb2b09064b4224d4 def generate_circuits(version_parts):