Add lightcone filter transformer#8107
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8107 +/- ##
=======================================
Coverage 99.59% 99.60%
=======================================
Files 1116 1118 +2
Lines 100923 100951 +28
=======================================
+ Hits 100519 100550 +31
+ Misses 404 401 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Pavol Juhas <juhas@google.com>
|
|
||
|
|
||
| @transformer_api.transformer() | ||
| def lightcone_filter( |
There was a problem hiding this comment.
Nit - I think we could use transformer_primitives.map_operations here and get this handling FrozenCircuit-s for free.
Do you want me to take a stab at that?
There was a problem hiding this comment.
Feel free to suggest this in #8109! Thanks!
| circuit += circuits.Circuit(ops.M(qubits[:10])) | ||
| assert [len(moment) for moment in circuit] == [25, 10, 25, 10, 25, 10, 25, 10, 25, 10, 25, 1] | ||
| new_circuit = ct.lightcone_filter(circuit) | ||
| assert [len(moment) for moment in new_circuit] == [18, 8, 13, 5, 10, 4, 10, 4, 10, 4, 10, 1] |
There was a problem hiding this comment.
This is hard to make sense of without knowing the exact seed-dependent random circuit.
Can you perhaps add checks that dropped operations missing in new_circuit are all acting on other qubits than the measured ones and also validating that new_circuit operations are a subset of the original ones?
Also it would be nice to add a mid-circuit measurement of few extra qubits and verify its lightcone would show up only in preceding moments.
There was a problem hiding this comment.
I modified the test to capture most of your suggestions here. Feel free to modify the test further. Thanks!
|
@eliottrosenberg - can you PTAL at comments I got in after the merge? |
|
@pavoljuhas done in #8109. Thanks! |
No description provided.