quantum.q_fourier_transform

Build the quantum fourier transform (qft) for a desire number of quantum bits using Qiskit framework. This experiment run in IBM Q simulator with 10000 shots. This circuit can be use as a building block to design the Shor’s algorithm in quantum computing. As well as, quantum phase estimation among others. . References: https://en.wikipedia.org/wiki/Quantum_Fourier_transform https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html

Functions

quantum_fourier_transform(→ qiskit.result.counts.Counts)

# >>> quantum_fourier_transform(2)

Module Contents

quantum.q_fourier_transform.quantum_fourier_transform(number_of_qubits: int = 3) qiskit.result.counts.Counts

# >>> quantum_fourier_transform(2) # {‘00’: 2500, ‘01’: 2500, ‘11’: 2500, ‘10’: 2500} # quantum circuit for number_of_qubits = 3:

┌───┐

qr_0: ──────■──────────────────────■───────┤ H ├─X─

│ ┌───┐ │P(π/2) └───┘ │

qr_1: ──────┼────────■───────┤ H ├─■─────────────┼─

┌───┐ │P(π/4) │P(π/2) └───┘ │

qr_2: ┤ H ├─■────────■───────────────────────────X─

└───┘

cr: 3/═════════════════════════════════════════════ Args:

n : number of qubits

Returns:

qiskit.result.counts.Counts: distribute counts.

>>> quantum_fourier_transform(2)
{'00': 2500, '01': 2500, '10': 2500, '11': 2500}
>>> quantum_fourier_transform(-1)
Traceback (most recent call last):
    ...
ValueError: number of qubits must be > 0.
>>> quantum_fourier_transform('a')
Traceback (most recent call last):
    ...
TypeError: number of qubits must be a integer.
>>> quantum_fourier_transform(100)
Traceback (most recent call last):
    ...
ValueError: number of qubits too large to simulate(>10).
>>> quantum_fourier_transform(0.5)
Traceback (most recent call last):
    ...
ValueError: number of qubits must be exact integer.