-
Notifications
You must be signed in to change notification settings - Fork 715
Adding qml.MultiplexerStatePreparation
#8581
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
base: master
Are you sure you want to change the base?
Conversation
|
Hello. You may have forgotten to update the changelog!
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8581 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 588 589 +1
Lines 62727 62783 +56
=======================================
+ Hits 62373 62429 +56
Misses 354 354 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
obliviateandsurrender
left a comment
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.
Thanks @KetpuntoG! Good work, leaving the first set of comments.
pennylane/templates/state_preparations/multiplexer_state_prep.py
Outdated
Show resolved
Hide resolved
| f"State vectors must be of length {2 ** len(wires)}; vector has length {n_amplitudes}." | ||
| ) | ||
|
|
||
| norm = qml.math.linalg.norm(state_vector) |
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.
Should we always do the norm computation?
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.
What do you mean here? Maybe adding an attribute "check"?
(I based this in QROMStatePreparation)
| @staticmethod | ||
| def compute_decomposition(state_vector, wires): # pylint: disable=arguments-differ | ||
| with qml.queuing.AnnotatedQueue() as q: | ||
| _multiplexer_state_prep_decomposition(state_vector, wires) |
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.
Won't this also be queuing under the queuing context? 🤔
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.
I checked with Astral and he linked to this example:
| def compute_decomposition( |
pennylane/templates/state_preparations/multiplexer_state_prep.py
Outdated
Show resolved
Hide resolved
pennylane/templates/state_preparations/multiplexer_state_prep.py
Outdated
Show resolved
Hide resolved
pennylane/templates/state_preparations/multiplexer_state_prep.py
Outdated
Show resolved
Hide resolved
pennylane/templates/state_preparations/multiplexer_state_prep.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Utkarsh <[email protected]>
Co-authored-by: Utkarsh <[email protected]>
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
test directory!
All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs.Ensure that the test suite passes, by running
make test.Add a new entry to the
doc/releases/changelog-dev.mdfile, summarizing thechange, and including a link back to the PR.
The PennyLane source code conforms to
PEP8 standards.
We check all of our code against Pylint.
To lint modified files, simply
pip install pylint, and thenrun
pylint pennylane/path/to/file.py.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
A new template
MultiplexerStatePreparationhas been added. This template allows prepare arbitrary statesusing
SelectPauliRotoperations.[sc-100288]