8
$\begingroup$

According to An introduction to quantum machine learning (Schuld, Sinayskiy & Petruccione, 2014), Seth Lloyd et al. say in their paper: Quantum algorithms for supervised and unsupervised machine learning that classical information can be encoded into the norm of a quantum state $\langle x|x \rangle = |\vec{x}|^{-1}\vec{x}$. I'm not sure I understand their notation.

Let's take a simple example. Say I want to store this array: $V = \{3,2,1,2,3,3,5,4\}$ of size $2^{3}$ in the state of an $3$-qubit quantum system.

I can represent the state of an $3$-qubit system as:

$|\psi\rangle = a_1|000\rangle + a_2|001\rangle + a_3|010\rangle + a_4|011\rangle + a_5|100\rangle + a_6|101\rangle + a_7|110\rangle + a_8|111\rangle$ (using standard basis) where $a_i\in \Bbb C \ \forall \ 1 \leq i\leq 8$.

I could represent $V$ as a vector $\vec{V} = 3 \hat{x}_1 + 2 \hat{x}_2 +... + 4 \hat{x}_8$ where $\{\hat{x}_1,\hat{x}_2,...,\hat{x}_8\}$ forms an orthonormal basis in $\Bbb R^{8}$, and write the standard Euclidean norm for it as $|\vec{V}|=\sqrt{3^2+2^2+...+4^2}$.

After this, I'm confused as to how I'd get the coefficients $a_1,a_2,..,a_8$. Should I just assign $3$ to $a_1$, $2$ to $a_2$ and so on?

But, then again:

Consider the vector $N=2^{n}$ dimensional complex vector $\vec{v}$ with components $\{v_i=|v_i|e^{i\phi_i}\}$. Assume that $\{|v_i|,\phi_i\}$ are stored as floating point numbers in quantum random access memory. Constructing the $\log_2 N$ qubit quantum state $|v\rangle = |\vec{v}|^{-1/2}\vec{v}$ then takes $\mathcal{O}(\log_2 N)$ steps as long as the sub-norms are also given in the qRAM in which case any state can be constructed in $\mathcal{O}(\log N)$ steps.

Firstly, I don't understand their notion of a $2^n$ dimensional complex vector. If each of the components of their classical data array has two floating point numbers, wouldn't encoding that into a $n$-qubit quantum state be equivalent to storing a $2\times 2^{n}$ size classical array in a $n$-qubit system? Yes, I do know that $a_1,a_2,..,a_{2^n}$ are complex numbers having both magnitude and direction, and hence can store $2\times 2^{n}$ amount of classical information. But they don't mention anywhere how they will convert classical data (say in form of a $2\times 2^{n}$ array) into that form. Moreover, there seems to be a restriction that phase of a complex number $a_i$ can only range from $-\pi$ to $+\pi$.

Secondly, let us assume that the initial data array we wanted to store in our quantum system was actually $V=\{\{3,\phi_1\},\{2,\phi_2\},...,\{4,\phi_8\}\}$.

If they define $|v\rangle$ as $|\vec{v}|^{-1/2}\vec{v}$ then $|V\rangle$ in our example would look something like $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(|3e^{i\phi_1}||000\rangle + |2e^{i\phi_2}||001\rangle + ... + |4e^{i\phi_8}||111\rangle)$. But then we're losing all the information about the phases $\phi_i$, isn't it? So what was the use of starting with a complex vector (having both a phase and magnitude) in the first place, when we're losing that information when converting to $|V\rangle$ anyway? Or are we writing supposed to consider $|V\rangle$ as $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(3e^{i\phi_1}|000\rangle + 2e^{i\phi_2}|001\rangle + ... + 4e^{i\phi_8}|111\rangle)$?

It would be really helpful if someone could explain where I am going wrong using some concrete examples regarding storage of classical data in an $n$-qubit system.

$\endgroup$
  • $\begingroup$ The Schuld et al. paper was written quite early in the age of "quantum machine learning", and I have never had a deep enough interest in quantum machine machine learning (yet) to spend too much time learning it. So I won't try to to answer the question, but one thing I can contribute is to answer your confusion about the restriction for the complex phase to be between $-\pi$ and $\pi$. This range of $-\pi$ to $\pi$ is actually not a "restriction" because it covers all possible mathematical phases that can ever exist. $-\pi$ to $\pi$ means -180 to 180 degrees, which is a full circle. $\endgroup$ – user1271772 May 28 '18 at 0:55
  • $\begingroup$ Anything beyond the range of $-\pi$ to $\pi$ is like saying 370 degrees, which is a complete circle plus another 10 degrees. So 370 degrees is equivalent to 10 degrees, and likewise for anything outside the range of $-\pi$ to $\pi$. $\endgroup$ – user1271772 May 28 '18 at 0:56
2
$\begingroup$

I don't understand their notion of a $2^n$ dimensional complex vector. If each of the components of their classical data array has two floating point numbers, wouldn't encoding that into a $n$-qubit quantum state be equivalent to storing a $2\times 2^{n}$ size classical array in a $n$-qubit system?

You are absolutely correct that a $2\times 2^n$ classical array of nubers is stored in an n-qubit system.

But they are absolutely right that the vector's dimension is $2^n$. This is because the vector has $2^n$ rows, where each entry has 2 classical numbers.

You can also store the same vector in a $2\times 2^n$ array: $2^n$ rows are filled in with the real parts and $2^n$ rows by the imaginary parts, but this vector would not evolve according to the Schrödinger equation.

I hope this helps resolve this part of the question.

But they don't mention anywhere how they will convert classical data (say in form of a $2\times 2^{n}$ array) into that form.

You are right. Just as Peter Shor never mentioned anywhere how his qubits for factoring will be prepared.

This is up to the experimentalists, and it is implementation-dependent. This means that for NMR qubits you'd convert the classical data into qubits differently from superconducting qubits, or ion-trap qubits, or quantum dot qubits, etc. Therefore I do not blame Shor, or any of the 6 authors of the 2 papers you mentioned (who are all theorists by the way), for not explaining how the qubits will be prepared.

let us assume that the initial data array we wanted to store in our quantum system was actually $V=\{\{3,\phi_1\},\{2,\phi_2\},...,\{4,\phi_8\}\}$. If they define $|v\rangle$ as $|\vec{v}|^{-1/2}\vec{v}$ then $|V\rangle$ in our example would look something like $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(|3e^{i\phi_1}||000\rangle + |2e^{i\phi_2}||001\rangle + ... + |4e^{i\phi_8}||111\rangle)$. But then we're losing all the information about the phases $\phi_i$, isn't it? So what was the use of starting with a complex vector (having both a phase and magnitude) in the first place, when we're losing that information when converting to $|V\rangle$ anyway?

You had it earlier in your question! "Consider the vector $N=2^{n}$ dimensional complex vector $\vec{v}$ with components $\{v_i=|v_i|e^{i\phi_i}\}$." Therefore the vector is:

\begin{equation} |\vec{v}|^{-1/2} \begin{pmatrix}|v_{1}|e^{i\phi_{1}}\\ |v_{2}|e^{i\phi_{2}}\\ \vdots\\ |v_{2^{n}}|e^{i\phi_{2^{n}}} \end{pmatrix} \end{equation}

Notice:
1) There's $2^n$ entries, not $2 \times 2^n$
2) There is NO norm around the phases, so this is why you have lost all information about the phases, because you put extra norm symbols where they shouldn't be :)

Or are we writing supposed to consider $|V\rangle$ as $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(3e^{i\phi_1}|000\rangle + 2e^{i\phi_2}|001\rangle + ... + 4e^{i\phi_8}|111\rangle)$?

Closer! The correct answer is the vector I wrote above, which can be written like this:

$|\vec{v}|^{-1/2}\left( e^{i \phi_1} |00 \cdots 00\rangle + e^{i \phi_2} |00 \cdots 01\rangle + \cdots + e^{i \phi_{N}} |1\cdots 1\rangle\right)$.

For your specific example:

\begin{equation} \frac{3e^{i\phi_1}|000\rangle + 2e^{i\phi_8}|001\rangle + \cdots + 4e^{i\phi_8}|111\rangle}{\sqrt{77}} \end{equation}

The purpose of all of this is so that the sum of the squares of the coefficients is 1, which in my equation is true because the numberator is:

\begin{equation} \sqrt{3^2 + 2^2 + 1^2 + 2^2 + 3^2 + 3^2 + 5 ^2+ 4^2} = \sqrt{77} \end{equation}

I hope that clears it up!

$\endgroup$
  • $\begingroup$ Umm, but $|V\rangle = |\vec{V}|^{-1/2}\vec{V}$ isn't it? Where is the $|\vec{V}|^{-1/2}$ in your expression? $\endgroup$ – Sanchayan Dutta May 29 '18 at 15:31
  • $\begingroup$ But $|\vec{V}| = \begin{equation} \sqrt{3^2 + 2^2 + 1^2 + 2^2 + 3^2 + 3^2 + 5 ^2+ 4^2} = \sqrt{77} \end{equation}$. So, $|\vec{V}|^{-1/2} = 77^{-1/4}$, no? Or are they using a different definition of norm? $\endgroup$ – Sanchayan Dutta May 29 '18 at 15:42
  • $\begingroup$ All fixed now. There is a typo in the original Seth Lloyd paper. $\{v_i=|v_i|e^{i\phi_i}\}$ is not normalized. It should be divided by the norm of the vector. The $|\vec{v}|^{-1/2}|$ is called "normalization" by the way. $\endgroup$ – user1271772 May 29 '18 at 15:43
  • $\begingroup$ I ask because for a vector like $2\hat{i}+3\hat{j}+5\hat{k}$ the standard norm is $\sqrt{2^2+3^2+5^2}$ $\endgroup$ – Sanchayan Dutta May 29 '18 at 15:45
  • $\begingroup$ You are right I fixed that, is there still any problem? I would appreciate if you accept the answer since this took way longer to type out than I originally thought. $\endgroup$ – user1271772 May 29 '18 at 15:46

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.