The Quantum Exact Simulation Toolkit v4.0.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)
 
void applyQuantumFourierTransform (Qureg qureg, std::vector< int > targets)
 

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 1939 of file operations.cpp.

1939 {
1940 validate_quregFields(qureg, __func__);
1941
1942 // tiny; no need to validate alloc
1943 vector<int> targets(qureg.numQubits);
1944 for (size_t i=0; i<targets.size(); i++)
1945 targets[i] = i;
1946
1947 applyQuantumFourierTransform(qureg, targets.data(), targets.size());
1948}
void applyQuantumFourierTransform(Qureg qureg, int *targets, int numTargets)

Referenced by TEST_CASE().

◆ applyQuantumFourierTransform() [1/2]

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 1918 of file operations.cpp.

1918 {
1919 validate_quregFields(qureg, __func__);
1920 validate_targets(qureg, targets, numTargets, __func__);
1921
1922 /// @todo
1923 /// change this placeholder implementation to the bespoke, optimised routine,
1924 /// wherein each contiguous controlled-phase gate is merged
1925
1926 for (int n=numTargets-1; n>=0; n--) {
1927 applyHadamard(qureg, targets[n]);
1928 for (int m=0; m<n; m++) {
1929 qreal arg = const_PI / powerOf2(m+1);
1930 applyTwoQubitPhaseShift(qureg, targets[n], targets[n-m-1], arg);
1931 }
1932 }
1933
1934 int mid = numTargets/2; // floors
1935 for (int n=0; n<mid; n++)
1936 applySwap(qureg, targets[n], targets[numTargets-1-n]);
1937}
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().

◆ applyQuantumFourierTransform() [2/2]

void applyQuantumFourierTransform ( Qureg qureg,
std::vector< int > targets )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 1952 of file operations.cpp.

1952 {
1953
1954 applyQuantumFourierTransform(qureg, targets.data(), targets.size());
1955}