2
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ Hi and welcome to the community! I didn't work with QPE a lot but I am still quite confused about some of the stuff you did on your code: first, you don't use a unitary matrix, I thought the matrix had to be unitary to get the QPE to work, and second you never use the eigenstates on your circuit, but the controlled-evolution are controlled by it, could you elaborate a little bit more on what you did about that? $\endgroup$ – Lena Mar 24 at 16:52
  • $\begingroup$ Hi Lena, Thank you. Its not a unitary matrix I am using a matrix which was mentioned in the qiskit HHL example qiskit.org/textbook/ch-applications/hhl_tutorial.html I have not build any circuit I was just calling QPE of qiskit and I had query on how to measure eigen values from this circuit. $\endgroup$ – Anand Prabhu Mar 25 at 16:50
1
$\begingroup$

Two things to note:

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

  2. If the eigenvalue is $e^{2\pi i\theta}$, then the register contents will be $2^n\theta$

That means if the register contains the value $x$, and evo_time equals $s$, then your eigenvalue will be $2\pi x/(2^ns)$

$\endgroup$
1
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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