-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix RuntimeError
when converting qiskit instructions.
#203
Conversation
RuntimeError
when converting qiskit instructions.
@@ -24,9 +24,9 @@ | |||
ClassicalRegister, | |||
execute, | |||
) | |||
from qiskit.quantum_info import Pauli, SparsePauliOp # type: ignore |
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 noticed that pylint didn't pick up this unused import in previous workflow runs.
I'd expect it to complain about this.
qc2 = tk_to_qiskit(converted_tkc) | ||
tkc2 = qiskit_to_tk(qc2) | ||
unitary2 = tkc2.get_unitary() | ||
assert compare_unitaries(unitary1, unitary2) |
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.
For completeness can we also check the unitary against that of the original qiskit circuit?
from qiskit.quantum_info import Operator
unitary0 = Operator(qc).data
(Might have to correct for endianness?)
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.
Yeah makes sense. Done.
Addresses #200
Consider the following example
If we try to convert
qc
to a pytketCircuit
withqiskit_to_tk
then we getNow pytket-qiskit converts the instruction to a
CustomGate
. The actual gate definition works fine but theCircuit.add_custom_gate()
method is failing because there are no free symbols in the circuit.I've decided to just handle this case with
CircBox
as I think its simpler.There is still one assert failure in test which I'm puzzled by. This is the one that checks the name of the circuit.
EDIT: Resolved