I have a classical vector of size $2^{n}$ (normalized) and I want to use this value as amplitude for my $n$ qbits, in the canonical basis $|00000\rangle$, $|00001\rangle$ etc. I want to use real feasible gates ($RX$, $RY$ $RZ$, $H$, Pauli gates, $CNOT$, $CRX$ etc) starting from the $|0000\rangle$ state.

Is there a general algorithm for that?

More Precisely, I'm interested in the length of such circuit and the numbers of gates (in worst case) according to $n$.

Do you have any idea or reference on the subject? I'm a bit lost here...

best regards,



1 Answer 1


The task of how to perform "Amplitude encoding" - given $\vec{x}$, prepare $|\psi\rangle = \sum_k x_k |k\rangle$ - doesn't have a general answer. It could be accomplished by a depth-one circuit for a "one-hot" vector $x_k = \delta_i^k$. Or it could take an arbitrarily deep circuit to produce a set of amplitudes resembling a discretized gaussian like $x_k \propto e^{-(\bar{x} - k)^2/\mu}$.

In earlier "quantum machine learning" algorithms, its usually proposed that this task will be accomplished by an "oracle" (i.e. black box) or aided by "qRAM", neither of which represent a near-term or mainstream technology. A good reference to check out is Scott Aaronson's critique on these types of devices and algorithms.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.