Closed Durd3nT closed 3 years ago
I obtain the same problem with AerPauliExpectation
, I presume this is coming from somewhere in the QFI implementation.
I calculated the QFI of one example by hand so we can better compare the problems. This is the circuit I used
┌──────────────┐┌──────────┐
q_0: ┤ RX(0.5*x[0]) ├┤ RY(x[1]) ├
└──────────────┘└──────────┘
and here are the results
By hand:
[[0.25 0. ]
[0. 0.77015115]]
Plain eval
[[2.50000000e-01+0.j 1.66500000e-16+0.j]
[1.66500000e-16+0.j 7.70151153e-01+0.j]]
Matrix expectation
[[2.50000000e-01+0.j 6.90000000e-17+0.j]
[6.90000000e-17+0.j 7.70151153e-01+0.j]]
Pauli expectation
[[ 1.00010014+0.j -0.05096054+0.j]
[-0.05096054+0.j 0.77565002+0.j]]
AerPauli expectation
[[4. +0.j 0. +0.j]
[0. +0.j 3.08060461+0.j]]
Note that the result with the PauliExpectation seems to disregard the coefficient 0.5 that we get from deriving RX(0.5 * theta)
. Similarly, AerPauliExpectation disregards that factor but on top has an additional factor of 4.
Information
What is the current behavior?
Evaluating the Quantum Fisher Information (QFI) of a parameterized circuit and subsequently converting it with
PauliExpectation
can yield a different and wrong QFI compared to evaluation withoutPauliExpectation
. Specifically, the below example leads to negative eigenvalues of the positive-semidefinite QFI. This was found together with @Zoufalc.Steps to reproduce the problem
What is the expected behavior?
PauliExpectation
should not change the QFI.Suggested solutions
This issue seems to occur when a parameter is multiplied with a number as in
rz(0.5*x[0], 0)
and the issue could not be reproduced without such multiplication.