grove icon indicating copy to clipboard operation
grove copied to clipboard

Bug fix in vqe expectation

Open kajoel opened this issue 5 years ago • 1 comments

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).

kajoel avatar Mar 26 '19 19:03 kajoel

@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.

mstechly avatar May 14 '19 08:05 mstechly