qpe_toolbox.estimation.qft¶
Functions¶
|
Generate the sequence of gates for a recursive QFT with reversed ordering. |
|
Generate the inverse QFT gate sequence with reversed bit ordering. |
|
Generate the full Quantum Fourier Transform (QFT) gate sequence. |
|
Generate the inverse Quantum Fourier Transform (IQFT) gate sequence. |
Compute the number of gates in the recursive QFT (reversed bit ordering). |
Module Contents¶
- qpe_toolbox.estimation.qft.qft_swapped(wires)[source]¶
Generate the sequence of gates for a recursive QFT with reversed ordering.
The QFT is implemented recursively without final swaps. This routine is suitable for constructing circuits with qubit indices in reversed order.
- Parameters:
wires (list[int]) – List of qubit indices on which to apply the QFT.
- Returns:
List of gate instructions in the form
(gate_label, *params, qubits...), where single-qubit gates are('H', q), and controlled-phase gates are('CPHASE', angle, target, control).- Return type:
Notes
Recursive implementation.
No final SWAP gates are included.
Use
qftfor standard bit ordering with swaps.
- qpe_toolbox.estimation.qft.iqft_swapped(wires)[source]¶
Generate the inverse QFT gate sequence with reversed bit ordering.
- Parameters:
wires (list[int]) – List of qubit indices on which to apply the inverse QFT.
- Returns:
Gate instructions for the inverse QFT, in the same format as
qft_sw.- Return type:
Notes
Controlled-phase gates have their angles negated relative to
qft_sw.No final SWAP gates are included.
- qpe_toolbox.estimation.qft.qft(wires)[source]¶
Generate the full Quantum Fourier Transform (QFT) gate sequence.
- Parameters:
wires (list[int]) – List of qubit indices on which to apply the QFT.
- Returns:
Gate instructions including Hadamard, controlled-phase, and final SWAP gates for normal bit ordering.
- Return type:
Notes
Combines
qft_swwith SWAP gates to reorder qubits to standard output order.
- qpe_toolbox.estimation.qft.iqft(wires)[source]¶
Generate the inverse Quantum Fourier Transform (IQFT) gate sequence.
- Parameters:
wires (list[int]) – List of qubit indices on which to apply the IQFT.
- Returns:
Gate instructions for the inverse QFT, including SWAPs.
- Return type:
Notes
The angles of controlled-phase gates are negated relative to the QFT.
Bit ordering should be checked if interfacing with other routines.
- qpe_toolbox.estimation.qft.count_gates_qft_swapped(m)[source]¶
Compute the number of gates in the recursive QFT (reversed bit ordering).
- Parameters:
m (int) – Number of qubits in the QFT.
- Returns:
Dictionary with keys: -
'H': number of Hadamard gates -'CPHASE': number of controlled-phase gates- Return type:
Notes
SWAP gates are not counted.
Gate count corresponds to the reversed-output QFT.