1
$\begingroup$

I'm trying to implement the HHL algorithm in qiskit, but right now I'm stuck on the quantum phase estimation routine, the main problem being not knowing how to implement the unitary operator $U$. Right now I'm following the tutorial by qiskit here. If I follow the tutorial step by step I get the desired result, but I'd like to implement for any unitary operator I want.

To do this I'm using qiskit's squ to decompose any $2\times2$ unitary matrix in a series of three rotations. Once I have the decomposition I can use the controlled versions of said gates to be used in the QPE circuit.

This showed some promising results since the decomposition used in the tutorial and the one I had were the same for the same unitary $T$, but I can't get it to work of any arbitrary unitary.

For example the matrix $A = \frac 1 2 \cdot \begin{bmatrix} 3 & 1 \\ 1 & 3 \end{bmatrix}$ has eigenvalues $\lambda_1=2, \lambda_2=1$, and is Hermitian, so I should be able to get a unitary operator by calculating $U = e^{iA}$, which I can decompose and use in the QPE.

The problem is that doesn't work, since I don't get the eigenvalues as a result with $100\%$ certainty, or any other result with certainty, even if I'm using enough qubits.

I don't know if I'm not initializing $\psi$ correctly, but with one qubit and eigenvector $ \begin{bmatrix} 1\\ 1 \end{bmatrix} $ I should be able to do it with just an $H$ gate. The other thing that I'm thinking about is that maybe creating a controlled gate from 3 gates is not as easy as just using the controlled version of each of those gates, since it worked when the decomposition consisted of only one gate, but at this point I'm only speculating.

In short I'm not sure how to implement the unitary needed for the quantum phase estimation. I've read most of the questions here but I still can't wrap my head around it.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.