Closed jasonchadwick closed 1 year ago
Thanks for the bug report!
The issue is a bit hidden here. The qiskit_to_bqskit
first uses qiskit to convert the random unitary to qasm using KAK. The way qiskit encodes this into qasm is with a gate declaration, which BQSKit then parses into a CircuitGate
object. This caused issues with the compile function's ability to determine the input gate set and rebase. Should be fixed now, I put up a PR if you would like to test it out. Otherwise, this will make it into the 1.1.0a3 soon and eventually the 1.1 release.
Example to reproduce:
This will print
{U3Gate, CNOTGate}
instead of the desired{U3Gate, CZGate}
(and the circuitoutput_circuit
will consist of CNOTs and U3 gates instead of using the desired CZ operations). This appears to be the case for any non-CNOT 2-qubit gate.Behavior is correct when using
bqskit.compile(np.array(u), model=model)
, so it seems that the circuit object is causing the problem.Behavior is correct when specifying a 3-qubit gate instead of a 2-qubit gate, e.g.
gate_set={bqskit.ir.gates.Toffoli(3), bqskit.ir.gates.U3Gate(1)}
(if circuit size is extended to 3 qubits instead of 2).