The Quantum Fourier Transform (QFT) matrix looks very similar to the DFT matrix except with a normalization factor of . The matrix for the Quantum Fourier transform on qubits is

where and .

In the following codercises, we will implement the QFT for one- and two-qubit systems.

Implement the circuit that performs the single-qubit QFT operation, i.e., for .

Hint.

For , , and .


num_wires = 1
dev = qml.device("default.qubit", wires=num_wires)

@qml.qnode(dev)
def one_qubit_QFT(basis_id):
"""A circuit that computes the QFT on a single qubit.
Args:
basis_id (int): An integer value identifying
the basis state to construct.
Returns:
array[complex]: The state of the qubit after applying QFT.
"""
# Prepare the basis state |basis_id>
bits = [int(x) for x in np.binary_repr(basis_id, width=num_wires)]
qml.BasisState(bits, wires=[0])

##################
# YOUR CODE HERE #
##################
pass

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Derive the Quantum Fourier Transform (QFT) for one and two qubits.
  • Describe the properties of the QFT.
  • Express the QFT for one and two qubits in terms of gates.