Loading examples/qrt/multiple_kernels.cpp +2 −3 Original line number Diff line number Diff line #include "qcor.hpp" // The header file which contains QFT kernel def #include "qft.hpp" Loading @@ -9,10 +8,10 @@ __qpu__ void f(qreg q) { X(q[1]); // Call qft kernel (defined in a separate header file) quantumFourierTransform(q, nQubits); qft(q, nQubits); // Inverse QFT: inverseQuantumFourierTransform(q, nQubits); iqft(q, nQubits); // Measure all qubits for (int qIdx = 0; qIdx < nQubits; ++qIdx) { Loading examples/qrt/multiple_kernels_Bell_test.cpp +2 −2 Original line number Diff line number Diff line #include "qcor.hpp" #include "qalloc.hpp" // Demonstrating Bell Test using multiple kernels Loading Loading @@ -34,7 +34,7 @@ __qpu__ void bellTest(qreg qBits) { } // Compile: // qcor -o multiple_kernels -qpu qpp -shots 1024 -qrt multiple_kernels.cpp // qcor -o multiple_kernels -qpu qpp -shots 1024 -qrt multiple_kernels_Bell_test.cpp int main(int argc, char **argv) { // Allocate 7 qubits: // i.e. Hadamard on q[3] and entangle q[3] with other qubits. Loading examples/qrt/qft.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ // which is compiled by QCOR. #pragma once #include "qcor.hpp" #include "qalloc.hpp" // QFT kernel: // Input: Qubit register and the max qubit index for the QFT, // i.e. allow us to do QFT on a subset of the register [0, maxBitIdx) __qpu__ void quantumFourierTransform(qreg q, int maxBitIdx) { __qpu__ void qft(qreg q, int maxBitIdx) { // Local Declarations const auto nQubits = maxBitIdx; Loading @@ -28,7 +28,7 @@ __qpu__ void quantumFourierTransform(qreg q, int maxBitIdx) { } // Inverse QFT __qpu__ void inverseQuantumFourierTransform(qreg q, int maxBitIdx) { __qpu__ void iqft(qreg q, int maxBitIdx) { // Local Declarations const auto nQubits = maxBitIdx; // Swap qubits Loading Loading
examples/qrt/multiple_kernels.cpp +2 −3 Original line number Diff line number Diff line #include "qcor.hpp" // The header file which contains QFT kernel def #include "qft.hpp" Loading @@ -9,10 +8,10 @@ __qpu__ void f(qreg q) { X(q[1]); // Call qft kernel (defined in a separate header file) quantumFourierTransform(q, nQubits); qft(q, nQubits); // Inverse QFT: inverseQuantumFourierTransform(q, nQubits); iqft(q, nQubits); // Measure all qubits for (int qIdx = 0; qIdx < nQubits; ++qIdx) { Loading
examples/qrt/multiple_kernels_Bell_test.cpp +2 −2 Original line number Diff line number Diff line #include "qcor.hpp" #include "qalloc.hpp" // Demonstrating Bell Test using multiple kernels Loading Loading @@ -34,7 +34,7 @@ __qpu__ void bellTest(qreg qBits) { } // Compile: // qcor -o multiple_kernels -qpu qpp -shots 1024 -qrt multiple_kernels.cpp // qcor -o multiple_kernels -qpu qpp -shots 1024 -qrt multiple_kernels_Bell_test.cpp int main(int argc, char **argv) { // Allocate 7 qubits: // i.e. Hadamard on q[3] and entangle q[3] with other qubits. Loading
examples/qrt/qft.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ // which is compiled by QCOR. #pragma once #include "qcor.hpp" #include "qalloc.hpp" // QFT kernel: // Input: Qubit register and the max qubit index for the QFT, // i.e. allow us to do QFT on a subset of the register [0, maxBitIdx) __qpu__ void quantumFourierTransform(qreg q, int maxBitIdx) { __qpu__ void qft(qreg q, int maxBitIdx) { // Local Declarations const auto nQubits = maxBitIdx; Loading @@ -28,7 +28,7 @@ __qpu__ void quantumFourierTransform(qreg q, int maxBitIdx) { } // Inverse QFT __qpu__ void inverseQuantumFourierTransform(qreg q, int maxBitIdx) { __qpu__ void iqft(qreg q, int maxBitIdx) { // Local Declarations const auto nQubits = maxBitIdx; // Swap qubits Loading