forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constructor to build target from legacy transpiler model (Qiskit#…
…9255) * Add constructor to build target from legacy transpiler model This commit adds a new constructor method from_configuration() to the Target class. This can be used to construct a new Target object from the legacy input types: basis_gates, coupling_map, etc. This can then be used to provide a conversion layer in transpile() in support of migrating to using the target everywhere internally. * Add more test coverage * Apply suggestions from code review Co-authored-by: Kevin Krsulich <kevin@krsulich.net> * Make num_qubits optional * Explain arg precedence in docstring * Use assertRaisesRegex * Fix lint * Fix rebase name mismatch * Fix lint * Update error message with multiqubit gates * Give instruction durations higher priority * Improve handling of instruction schedule map * Add comment about how connectivity is defined * Update test exception assertion regex for new error message * Update qiskit/transpiler/target.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> --------- Co-authored-by: Kevin Krsulich <kevin@krsulich.net> Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
- Loading branch information
1 parent
a03e418
commit 7b317f7
Showing
3 changed files
with
365 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
releasenotes/notes/new-constructor-target-from-configuration-91f7eb569d95b330.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new constructor for the :class:`~.Target` class, | ||
:meth:`.Target.from_configuration`, which lets you construct a | ||
:class:`~.Target` object from the separate object types for describing | ||
the constraints of a backend (e.g. basis gates, :class:`~.CouplingMap`, | ||
:class:`~.BackendProperties`, etc). For example:: | ||
target = Target.from_configuration( | ||
basis_gates=["u", "cx", "measure"], | ||
coupling_map=CouplingMap.from_line(25), | ||
) | ||
This will construct a :class:`~.Target` object that has :class:`~.UGate`, | ||
:class:`~.CXGate`, and :class:`~.Measure` globally available on 25 qubits | ||
which are connected in a line. |
Oops, something went wrong.