-
Notifications
You must be signed in to change notification settings - Fork 643
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
[WIP] Adding `qml.OutPoly' #6320
Conversation
Hello. You may have forgotten to update the changelog!
|
[sc-72629] |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6320 +/- ##
==========================================
- Coverage 99.38% 99.38% -0.01%
==========================================
Files 450 452 +2
Lines 42619 42771 +152
==========================================
+ Hits 42359 42509 +150
- Misses 260 262 +2 ☔ 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.
Here are some initial comments. I will look over the Mobius transformation in my next review.
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.
Leaving some initial comments, will take a closer look at the decomposition next.
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, overall 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.
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.
Thanks @KetpuntoG, some more suggestion regarding docs; after which it should be 🚀
[skip ci] Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
…into qml_outpoly
To do: - [x] Final review - [x] Add thumbnail - [x] Add changeling In this PR we add `qml.OutPoly`. An operator that allows to apply arbitrary polynomials on quantum registers. Example where we want to create the operator: $$U|x\rangle |y\rangle |0\rangle = |x\rangle |y\rangle |x^2 + y\rangle$$ ```python import pennylane as qml x_wires = [0, 1, 2] y_wires = [3, 4, 5] output_wires = [6, 7, 8] def f(x, y): return x ** 2 + y @qml.qnode(qml.device("default.qubit", shots = 1)) def circuit(): # loading values for x and y qml.BasisEmbedding(2, wires=x_wires) qml.BasisEmbedding(2 , wires=y_wires) # applying the polynomial qml.OutPoly(f, input_registers = [x_wires, y_wires], output_wires=output_wires) return qml.sample(wires=output_wires) print(circuit()) ``` **Context:** This operator is born of the quantum arithmetic project **Benefits:** complete flexibility for the user to create new arithmetic operators [[sc-72629](https://app.shortcut.com/xanaduai/story/72629/support-polynomial-arithmetic)] --------- Co-authored-by: Utkarsh <utkarshazad98@gmail.com> Co-authored-by: Will <wmaxwell90@gmail.com> Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
To do:
In this PR we add
qml.OutPoly
. An operator that allows to apply arbitrary polynomials on quantum registers.Example where we want to create the operator:
$$U|x\rangle |y\rangle |0\rangle = |x\rangle |y\rangle |x^2 + y\rangle$$
Context:
This operator is born of the quantum arithmetic project
Benefits:
complete flexibility for the user to create new arithmetic operators
[sc-72629]