The Quantum Fourier Transform

Here are a couple of functions that implement the quantum fourier transform:

dc_qiskit_algorithms.Qft.get_theta(k)[source]

As the conditional rotations are defined by a parameter k we have a convenience function for this:

\[\theta = \pm \frac{2\pi}{2^{(|k|)}}\]
Parameters

k (int) – the integer for the angle

Return type

float

Returns

the angle

class dc_qiskit_algorithms.Qft.QuantumFourierTransformGate(num_qubits)[source]

Bases: qiskit.circuit.gate.Gate

inverse()[source]

Invert this instruction.

If the instruction is composite (i.e. has a definition), then its definition will be recursively inverted.

Special instructions inheriting from Instruction can implement their own inverse (e.g. T and Tdg, Barrier, etc.)

Returns

a fresh instruction for the inverse

Return type

qiskit.circuit.Instruction

Raises

CircuitError – if the instruction is not composite and an inverse has not been implemented for it.

dc_qiskit_algorithms.Qft.qft(self, q)[source]

Applies the Quantum Fourier Transform to q

Parameters
  • self (QuantumCircuit) – the circuit to which the qft is applied

  • q (Union[List[Qubit], QuantumRegister]) – the quantum register or list of quantum register/index tuples

Return type

Instruction

Returns

the circuit with applied qft

dc_qiskit_algorithms.Qft.qft_dg(self, q)[source]

Applies the inverse Quantum Fourier Transform to q

Parameters
  • self (QuantumCircuit) – the circuit to which the qft_dag is applied

  • q (Union[List[Qubit], QuantumRegister]) – the quantum register or list of quantum register/index tuples

Return type

Instruction

Returns

the circuit with applied qft_dag