From 8e95c4acdc369b8535682521da77d6cb810822b6 Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Mon, 24 Jul 2023 15:53:43 -0400 Subject: [PATCH] Make `explicitly_supported_gates` private and remove its release note It's not clear that this function remains useful now that we support essentially all 2-qubit gates. If we find a use for it in the future, we can re-introduce it (or something like it) as a public interface. --- circuit_knitting/cutting/__init__.py | 1 - circuit_knitting/cutting/qpd/__init__.py | 2 -- circuit_knitting/cutting/qpd/qpd.py | 11 +++++------ .../notes/supported-gates-d2156f58bc07fc7a.yaml | 4 ---- test/cutting/qpd/test_qpd.py | 3 ++- 5 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 releasenotes/notes/supported-gates-d2156f58bc07fc7a.yaml diff --git a/circuit_knitting/cutting/__init__.py b/circuit_knitting/cutting/__init__.py index c5d976cc6..8aeeda34d 100644 --- a/circuit_knitting/cutting/__init__.py +++ b/circuit_knitting/cutting/__init__.py @@ -57,7 +57,6 @@ qpd.generate_qpd_weights qpd.generate_qpd_samples qpd.decompose_qpd_instructions - qpd.explicitly_supported_gates qpd.qpdbasis_from_gate CutQC diff --git a/circuit_knitting/cutting/qpd/__init__.py b/circuit_knitting/cutting/qpd/__init__.py index dbee8fa9d..df68ff7a7 100644 --- a/circuit_knitting/cutting/qpd/__init__.py +++ b/circuit_knitting/cutting/qpd/__init__.py @@ -18,7 +18,6 @@ decompose_qpd_instructions, WeightType, qpdbasis_from_gate, - explicitly_supported_gates, ) from .instructions import ( BaseQPDGate, @@ -32,7 +31,6 @@ "generate_qpd_weights", "generate_qpd_samples", "decompose_qpd_instructions", - "explicitly_supported_gates", "QPDBasis", "BaseQPDGate", "TwoQubitQPDGate", diff --git a/circuit_knitting/cutting/qpd/qpd.py b/circuit_knitting/cutting/qpd/qpd.py index 7429ef69a..6a47d8b40 100644 --- a/circuit_knitting/cutting/qpd/qpd.py +++ b/circuit_knitting/cutting/qpd/qpd.py @@ -559,11 +559,10 @@ def qpdbasis_from_gate(gate: Gate) -> QPDBasis: """ Generate a :class:`.QPDBasis` object, given a supported operation. - The operations with explicit support can be obtained by calling - :func:`explicitly_supported_gates`. - - Additionally, all two-qubit gates which implement the :meth:`.Gate.to_matrix` method are - supported via a KAK decomposition (:class:`.TwoQubitWeylDecomposition`). + All two-qubit gates which implement the :meth:`.Gate.to_matrix` method are + supported. This should include the vast majority of gates with no unbound + parameters, but there are some special cases (see, e.g., `qiskit issue #10396 + `__). Returns: The newly-instantiated :class:`QPDBasis` object @@ -602,7 +601,7 @@ def qpdbasis_from_gate(gate: Gate) -> QPDBasis: raise ValueError(f"Gate not supported: {gate.name}") from None -def explicitly_supported_gates() -> set[str]: +def _explicitly_supported_gates() -> set[str]: """ Return a set of instruction names with explicit support for automatic decomposition. diff --git a/releasenotes/notes/supported-gates-d2156f58bc07fc7a.yaml b/releasenotes/notes/supported-gates-d2156f58bc07fc7a.yaml deleted file mode 100644 index 1a77293ee..000000000 --- a/releasenotes/notes/supported-gates-d2156f58bc07fc7a.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -upgrade: - - | - Addition of :func:`~circuit_knitting.cutting.qpd.explicitly_supported_gates` function, which returns the names of all gates which are explicitly supported by :func:`~circuit_knitting.cutting.qpd.qpdbasis_from_gate`. diff --git a/test/cutting/qpd/test_qpd.py b/test/cutting/qpd/test_qpd.py index 2fab44f3d..6c1bb66de 100644 --- a/test/cutting/qpd/test_qpd.py +++ b/test/cutting/qpd/test_qpd.py @@ -47,6 +47,7 @@ _generate_exact_weights_and_conditional_probabilities, _nonlocal_qpd_basis_from_u, _u_from_thetavec, + _explicitly_supported_gates, ) @@ -426,7 +427,7 @@ def from_theta(theta): assert weights[map_ids][1] == WeightType.SAMPLED def test_explicitly_supported_gates(self): - gates = explicitly_supported_gates() + gates = _explicitly_supported_gates() self.assertEqual( { "rxx",