MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / applyQuantumFourierTransform

Function applyQuantumFourierTransform

quest/src/api/operations.cpp:1739–1758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1737extern "C" {
1738
1739void applyQuantumFourierTransform(Qureg qureg, int* targets, int numTargets) {
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}
1759
1760void applyFullQuantumFourierTransform(Qureg qureg) {
1761 validate_quregFields(qureg, __func__);

Callers 2

SECTIONFunction · 0.85

Calls 6

validate_quregFieldsFunction · 0.85
validate_targetsFunction · 0.85
applyHadamardFunction · 0.85
powerOf2Function · 0.85
applyTwoQubitPhaseShiftFunction · 0.85
applySwapFunction · 0.85

Tested by

no test coverage detected