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

Bug fix in vqe expectation #204

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Bug fix in vqe expectation #204

wants to merge 4 commits into from

Conversation

kajoel
Copy link

@kajoel kajoel commented Mar 26, 2019

We found a bug while using vqe with samples=None. The current version uses the expectation method of WavefunctionSimulator from pyquil.api to calculate the expectation values of every term (including coefficients) in the PauliSum and then weights these with the coefficients of the terms. Thus, the coefficients are, effectively, squared, which results in an incorrect expectation value of the PauliSum. The proposed solution is to let the expectation method of WavefunctionSimulator handle everything since it supports PauliSums.

Moreover, we found that vqe expectation made some unnecessary computations on the QC, probably due to an accidental indentation (see last commit).

Joel Karlsson added 4 commits March 24, 2019 14:53
Fixes the bug of squared coefficients when using vqe with samples=None.
The expectation method of WavefunctionSimulator can handle a PauliSum and takes care of both coefficients and summing.
Skip some unnecessary computations on the qc.
@mstechly
Copy link
Contributor

mstechly commented May 14, 2019

@kajoel Thanks for this!

@amyfbrown Can someone take a look into it and merge it, please?
I think it's pretty critical one - if anyone is using VQE (or QAOA), they probably run a simulation with no sampling at first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants