Repository navigation
Conversation
|
👋 Hey, looks like you've updated some demos! 🐘 Don't forget to update the Please hide this comment once the field(s) are updated. Thanks! |
drdren
left a comment
There was a problem hiding this comment.
Try to fix pip install
drdren
left a comment
There was a problem hiding this comment.
Remove pip install
drdren
left a comment
There was a problem hiding this comment.
Add pip install pyqsp
| def MultiControlledZ(wires, control_values=None): | ||
| if control_values is None: | ||
| control_values = [0] * (len(wires) - 1) | ||
| qml.ctrl(qml.Z(wires=wires[-1]), | ||
| control=wires[:-1], | ||
| control_values=control_values) | ||
|
|
||
| # R_gate implements the reflection R used in the block construction. | ||
| def R(wires): | ||
| assert len(wires) % 2 == 1 | ||
| n = len(wires)//2 | ||
| qml.PauliX(wires=wires[0]) | ||
| MultiControlledZ(wires=wires[1:n+1]+[wires[0]]) | ||
| qml.PauliX(wires=wires[0]) |
There was a problem hiding this comment.
Take a look to qml.Reflection(wires)
That should replace all this code 😄
| def ProjCtrlPhaseShift(control_wires, target_wire, phi): | ||
| qml.MultiControlledX(wires=control_wires + target_wire, | ||
| control_values=[0] * len(control_wires)) | ||
| qml.RZ(phi = 2 * phi, wires=target_wire) | ||
| qml.MultiControlledX(wires=control_wires + target_wire, | ||
| control_values=[0] * len(control_wires)) |
There was a problem hiding this comment.
I don't think they are equivalent. I tested it numerically and they both apply different phase patterns.
drdren
left a comment
There was a problem hiding this comment.
Remove pip install pyqsp
Your preview is ready 🎉!You can view your changes here
|
drdren
left a comment
There was a problem hiding this comment.
Fix figure formatting
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
| control_values=[0])(wires=wires[:n], *args, **kwargs) | ||
|
|
||
| # Adjoint of U on the data register controlled on ancilla B=0. | ||
| def Uc_adj(base, wires, *args, **kwargs): |
There was a problem hiding this comment.
Just leaving an on-the-fly comment: Is it necessary to manually define the adjoint of all the operators? We have qp.adjoint for this
| # | ||
|
|
||
| qp.draw_mpl(be_circuit)(feature_vector, main_wires, ancilla_wires) | ||
|
|

Before submitting
Please complete the following checklist when submitting a PR:
Ensure that your tutorial executes correctly, and conforms to the
guidelines specified in the README.
Remember to do a grammar check of the content you include.
All tutorials conform to
PEP8 standards.
To auto format files, simply
pip install black, and thenrun
black -l 100 path/to/file.py.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Title:
Summary:
Relevant references:
Possible Drawbacks:
Related GitHub Issues:
If you are writing a demonstration, please answer these questions to facilitate the marketing process.
GOALS — Why are we working on this now?
Eg. Promote a new PL feature or show a PL implementation of a recent paper.
AUDIENCE — Who is this for?
Eg. Chemistry researchers, PL educators, beginners in quantum computing.
KEYWORDS — What words should be included in the marketing post?
Which of the following types of documentation is most similar to your file?
(more details here)