Allow users to specify cut decompositions in terms of a native gate set#495
Allow users to specify cut decompositions in terms of a native gate set#495caleb-johnson wants to merge 5 commits intomainfrom
Conversation
| q = QuantumRegister(1, "q") | ||
| def_sxdg = QuantumCircuit(q) | ||
| for inst in [ | ||
| RZGate(np.pi / 2), |
There was a problem hiding this comment.
The BasisTranslator returned this. Fairly certain we can collapse to one pi rotation on either side of the sxgate
| PhaseGate, | ||
| ) | ||
|
|
||
| _eagle_sel = HeronEquivalenceLibrary = EagleEquivalenceLibrary = EquivalenceLibrary() |
There was a problem hiding this comment.
Should document that these libraries are for single-qubit operations only. Should also document that it is assumed that each input will produce, at most, one equivalence.
There was a problem hiding this comment.
Maybe the names of the classes should include SingleQubitEagle...
| assert data.clbits == () | ||
| tmp_data.append(CircuitInstruction(data.operation, qubits=[qubits[0]])) | ||
| try: | ||
| equiv = EagleEquivalenceLibrary.get_entry(data.operation)[0] |
There was a problem hiding this comment.
The equivalence libraries in CKT are guaranteed to only have, at most, a single equivalence defined for now.
| q = QuantumRegister(1, "q") | ||
| def_ry = QuantumCircuit(q) | ||
| theta = Parameter("theta") | ||
| for inst in [SXGate(), RZGate(theta + np.pi), SXGate(), RZGate(3 * np.pi)]: |
There was a problem hiding this comment.
Another strange one from BasisTranslator I wasn't sure about. Can the 3*pi be simplified to just pi?
| tmp_data.append(CircuitInstruction(data.operation, qubits=[qubits[0]])) | ||
| else: | ||
| # CKT equivalence libraries only define one mapping per input | ||
| for d in equiv[0].data: |
There was a problem hiding this comment.
Should assert equiv is length-1 here
|
|
||
| _eagle_sel = HeronEquivalenceLibrary = EagleEquivalenceLibrary = EquivalenceLibrary() | ||
|
|
||
| ########## Single-qubit Eagle native gate set: x, sx, rz, i ########## |
There was a problem hiding this comment.
I think it's better to delete the native gates from the equivalence library. Qiskit equivalence libraries don't return the gate itself, only alternate equivalences.
Pull Request Test Coverage Report for Build 8474101661Details
💛 - Coveralls |
7a8f177 to
512060f
Compare
d4e9121 to
73d8ab9
Compare
|
Closing in favor of #517 |
Fixes #492
This PR introduces an
EagleEquivalenceLibraryandHeronEquivalenceLibraryfor translating all the gates we use in cutting decompositions to the corresponding native gate set. This allows users to transpile their "Cut Circuit" one time, and when theygenerate_cutting_experimentsall of their subexperiments will already be translated to the native gate set for the processor type they specified. If they don't specify, the "standard" gate set will be used. Heron single qubit native gates are the same as Eagle, so we get that equivalence library for free.TODO:
qpdaround parsing the target device and getting the right equivalence librarygenerate_cutting_experiments