Quantum Computing Asked by Anand Prabhu on May 20, 2021
I am trying to use the quantum phase estimation(EigsQPE) of qiskit to find the eigen values of a matrix.
As I am new to quantum computing so I am confused what to measure in the circuit to derive the eigen values of the input matrix.
I know how to identify phase and derive eigen value using phase derived from the most probable bit string for a single eigen value. But deriving multiple eigen values from QPE circuit is confusing. Any help will be much appreciated.
Code : https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb
Two things to note:
EigsQPE needs the eigenvalues to be scaled onto the range (0,1]. You can use evo_time
to set the scaling. If you don't pass this value, a scaling value will be set automatically. You can get this value using eigs.get_scaling()
.
If the eigenvalue is $e^{2pi itheta}$, then the register contents will be $2^ntheta$
That means if the register contains the value $x$, and evo_time
equals $s$, then your eigenvalue will be $2pi x/(2^ns)$
Correct answer by Egretta.Thula on May 20, 2021
Thanks a lot with your two points I was able to proceed further.
https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb
I was able to find the eigen values of the two matrices with greater precision- A=[[1,-1/3],[-1/3,1]] Expected Eigen Values: [1.33333333 0.66666667] Counts: {'11111111': 0.499999999999994, '11111110': 0.499999999999994} Actual Eigen Value from Circuit: 1.3333333333333333 0.6614173228346456
A=[[1,-1/2],[-1/2,1]] Expected Eigen Values: [1.5 0.5] Counts: {'111': 0.500000000000001, '110': 0.500000000000001} Actual Eigen Value from Circuit: 1.5 0.5
However, when I try other matrix: A = [[1.5, 0.5], [0.5, 1.5]] Expected Eigen Values: [2. 1.] Counts: {'011': 0.213388347648319, '010': 0.213388347648319} Actual Eigen Value from Circuit: 2.0 0.6666666666666666
I do see there is so much difference in second eigen value. If I use the same matrix in HHL to solve linear equation and match results with paper(https://www.sciencedirect.com/science/article/pii/S037596012030462X?via%3Dihub) it works absolutely fine. https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-HHL.ipynb
I doubt now I am doing something wrong in reading out eigen values from QPE. Any suggestions on that part. I am just trying to read out all the eigen values of any matrix using qiskit EigsQPE.
Answered by Anand Prabhu on May 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP