# Entanglement state preparation by using amplitude values

I have an algorithm that uses QRAM, after accessing the given QRAM that store M d-dimensional classical vectors, the state of the index register and the data register become entangled. But for now I don't have the QRAM black box, I just initialize the state of both systems by providing an array value to the registers at once using initialize function that exists in the qiskit module. My question is I have assigned the value 0 for non-visible basis. Is that ok?

If you are talking about the qRAM for encoding real numbers in amplitudes of a quantum system yes. Basically, you assume without loss of generalities that your problem/vector is of size a power of 2. But if your problem is not exactly of this type, we just pad with 0s. When you apply a quantum algorithm, you just need to be sure you are doing the computation you want.

• Yes, sir thank you very much !!! that is what i want, encoding real number vectors to the amplitude. But as the dimension of the vector increased the result will be not expected. The algorithm that i want is to estimate the Euclidean distance between a single and a set of point (by taking the average).
– Aman
Sep 29, 2018 at 14:43
• The swap Test adapted for distance ? Sep 29, 2018 at 22:50
• Yes sir, when the number of points in the set and or the number of dimension is increased i loose a lot. What shall i do ?? I am in big trouble!!
– Aman
Sep 30, 2018 at 11:06
• Thank you every one!! I found it. Since the algorithm uses swap gate I was wrong on selecting the qubits that exchanged.
– Aman
Oct 10, 2018 at 19:59
• @Aman You mean that if we have our vectors requiring 3 qubits, the first on (q1,q2,q3) and the second (q4,q5,q6), you mean that we should swap (q1,q6), (q2,q5) and (q3,q4) instead of (q1,q4), (q2,q5), (q3,q6)? Oct 10, 2018 at 22:15