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}} \]

Syntax

Function: QFT

Parameters:

  • num_qubits: PositiveInt
  • approximation_degree: NonNegativeInt
  • do_swaps: bool

The approximation_degree attribute omits rotation gates for small angles. The default value is 0.

The do_swaps attribute adds additional SWP gates after the QFT, thereby reversing the order of the qubits. The default value is True.

Example

{
  "functions": [
    {
      "name": "main",
      "body": [
          {
              "function": "QFT",
              "function_params": {
                  "num_qubits": 4
              }
          }
      ]
    }
  ]
}
from classiq.builtin_functions import QFT
from classiq import Model, synthesize

model = Model()
params = QFT(
    num_qubits=4,
)
model.QFT(params)
quantum_program = synthesize(model.get_model())

 QFT_Example