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)
 

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 tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 1478 of file operations.cpp.

1478 {
1479 validate_quregFields(qureg, __func__);
1480
1481 vector<int> targets(qureg.numQubits);
1482 for (size_t i=0; i<targets.size(); i++)
1483 targets[i] = i;
1484
1485 applyQuantumFourierTransform(qureg, targets.data(), targets.size());
1486}
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 tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 1457 of file operations.cpp.

1457 {
1458 validate_quregFields(qureg, __func__);
1459 validate_targets(qureg, targets, numTargets, __func__);
1460
1461 /// @todo
1462 /// change this placeholder implementation to the bespoke, optimised routine,
1463 /// wherein each contiguous controlled-phase gate is merged
1464
1465 for (int n=numTargets-1; n>=0; n--) {
1466 applyHadamard(qureg, targets[n]);
1467 for (int m=0; m<n; m++) {
1468 qreal arg = const_PI / powerOf2(m+1);
1469 applyTwoQubitPhaseShift(qureg, targets[n], targets[n-m-1], arg);
1470 }
1471 }
1472
1473 int mid = numTargets/2; // floors
1474 for (int n=0; n<mid; n++)
1475 applySwap(qureg, targets[n], targets[numTargets-1-n]);
1476}
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(), and TEST_CASE().