5

In Quantum Algorithm Implementations for Beginners is an example of the Quantum PCA with an given 2 x 2 covariance matrix $\sum$.
The steps for state preparation are given in the paper. The steps are:

  • calculate covariance matrix $\sum$ from the data

  • compute density matrix $\rho = \frac{1}{Tr(\sum)}*\sum$

  • calculate two-qubit pure quantum state $| \psi \rangle$
  • calculate the unitary operator $U_{prep}$

I wanna comprehend the example from the paper. So far I got the density matrix $\rho$. I would be glad if someone could explain me how to calculate the quantum state $| \psi \rangle$ and futhermore $U_{prep}$.

glS
  • 27,510
  • 7
  • 37
  • 125
rexrayne
  • 65
  • 4

1 Answers1

2

In an article Towards Pricing Financial Derivatives with an IBM Quantum Computer PCA is implemented in a practical way with an example.

Operator $U_{prep}$ is realized with $\mathrm{U3}$ gates but parameters for some gates presented in the article seems wrong (maybe typo). See this thread for more information, correct $\mathrm{U3}$ parameters values and a way how to implement PCA on IBM Q.


EDIT: How to find parameters $\theta$, $\phi$ and $\lambda$ for implementation of $U_{prep}$ with $\mathrm{U3}$ gate.

$\mathrm{U3}$ gate has this form:

$$ \mathrm{U3}= \begin{pmatrix} \cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ \mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) \end{pmatrix}. $$

Firstly, you have to factor out some complex number (denote $c$) from $U_{prep}$ in order to have a real number on position $u_{11}$. After that you can easily calculate $\theta$ from $\cos(\theta/2)$. Then, it is not problem to find $\phi$ from $\mathrm{e}^{i\phi}\sin(\theta/2)$ and finnaly $\lambda$ from $\mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2)$.

The number $c$ factored out in the first step is a global phase. It is not important in case $\mathrm{U3}$ is used in its single qubit form. But if the gate is used as controlled one, the global phase cannot be neglected. So, you will have controlled $\mathrm{U3}$ and controlled global phase gate.

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75