Skip to content

Commit ab5640d

Browse files
fix missing inverse definitions in generate_basis_approximations (#13517) (#13964)
* fix missing inverse definitions in `generate_basis_approximation` * add missing basis gates to test * add bugfix release note * Update releasenotes/notes/fix-missing-inverse-definition-af7fe8d9f2193308.yaml * Fix reno annotation --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <jules.gacon@googlemail.com> (cherry picked from commit 149d5a6) Co-authored-by: Lukas Burgholzer <burgholzer@me.com>
1 parent e3e6b01 commit ab5640d

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

qiskit/synthesis/discrete_basis/generate_basis_approximations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"tdg": "t",
3838
"s": "sdg",
3939
"sdg": "s",
40+
"sx": "sxdg",
41+
"sxdg": "sx",
4042
}
4143

4244
_1q_gates = {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fixes:
2+
- |
3+
Fixed a bug in the basis approximation generation for :class:`.SolovayKitaev`.
4+
Previously, generating discrete basis approximations using
5+
``generate_basis_approximations`` for a basis containing ``"sx"`` or
6+
``"sxdg"`` gates would fail. This has now been fixed.

test/python/transpiler/test_solovay_kitaev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def test_generate_basis_approximation_gates(self):
429429
430430
Regression test of Qiskit/qiskit-terra#9585.
431431
"""
432-
basis = ["i", "x", "y", "z", "h", "t", "tdg", "s", "sdg"]
432+
basis = ["i", "x", "y", "z", "h", "t", "tdg", "s", "sdg", "sx", "sxdg"]
433433
approx = generate_basic_approximations(basis, depth=2)
434434

435435
# This mainly checks that there are no errors in the generation (like

0 commit comments

Comments
 (0)