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

[DRAFT] feat: handle IfElseOp in qiskit_to_tk #437

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

Conversation

CalMacCQ
Copy link
Contributor

@CalMacCQ CalMacCQ commented Dec 17, 2024

Description

NOT WORKING YET

Handling an IfElseOp as two conditional CircBoxes.

Related issues

Please mention any github issues addressed by this PR.

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

@CalMacCQ CalMacCQ requested a review from cqc-melf as a code owner December 17, 2024 14:37
new_else_qc = QuantumCircuit(default_qreg_else, default_creg_else)

if_builder = CircuitBuilder(new_if_qc.qregs, new_if_qc.cregs)
if_builder.add_qiskit_data(if_qc)
Copy link
Contributor Author

@CalMacCQ CalMacCQ Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this call to the add_qiskit_data method is wrong.

The if_qc QuantumCircuit gives an empty list upon if_qc.qregs. Thats why I'm creating circuits with new register names.

Running into trouble when trying to append the data from the if_qc to the circuit with the named registers (new_if_qc).

@CalMacCQ CalMacCQ marked this pull request as draft December 17, 2024 14:55
) -> Circuit:
if_box, else_box = _pytket_boxes_from_IfElseOp(if_else_op, qregs, cregs)
circ_builder = CircuitBuilder(qregs, cregs)
circ = circ_builder.circuit()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print(circ.qubits, circ.bits)
print(if_box.get_circuit().qubits, if_box.get_circuit().bits)
print(qubits)
print(bits)

prints

[q105[0], q105[1]] [c3[0], c3[1]]
[q105[0], q105[1]] [c3[0], c3[1]]
[q105[1]]
[c3[0]]

So the box has 2 qubits and 2 bits, but in add_circbox, args=qubits + bits only provides 1 qubit and 1 bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants