-
Notifications
You must be signed in to change notification settings - Fork 29
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
Allow users to specify cut decompositions in terms of a native gate set #495
Conversation
q = QuantumRegister(1, "q") | ||
def_sxdg = QuantumCircuit(q) | ||
for inst in [ | ||
RZGate(np.pi / 2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the names of the classes should include SingleQubitEagle...
circuit_knitting/cutting/qpd/qpd.py
Outdated
@@ -1143,7 +1144,13 @@ def _decompose_qpd_instructions( | |||
for data in inst.operation.definition.data: | |||
# Can ignore clbits here, as QPDGates don't use clbits directly | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
EagleEquivalenceLibrary
andHeronEquivalenceLibrary
for 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_experiments
all 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:
qpd
around parsing the target device and getting the right equivalence librarygenerate_cutting_experiments