TransWikia.com

In the HHL alghoritm, how can I transform my hermitian matrix into a unitary operator?

Quantum Computing Asked on July 15, 2021

I’m studying the HHL algorithm and I’m trying to do an his implementation but, there are some points that I don’t understand how I can transform my hermitian Matrix into its unitary operator?

In Qiskit textbook I found this explanation about HHL algorithm.
It says that after load the input data, we have to do QPE, but for QPE I need to transform my matrix A into $e^{iAt}$, how can I do that? The textbook doesn’t explain.

Re-edit:I start with the first question and I use an example.
I know that every hermitian matrix could be written as $e^{-iAt}$, using Pauli Gates.
If I have the following matrix $ A=begin{bmatrix} 1&-frac{1}{3} -frac{1}{3}&1 end{bmatrix}$, I can write it as $A=-frac{1}{3}X+mathbb{1} $, so the exponential matrix is $e^{-iAt}=e^{-i(-frac{1}{3}X+mathbb{1})t}=e^{-i(-frac{1}{3}X)t}e^{-i(mathbb{1})t}$, I can write the last equality because the two operator commute. I want to write this in terms of gates, following the instruciton of previous posts I can write the term $e^{-i(mathbb{1})t}$ as U1(-t) on control qubit. For $e^{-i(-frac{1}{3}X)t}$, I know that $e^{-i(X)t}$ is equal to $HR_z(2t)H$,so, in my case, I can write $e^{-i(-frac{1}{3}X)t}=HR_z(-2frac{t}{3})H$

I tried to implement in qiskit the circuit, I find 100% of probability to have |11>, but I expect to have 100% of probability to have |10>, what am I doing wrong?

This is my code

t=2*np.pi*3/8
qpe = QuantumCircuit(3, 2)
qpe.h(2) #inizializzo il vettore (1,1) con H gate
for qubit in range(2):
    qpe.h(qubit)     #applico H gate ai control bit
repetitions = 1
for counting_qubit in range(2):
    for i in range(repetitions):
        qpe.p(-t,counting_qubit)
        qpe.h(2)
        qpe.crz(-2/3*t,counting_qubit,2)
        qpe.h(2)
        repetitions *= 2
qpe.barrier();
qpe.draw()

def qft_dagger(qc, n):
    """n-qubit QFTdagger the first n qubits in circ"""
    # Don't forget the Swaps!
    for qubit in range(n//2):
        qc.swap(qubit, n-qubit-1)
    for j in range(n):
        for m in range(j):
            qc.cp(-math.pi/float(2**(j-m)), m, j)
        qc.h(j)

# Apply inverse QFT
qft_dagger(qpe, 2)
#Measure
qpe.barrier()
for n in range(2):
    qpe.measure(n,n)
qpe.draw()

My circuit
enter image description here

My result on simulator

enter image description here

Re-edit: I noticed that if I remove the minus sign to the gates, the result is correct, but I don’t understand why

One Answer

i did the hamiltonian simulation with minus sign, but in QPE, I don't have to consider it

Correct answer by Simona99 on July 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP