qiu_quantum_computing.qft
¶
Quantum Fourier transform circuits.
Qiskit's quantum Fourier transform maps the basis state |j> of n qubits to
sum_k e^(2 pi i j k / N) |k> / sqrt(N) with N = 2**n, where the integers are
encoded in little-endian order like the indices of the statevector. On the
amplitudes, it is thus the orthonormal inverse discrete Fourier transform of NumPy,
qft(psi) == numpy.fft.ifft(psi, norm="ortho"), and the inverse QFT is
numpy.fft.fft(psi, norm="ortho").
Functions:
-
qft_matrix–Return the dense unitary matrix of the quantum Fourier transform.
-
qft_circuit–Return a circuit of the quantum Fourier transform, see the module docstring.
qft_matrix
¶
qft_matrix(num_qubits: int) -> NDArray[complex128]
Return the dense unitary matrix of the quantum Fourier transform.
Parameters:
-
num_qubits(int) –The number of qubits.
Returns:
-
NDArray[complex128]–The matrix with the entries
e^(2 pi i j k / N) / sqrt(N).
Source code in packages/qiu-quantum-computing/src/qiu_quantum_computing/qft.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
qft_circuit
¶
qft_circuit(num_qubits: int, *, inverse: bool = False, method: SynthesisMethod = GATE) -> QuantumCircuit
Return a circuit of the quantum Fourier transform, see the module docstring.
Parameters:
-
num_qubits(int) –The number of qubits, at least 1.
-
inverse(bool, default:False) –If True, return the inverse quantum Fourier transform.
-
method(SynthesisMethod, default:GATE) –How the transform is represented in the circuit: -
GATE(default): a single QiskitQFTGate, synthesized when transpiling. -DECOMPOSED: Hadamard, controlled phase and swap gates, synthesized by Qiskit'ssynth_qft_full. -DENSE: a single unitary gate of the matrix ofqft_matrix.
Returns:
-
QuantumCircuit–The quantum Fourier transform circuit.
Raises:
-
ValueError–If the number of qubits is smaller than 1.
Source code in packages/qiu-quantum-computing/src/qiu_quantum_computing/qft.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |