The Quantum Exact Simulation Toolkit v4.2.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 1760 of file operations.cpp.

1760 {
1761 validate_quregFields(qureg, __func__);
1762
1763 // tiny; no need to validate alloc
1764 vector<int> targets(qureg.numQubits);
1765 for (size_t i=0; i<targets.size(); i++)
1766 targets[i] = i;
1767
1768 applyQuantumFourierTransform(qureg, targets.data(), targets.size());
1769}
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 1739 of file operations.cpp.

1739 {
1740 validate_quregFields(qureg, __func__);
1741 validate_targets(qureg, targets, numTargets, __func__);
1742
1743 /// @todo
1744 /// change this placeholder implementation to the bespoke, optimised routine,
1745 /// wherein each contiguous controlled-phase gate is merged
1746
1747 for (int n=numTargets-1; n>=0; n--) {
1748 applyHadamard(qureg, targets[n]);
1749 for (int m=0; m<n; m++) {
1750 qreal arg = const_PI / powerOf2(m+1);
1751 applyTwoQubitPhaseShift(qureg, targets[n], targets[n-m-1], arg);
1752 }
1753 }
1754
1755 int mid = numTargets/2; // floors
1756 for (int n=0; n<mid; n++)
1757 applySwap(qureg, targets[n], targets[numTargets-1-n]);
1758}
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().