The goal of HHL is solve the linear equation
Ax=b
where
matrix A and a vector b are given
find x satisfying this linear equation
we can convert the equation into
x=A−1b
1.1.1. example
the linear equation
Ax(1−31−311)(x0x1)=b=(01)
find x=(8389) satisfying this linear equation
Ax(1−31−311)(8389)=b=(01)
1.2. Mathematical Preliminaries
Matrix A should be Hermitian. If not, the A can be converted to Hermitian by
(0A†A0)
Since matrix A is Hermitian, it has a spectral decomposition
A=j=0∑N−1λj∣uj⟩⟨uj∣
where
λj is j-th eigenvalue of matrix A
∣uj⟩ is j-th eigenvector of matrix A
the inverse of A can be written as
A−1=j=0∑N−1λj−1∣uj⟩⟨uj∣
Since A is invertible and Hermitian, it must have an orthogonal basis of eigenvectors, and thus we can write b in the eigenbasis of A as
∣b⟩=j=0∑N−1bj∣uj⟩,bj∈C
The eigenbase of A must be orthogonal eigenvectors ⟨ui∣uj⟩=δij since A is invertible and Hermitian, so we can write b in the eigenbasis of A as
∣b⟩=j=0∑N−1bj∣uj⟩
The solution of the linear equation also can be written in the eigenbasis
∣x⟩=A−1∣b⟩=j=0∑N−1λj−1bj∣uj⟩
1.3. Steps of the HHL algorithm
Overview of the HHL algorithm flow
Initialize the vector b to be quantum state ∣b⟩
Estimate the eigenvalues of matrix A
Apply Quantum Phase Estimation (QPE) to get the value of
Ancilla bit Rotation:
-
Inverse Quantum Phase Estimation (IQPE)
Measurement
Measure the auxiliary qubit in the computational basis.
1.3.1. State Preparation
There are total nb+n+1 qubits and they are initialized as
∣Ψ0⟩=∣0⋯0⟩b∣0⋯0⟩c∣0⟩a=∣0⟩⊗nb∣0⟩⊗n∣0⟩
where
nb qubits state ∣0⋯0⟩b in the b-register
n qubits (clock qubits) state ∣0⋯0⟩c in the c-register
state ∣0⟩a of ancilla qubit
where registers of quantum circuit are
b-register
rotated to have the amplitudes correspond to the coefficients of b. That is
c-register (clock qubits)
related to the time (clock) in the controlled rotation in the QPE
c-register stores the values of the phase of the eigenvalues of the A matrix after the QPE.
There are n qubits (clock qubits) in the c-register.
ancilla qubit
∣0⋯0⟩b in the b-register needs to be rotated to have the amplitudes correspond to the coefficients of b. That is
b⇕∣b⟩=⎝⎜⎜⎛β0β1⋮βNb−1⎠⎟⎟⎞=β0∣0⟩+β1∣1⟩+⋯+βNb−1∣Nb−1⟩
After state preparation
∣Ψ1⟩=∣b⟩b∣0⋯0⟩c∣0⟩a
1.3.2. Quantum Phase Estimation
Quantum Phase Estimation (QPE) has three components
the superposition of the clock qubits through Hadamard gates,
controlled rotation
Inverse Quantum Fourier Transform (IQFT). The goal of QPE is to estimate the phase of the eigenvalues of the unitary rotation matrix, U=eiAt, in the controlled gate, C−U, (Fig. 1) used in the QPE. Again, this gate encodes the matrix A
Hadamard gates
Apply the Hadamard gates to the clock qubits to create a superposition of the clock qubits
∣Ψ2⟩=I⊗nb⊗H⊗n⊗I∣Ψ1⟩=∣b⟩22n1(∣0⟩+∣1⟩)⊗n∣0⟩
controlled rotation
applying A to its eigenvector ∣uj⟩,
A∣uj⟩=i=0∑2nb−1λi∣ui⟩⟨ui∣∣uj⟩=i=0∑2nb−1λi∣ui⟩δij=λj∣uj⟩
1.3.3. Rotation
1.4. Example: 4-qubit
Reference: Learn Quantum Computation using Qiskit. online book