0

In theory, the state of a qubit is defined by 2 complex numbers, following this formula:

Image for formula of qubit superposition state

The rule is that the amount of complex numbers needed to define the state of a set of qubits is equal to 2ⁿ, where n is the number of used qubits.

if i have an array of complex numbers, how can I map or assign each number to a qubit?

For instance: I have this complex number: 0.0020908999722450972 + i*0.001669629942625761. What would the state of a qubit be in this case? Would I be needing more qubits to represent this number?

Mariia Mykhailova
  • 1,987
  • 1
  • 9
  • 18

1 Answers1

2

I think that depends on what are you going to do with these numbers after you have mapped them to qubits.

If you need to use 2ⁿ numbers to prepare a quantum state on n qubits that is a weighted superposition of the basis states, you can use PrepareArbitraryState operation which does exactly that. Internally it implements the paper Synthesis of Quantum Logic Circuits by Shende, Bullock, Markov.

If you need to represent these numbers in a way that would allow you to read them out by measuring the qubits, you might have to do something like convert them in binary and store each bit in a separate qubit.

Mariia Mykhailova
  • 1,987
  • 1
  • 9
  • 18
  • Unfortunatelly my input does not have a fixed size. I have a vague sensation that I might need something of both your suggestions. What I'm trying to do is implement in Q# the NonUniform Discrete Fourier Transform. I am doing this because I need to convert data generated by a Siemens MRI scanner into an image (long story short). My input is an array of complex numbers which undergoes a series of transformations until I get to apply the NDFT. I might need n qubits for each number, but in terms of encoding or setting the values, doing something and then measuring ... that's the tricky part. – Mircea Suceveanu May 10 '19 at 05:33