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

feat: handle IfElseOp in qiskit_to_tk #437

Merged
merged 50 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c424b24
initial attempt at CircBox handling
CalMacCQ Dec 17, 2024
3b9189a
add temporary if-else test
CalMacCQ Dec 17, 2024
692506f
try adding data for conditional subcircuits
CalMacCQ Dec 17, 2024
9be4d45
add a proper test
CalMacCQ Dec 17, 2024
80dddbe
cleanup
CalMacCQ Dec 17, 2024
e38ca3e
add another TODO
CalMacCQ Dec 17, 2024
3843234
formatting
CalMacCQ Dec 17, 2024
69f9e0a
Merge branch 'main' into support_if-else
CalMacCQ Dec 17, 2024
09a0ca2
try if else with register from qiskit circuit
cqc-melf Dec 17, 2024
89ac299
Merge branch 'main' into support_if-else
CalMacCQ Dec 17, 2024
96d9efd
minor cleanup
CalMacCQ Dec 17, 2024
6518628
more progress on circuit building (still gives RuntimeError)
CalMacCQ Dec 18, 2024
f87d814
try to fix kwargs
CalMacCQ Dec 18, 2024
816e2bd
update test
CalMacCQ Dec 18, 2024
2ff1b6f
remove import
CalMacCQ Dec 18, 2024
ea62c0b
push latest attempt
CalMacCQ Dec 18, 2024
73dc681
naming fixes
CalMacCQ Dec 31, 2024
d65a347
a little more progress
CalMacCQ Dec 31, 2024
3281184
Merge branch 'main' into support_if-else
CalMacCQ Dec 31, 2024
52458ab
refactor: handle IfElseOp separately
CalMacCQ Dec 31, 2024
8e1edce
make circuit builder function private
CalMacCQ Dec 31, 2024
4b382b0
add a test case for a single branch
CalMacCQ Jan 2, 2025
4729114
handle the single branch case
CalMacCQ Jan 2, 2025
f69aa04
improve validation for single branch case
CalMacCQ Jan 2, 2025
8573082
fix import
CalMacCQ Jan 2, 2025
4d311f3
add some comments
CalMacCQ Jan 2, 2025
eec8fe5
add comments to test, change variable name
CalMacCQ Jan 2, 2025
9d66595
attempt to debug C.I. test case issue
CalMacCQ Jan 2, 2025
4b4b40a
remove debug prints
CalMacCQ Jan 2, 2025
7950e77
correct some comments
CalMacCQ Jan 2, 2025
25bfcd5
update changelog
CalMacCQ Jan 2, 2025
ae6cbfe
Better varible names for testing
CalMacCQ Jan 2, 2025
e479c3e
link to issue
CalMacCQ Jan 2, 2025
4c6453a
Merge branch 'main' into support_if-else
CalMacCQ Jan 15, 2025
5fab61f
Merge branch 'main' into support_if-else
CalMacCQ Jan 16, 2025
83b50e7
extend test
CalMacCQ Jan 16, 2025
84e7fc1
expand test (annoying failure)
CalMacCQ Jan 16, 2025
dd4a694
fix test inconsistency
CalMacCQ Jan 16, 2025
ba3671d
add a gate counting test instead (passing)
CalMacCQ Jan 16, 2025
aadfe5e
raise error for register conditions
CalMacCQ Jan 16, 2025
72554e8
add a test
CalMacCQ Jan 16, 2025
cebf4dd
clean up If-Else circuit building, error handling
CalMacCQ Jan 22, 2025
16c3718
fix a pylint issue
CalMacCQ Jan 22, 2025
cf2f717
Merge branch 'main' into support_if-else
CalMacCQ Jan 22, 2025
ce035c0
minor fixes
CalMacCQ Jan 22, 2025
1cbf960
fix mypy issue
CalMacCQ Jan 22, 2025
dd5ce89
fix a typo
CalMacCQ Jan 22, 2025
a40732d
add a validation test for two branch circuit
CalMacCQ Jan 22, 2025
7bc58d5
fix import
CalMacCQ Jan 22, 2025
90c68e7
explain limitations in changelog
CalMacCQ Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve validation for single branch case
CalMacCQ committed Jan 2, 2025
commit f69aa0424e2336267d00aafb0ce1110e9c88c39d
20 changes: 19 additions & 1 deletion tests/qiskit_convert_test.py
Original file line number Diff line number Diff line change
@@ -1230,7 +1230,25 @@ def test_ifelseop_one_branch() -> None:
circuit.measure(q0, c0)

tket_circ = qiskit_to_tk(circuit)
draw(tket_circ)
tket_circ.name = "test_circ"

expected_circ = Circuit()
expected_circ.name = "test_circ"
q1 = expected_circ.add_q_register("q1", 1)
c0_tk = expected_circ.add_c_register("c0", 1)
expected_circ.H(q1[0])
expected_circ.Measure(q1[0], c0_tk[0])
x_circ = Circuit()
x_circ.name = "If"
xq1 = x_circ.add_q_register("q1", 1)
x_circ.X(xq1[0])
expected_circ.add_circbox(
CircBox(x_circ), [q1[0]], condition_bits=[c0_tk[0]], condition_value=1
)

expected_circ.Measure(q1[0], c0_tk[0])

assert tket_circ == expected_circ


def test_range_preds_with_conditionals() -> None: