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
CosineWindow expands over all circuit wires #5080
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5080 +/- ##
==========================================
- Coverage 99.68% 99.68% -0.01%
==========================================
Files 394 394
Lines 35733 35466 -267
==========================================
- Hits 35622 35354 -268
- Misses 111 112 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
**Context:** When StatePrepBase operations are used at the start of a circuit on a subset of all circuit wires, we want to initialize the system state with all other wires set to the zero-state. `CosineWindow` did not implement this edge-case, and only returned a state spanning the subspace of the wires it acts on regardless of wire order given (it only used `wire_order` for transposition, not expansion) **Description of the Change:** Update `CosineWindow.state_vector` to expand over unused wires present in the provided `wire_order` Master: ```pycon >>> qml.CosineWindow(wires=[0, 1]).state_vector(wire_order=[0, 1, 2]).shape (2, 2) ``` Branch: ```pycon >>> qml.CosineWindow(wires=[0, 1]).state_vector(wire_order=[0, 1, 2]).shape (2, 2, 2) ``` **Benefits:** No more unexpected errors when `CosineWindow` is used as a state-prep operation on a subset of wires with DefaultQubit **Possible Drawbacks:** N/A [sc-54223]
Context:
When StatePrepBase operations are used at the start of a circuit on a subset of all circuit wires, we want to initialize the system state with all other wires set to the zero-state.
CosineWindow
did not implement this edge-case, and only returned a state spanning the subspace of the wires it acts on regardless of wire order given (it only usedwire_order
for transposition, not expansion)Description of the Change:
Update
CosineWindow.state_vector
to expand over unused wires present in the providedwire_order
Master:
Branch:
Benefits:
No more unexpected errors when
CosineWindow
is used as a state-prep operation on a subset of wires with DefaultQubitPossible Drawbacks:
N/A
[sc-54223]