Ensure aux_operator eigenvalues are normalized#1473
Ensure aux_operator eigenvalues are normalized#1473mrossinek wants to merge 2 commits intoqiskit-community:masterfrom
Conversation
As reported on multiple occasions (#1460 and qiskit-community#1467), the eigenvalues of the auxiliary operators are not correctly normalized when the QASM backend is used. This commit fixes this short-coming by applying the same normalization to the VQE's eigenstate when obtained from a QASM backend (in which case this is a dictionary) as done by the `CircuitSampler` in its `sample_circuits` function. The case of the statevector backend is unaffected by this change, as it will return the eigenstate as a list. Co-authored-by: Julien Gacon <gaconju@gmail.com>
This comment has been minimized.
This comment has been minimized.
ffcb71a to
e72216e
Compare
|
Hello, this fix sounds nice, but why didn't you add this processsing here? |
|
Hi @ikkoham! I am not sure to be honest.. but that does indeed look like a better place to fit this. I will update the PR now. |
|
We actually thought of putting it there in the first place -- but the reason we didn't is to not change the current behavior that |
Ah I didn't remember correctly then.. well I agree though that this makes more sense even though it changes the current behavior. The reason being that I think it improves the current behavior.. |
|
I'm good with changing this at the higher level. We'll have to wait for the merge of the algos to Terra though and then do the change there. |
|
I feel there ought to be a unit test around this - maybe augment one of those that exist. Just wondering was this specific to VQE-Adapt. I do not recall any issue with VQE in the past. |
|
Yes a unittest should be added. I will look into that once we re-open this PR when everything is merged into Terra.
I also never noticed this before but I am not sure when this broke. I tried bisecting it but I didn't have enough time to go through with this because I would have to adapt the test script a lot because of the many refactorings we did lately (i.e. the test script to check whether it breaks needs to be changed). |
|
I migrated this PR over to Terra and also added a unittest while I was at it. |
Summary
As reported on multiple occasions by @MariaSapova (#1460 and #1467), the eigenvalues of
the auxiliary operators are not correctly normalized when the QASM
backend is used.
This commit fixes this short-coming by applying the same normalization
to the VQE's eigenstate when obtained from a QASM backend (in which case
this is a dictionary) as done by the
CircuitSamplerin itssample_circuitsfunction.The case of the statevector backend is unaffected by this change, as it
will return the eigenstate as a list.