-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix classical-synthesis label ordering with
registerless=False
(#9536…
…) (#10647) * follow the Tweedledum convention on endianness * reno * add test * optional dep * docstring * reno * attempt to fix sphinx --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> (cherry picked from commit 287ac5c) Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
- Loading branch information
1 parent
67061ae
commit c1ee974
Showing
5 changed files
with
73 additions
and
5 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
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
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,40 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed `#9363 <https://github.com/Qiskit/qiskit-terra/issues/9363>`__. | ||
by labeling the non-registerless synthesis in the order that Tweedledum | ||
returns. For example, compare this example before and after the fix:: | ||
from qiskit.circuit import QuantumCircuit | ||
from qiskit.circuit.classicalfunction import BooleanExpression | ||
boolean_exp = BooleanExpression.from_dimacs_file("simple_v3_c2.cnf") | ||
circuit = QuantumCircuit(boolean_exp.num_qubits) | ||
circuit.append(boolean_exp, range(boolean_exp.num_qubits)) | ||
circuit.draw("text") | ||
from qiskit.circuit.classicalfunction import classical_function | ||
from qiskit.circuit.classicalfunction.types import Int1 | ||
@classical_function | ||
def grover_oracle(a: Int1, b: Int1, c: Int1) -> Int1: | ||
return (a and b and not c) | ||
quantum_circuit = grover_oracle.synth(registerless=False) | ||
print(quantum_circuit.draw()) | ||
Which would print | ||
.. parsed-literal:: | ||
Before After | ||
c: ──■── a: ──■── | ||
│ │ | ||
b: ──■── b: ──■── | ||
│ │ | ||
a: ──o── c: ──o── | ||
┌─┴─┐ ┌─┴─┐ | ||
return: ┤ X ├ return: ┤ X ├ | ||
└───┘ └───┘ | ||
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
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