Skip to content
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

transpiler cirq SWAP and MEASURE gates, wrong number of qubits #9

Closed
ryanhill1 opened this issue Jun 14, 2021 · 2 comments
Closed

transpiler cirq SWAP and MEASURE gates, wrong number of qubits #9

ryanhill1 opened this issue Jun 14, 2021 · 2 comments
Assignees
Labels
bug 🐛 Something isn't working

Comments

@ryanhill1
Copy link
Member

In qBraid/tests/circuits/test_circuit.py run test_qiskit_to_all() on line 392. On line 118 we create a qiskit swap gate, and on line 128 we create a qiskit measurement gate. Transpiling each of these gates to a cirq gates fails with Value Error: wrong number of qubits. The measurement gate transpilation is handled differently than other non-parameterized gates, but the swap implementation should work similarly to CX and other non-parameterized two-qubit gates. Running test_braket_to_all() on line 382 for the case of transpiling a braket swap gate to cirq also produces the same error.

@ryanhill1 ryanhill1 added the bug 🐛 Something isn't working label Jun 14, 2021
@ryanhill1
Copy link
Member Author

@erikweis Just fixed the swap bug. Internally, cirq SWAP was actually SwapPowGate, so just needed to account for the exponent in cirq/utils and that fixed the problem. Measurement gate bug still "To Do"

erikweis added a commit that referenced this issue Jun 16, 2021
@erikweis
Copy link
Contributor

erikweis commented Jun 16, 2021

I think I remember what happened here. I realized that the measurement gate for Cirq was going to require a separate measurement gate for each qubit (unlike qiskit, I think). Setting up the transpiler to handle iterables or lists (in addition to the single object), for example an instruction could be a single gate, or a list of gates, opened up a new can of worms, and I wanted to punt it.

What I've done is, rather than return a single instruction, I return a list of measurement instructions. I didn't expect this to work out of the box, but it did. So this issue is closed for now, but we will want to handle this kind of thing (where one gate in one package is several in another) more robustly down the road. @ryanhill1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants