# What is the purpose of a quantum RAM in quantum algorithms?

I see many papers (e.g. Quantum principal component analysis) in which the existence of qRAM is necessary. What's the actual purpose of qRAM in quantum algorithms?

• Hello, we prefer it if one post contains only one question. Also problems we will face will probably lead to dicussion/opinions and is therefore not the best question for Quantum Computing StackExchange. – MEE the sneaky user Apr 6 '18 at 13:51
• @MEE replaced two questions with one. – Anton Karazeev Apr 6 '18 at 14:04
• – glS Apr 6 '18 at 17:07

The purpose of most quantum(-enhanced) machine learning algorithms is to speed-up the processing of classical data over what is possible with classical machine learning algorithms. In other words, the context is that you have a set of classical vectors $\{\boldsymbol x_k\}_k$, and you want to compute some function $\boldsymbol f(\boldsymbol x_k)$ of this data (which may then be used as an estimator of some property, or as a function characterising a classifier to be used for new data points, or something else). Most quantum machine learning algorithms tell you that, provided you are able to efficiently perform the mapping $$\{\boldsymbol x_k\}_k\mapsto\lvert \{\boldsymbol x_k\}\rangle= N\sum_{kj} x_{kj}\lvert k,j\rangle,$$ then it is sometimes possible to compute $\boldsymbol f(\{\boldsymbol x_k\})$ more efficiently. It is, however, highly nontrivial how to perform such mapping efficiently.
This is where QRAMs come into play. A QRAM is a device that can (theoretically) encode $N$ $d$-dimensional classical vectors into (the amplitudes of) a quantum state of $\log(Nd)$ qubits, in time $\mathcal O(\log(Nd))$. As discussed in Ciliberto et al., as well as in this related answer, the actual feasibility of QRAMs is still not entirely clear, and many caveats remain.