Skip to content

Quantum Fourier Transform

The quantum Fourier transform (QFT) function is the quantum analog for discrete Fourier transform. It is applied on the quantum register state vector.

The state vector x is transformed to y in the following manner:

\[ y_{k} = \frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} x_j e^{2\pi i \frac{jk}{N}} \]

Function: qft


  • target: QArray[QBit]

The target quantum argument is the quantum state on which we apply the QFT.


from classiq import Output, QArray, QBit, allocate, create_model, qft, qfunc

def main(x: Output[QArray[QBit]]):

    allocate(4, x)

qmod = create_model(main)
from classiq import synthesize, write_qmod

write_qmod(qmod, "qft")
qprog = synthesize(qmod)