Skip to content
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

Fix sign errors in qml.DoubleExcitation documentation. #2072

Merged
merged 3 commits into from
Jan 7, 2022

Conversation

glassnotes
Copy link
Contributor

Context: There is an error in the signs of the basis state transforms in the DoubleExcitation documentation; it does not match the actual transformation that is being performed.

Description of the Change: Fixes the signs in relevant places in the docs.

The existing example given is:

dev = qml.device('default.qubit', wires=4)

@qml.qnode(dev)
def circuit(phi):
    qml.PauliX(wires=0)
    qml.PauliX(wires=1)
    qml.DoubleExcitation(phi, wires=[0, 1, 2, 3])
    return qml.state()

>>> circuit(0.1)
tensor([ 0.        +0.j,  0.        +0.j,  0.        +0.j,
        -0.04997917+0.j,  0.        +0.j,  0.        +0.j,
         0.        +0.j,  0.        +0.j,  0.        +0.j,
         0.        +0.j,  0.        +0.j,  0.        +0.j,
         0.99875026+0.j,  0.        +0.j,  0.        +0.j,
         0.        +0.j], requires_grad=True)

If you run this, it produces the state -sin(phi/2)|0011> + cos(phi/2) |1100>, whereas the original documentation displayed both signs as a +.

Benefits: ^ the above 🎉

Possible Drawbacks: None

Related GitHub Issues: None

@glassnotes glassnotes added the documentation 📘 Documentation changes and updates label Jan 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2022

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
Contributor

@ixfoduap ixfoduap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@codecov
Copy link

codecov bot commented Jan 7, 2022

Codecov Report

Merging #2072 (9b28196) into master (8999d50) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2072   +/-   ##
=======================================
  Coverage   99.18%   99.18%           
=======================================
  Files         226      226           
  Lines       17369    17369           
=======================================
  Hits        17228    17228           
  Misses        141      141           
Impacted Files Coverage Δ
pennylane/ops/qubit/qchem_ops.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8999d50...9b28196. Read the comment docs.

@glassnotes glassnotes merged commit 208095a into master Jan 7, 2022
@glassnotes glassnotes deleted the fix_double_exc_docs branch January 7, 2022 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 📘 Documentation changes and updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants