22 template <
class SimulatorType>
32 static void applyQFT(SimulatorType& qSim,
const unsigned int minIdx,
const unsigned int maxIdx){
36 for(
int i = maxIdx; i >= (int) minIdx; i--){
40 for(
int j = i-1; j >= (int) minIdx; j--){
41 theta = 2.0*M_PI / (std::size_t) (0b1<<(1+(i-j)));
42 qSim.applyGateCPhaseShift(theta, j, i);
45 qSim.InvertRegister(minIdx, maxIdx);
55 static void applyIQFT(SimulatorType& qSim,
const unsigned int minIdx,
const unsigned int maxIdx){
57 qSim.InvertRegister(minIdx, maxIdx);
60 for(
int i = minIdx; i <= (int) maxIdx; i++){
63 for(
int j = minIdx; j < i; j++){
64 theta = -2.0*M_PI / (std::size_t) (0b1<<(1+(i-j)));
65 qSim.applyGateCPhaseShift(theta, j, i);
static void applyIQFT(SimulatorType &qSim, const unsigned int minIdx, const unsigned int maxIdx)
Applies the inverse QFT on the given register.
Class definition for performing quantum forward and inverse Fourier transforms.
static void applyQFT(SimulatorType &qSim, const unsigned int minIdx, const unsigned int maxIdx)
Applies the forward QFT on the given register.