The Quantum Exact Simulation Toolkit v4.1.0
Loading...
Searching...
No Matches

Functions for applying the Quantum Fourier Transform. More...

Functions

void applyFullQuantumFourierTransform (Qureg qureg)
 
void applyQuantumFourierTransform (Qureg qureg, int *targets, int numTargets)
 

Detailed Description

Functions for applying the Quantum Fourier Transform.

Function Documentation

◆ applyFullQuantumFourierTransform()

void applyFullQuantumFourierTransform ( Qureg qureg)
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 1955 of file operations.cpp.

1955 {
1956 validate_quregFields(qureg, __func__);
1957
1958 // tiny; no need to validate alloc
1959 vector<int> targets(qureg.numQubits);
1960 for (size_t i=0; i<targets.size(); i++)
1961 targets[i] = i;
1962
1963 applyQuantumFourierTransform(qureg, targets.data(), targets.size());
1964}
void applyQuantumFourierTransform(Qureg qureg, int *targets, int numTargets)

Referenced by TEST_CASE().

◆ applyQuantumFourierTransform()

void applyQuantumFourierTransform ( Qureg qureg,
int * targets,
int numTargets )
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 1934 of file operations.cpp.

1934 {
1935 validate_quregFields(qureg, __func__);
1936 validate_targets(qureg, targets, numTargets, __func__);
1937
1938 /// @todo
1939 /// change this placeholder implementation to the bespoke, optimised routine,
1940 /// wherein each contiguous controlled-phase gate is merged
1941
1942 for (int n=numTargets-1; n>=0; n--) {
1943 applyHadamard(qureg, targets[n]);
1944 for (int m=0; m<n; m++) {
1945 qreal arg = const_PI / powerOf2(m+1);
1946 applyTwoQubitPhaseShift(qureg, targets[n], targets[n-m-1], arg);
1947 }
1948 }
1949
1950 int mid = numTargets/2; // floors
1951 for (int n=0; n<mid; n++)
1952 applySwap(qureg, targets[n], targets[numTargets-1-n]);
1953}
void applyHadamard(Qureg qureg, int target)
void applyTwoQubitPhaseShift(Qureg qureg, int target1, int target2, qreal angle)
void applySwap(Qureg qureg, int qubit1, int qubit2)

Referenced by applyFullQuantumFourierTransform(), applyQuantumFourierTransform(), and TEST_CASE().