iswap-gate-cudaq
Table of Contents
iSWAP gate (CUDA-Q)
iSWAP gate implementation using CUDA-Q. The example prepares $\lvert 10\rangle$ and applies iSWAP to produce $i\lvert 01\rangle$.
// Compile: nvq++ main.cpp -o main // Run: ./main #include <cudaq.h> struct kernel { __qpu__ void operator()() { cudaq::qvector<2> q; x(q[0]); // q[0]=|1>, q[1]=|0> => |10> iswap(q[0], q[1]); // |10> -> i|01> mz(q); } }; int main() { auto counts = cudaq::sample(kernel{}); counts.dump(); // 100% |01> (the i phase is not observable in Z basis) }
iswap-gate-cudaq.txt ยท Last modified: by 127.0.0.1
