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

Expand instruction_supported() to optionally check parameters #7807

Merged
merged 17 commits into from
Jun 22, 2022
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
features:
- |
The :meth:`.Target.instruction_supported` method now supports two new
keyword arguments, ``operation_class`` and ``parameters``. Using these
arguments the :meth:`~.Target.instruction_supported` method can now be used
for checking that a specific operation with parameter values are supported
by a :class:`~.Target` object. For example, if you want to check if a
:class:`~.Target` named ``target`` supports running a :class:`~.RXGate`
with :math:`\theta = \frac{\pi}{2}` you would do something like::

from math import pi
from qiskit.circuit.library import RXGate

target.instruction_supported(operation_class=RXGate, parameters=[pi/2])

which will return ``True`` if ``target`` supports running :class:`~.RXGate`
with :math:`\theta = \frac{\pi}{2}` and ``False if it does not.