Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve public type annotations for OneQubitEulerDecomposer #12530

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions qiskit/synthesis/one_qubit/one_qubit_decompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Decompose a single-qubit unitary via Euler angles.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np

from qiskit._accelerate import euler_one_qubit_decomposer
Expand All @@ -37,6 +38,9 @@
from qiskit.circuit.gate import Gate
from qiskit.quantum_info.operators.operator import Operator

if TYPE_CHECKING:
from qiskit.dagcircuit import DAGCircuit

DEFAULT_ATOL = 1e-12

ONE_QUBIT_EULER_BASIS_GATES = {
Expand Down Expand Up @@ -150,7 +154,7 @@ def __init__(self, basis: str = "U3", use_dag: bool = False):
self.basis = basis # sets: self._basis, self._params, self._circuit
self.use_dag = use_dag

def build_circuit(self, gates, global_phase):
def build_circuit(self, gates, global_phase) -> QuantumCircuit | DAGCircuit:
"""Return the circuit or dag object from a list of gates."""
qr = [Qubit()]
lookup_gate = False
Expand Down Expand Up @@ -186,7 +190,7 @@ def __call__(
unitary: Operator | Gate | np.ndarray,
simplify: bool = True,
atol: float = DEFAULT_ATOL,
) -> QuantumCircuit:
) -> QuantumCircuit | DAGCircuit:
"""Decompose single qubit gate into a circuit.

Args:
Expand Down
Loading