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! |
Your preview is ready 🎉!You can view your changes here
|
| @@ -134,15 +128,7 @@ def penn_iqp_gates(params: np.ndarray, gates: list, n_qubits: int): | |||
| n_qubits (int): The total number of qubits in the circuit. | |||
| """ | |||
|
|
|||
| for i in range(n_qubits): | |||
| qml.Hadamard(i) | |||
|
|
|||
| for par, gate in zip(params, gates): | |||
| for gen in gate: | |||
| qml.MultiRZ(2*par, wires=gen) | |||
|
|
|||
| for i in range(n_qubits): | |||
| qml.Hadamard(i) | |||
| qml.IQP(weights=params, num_wires=n_qubits, pattern=gates) | |||
There was a problem hiding this comment.
@josh I'd appreciate your opinion on the comments I'll be leaving through this file :)
I think this block of code where penn_iqp_gates is defined could be removed now that the qml.IQP template is available. And then in the function penn_iqp_circuit that is defined bellow qml.IQP could be used directly.
demonstrations_v2/tutorial_iqp_circuit_optimization_jax/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/tutorial_iqp_circuit_optimization_jax/demo.py
Outdated
Show resolved
Hide resolved
| # where :math:`s` is the number of samples. | ||
| # | ||
| # Let's see now how to use the IQPopt package to calculate expectation values, based on the same | ||
| # Let's see now how to use the :func:`~pennylane.qnn.iqp_expval` function in PennyLane to calculate expectation values, based on the same |
There was a problem hiding this comment.
I think it would be useful to mention that this is implemented in IQPopt as .op_expval as well
There was a problem hiding this comment.
I've added a comment about this as part of this same sentence here 2b7e104, but I'm happy to edit further (e.g. make it a separate note with sphinx's note directive)
Co-authored-by: josephbowles <54283511+josephbowles@users.noreply.github.com>
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: Updating the IQPopt demo after the template and estimator function were added to PennyLane in the v0.44.0 release.
Summary:
Related GitHub Issues: