0
$\begingroup$

There is an HHL example in IBM Qiskit

https://qiskit.org/textbook/ch-applications/hhl_tutorial.html

If I run on that website (click "Try") in Section 4 and set time=np.pi*3/4, I get 100% fidelity as expected. However, if I copy those code and run it on my server or in the IBM Q account, it is no longer 100%.

I also try with my other matrix which I expect to have an exact solution. Again, I get 100% fidelity if I modify the code in that website but I get only 80% if I run on my server. The matrix I am trying is [[1 -0.5],[-0.5, 1]] which has an exact solution if time=np.pi.

Do you know why? Are they calling different functions? How do I solve this problem?

I also want to learn how they calculate fidelity. Do you know where I can find the details of state_fidelity().

$\endgroup$
6
  • 2
    $\begingroup$ To understand more about how the state_fedility is calculated, look here: qiskit.org/documentation/stubs/… $\endgroup$ – KAJ226 Apr 19 at 4:52
  • $\begingroup$ Funny thing is if you open the tutorial through Quantum Lab and run the script, you don't have fidelity of 1 either.... $\endgroup$ – KAJ226 Apr 19 at 4:53
  • $\begingroup$ What is the version of qiskit on your server? $\endgroup$ – Adrien Suau Apr 19 at 20:13
  • $\begingroup$ This is what I have qiskit 0.25.0 qiskit-aer 0.8.0 qiskit-aer-gpu 0.7.6 qiskit-aqua 0.9.0 qiskit-ibmq-provider 0.12.2 qiskit-ignis 0.6.0 qiskit-terra 0.17.0 $\endgroup$ – HYW Apr 19 at 21:13
  • 4
    $\begingroup$ I’m voting to close this question because this seems to be a technical problem with Qiskit and should be an issue or bug report on GitHub: github.com/Qiskit/qiskit/issues $\endgroup$ – Cryoris Apr 20 at 20:24
0
$\begingroup$

Thanks for the comments. If I use python 3.7.3 (3.8 won't work) + qiskit 0.23.5, I can get fidelity = 1.

$\endgroup$
3
  • 1
    $\begingroup$ Please post this as a comment. $\endgroup$ – Martin Vesely Apr 20 at 7:41
  • 1
    $\begingroup$ This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review $\endgroup$ – Martin Vesely Apr 20 at 7:42
  • 2
    $\begingroup$ @MartinVesely I think that what HYW is saying (if a bit more indirectly than most answers) is that the 'why' is 'you're using the wrong version of python' and the solution/answer is 'use python 3.7.3 and qiskit 0.23.5' $\endgroup$ – Mithrandir24601 Apr 21 at 8:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.