h-gate-cudaq
Table of Contents
Hadamard gate (CUDA-Q)
Hadamard gate implementation using CUDA-Q.
// Compile: nvq++ main.cpp -o main // Run: ./main #include <cudaq.h> struct kernel { __qpu__ void operator()() { cudaq::qubit q; h(q); // |0> -> |+> mz(q); } }; int main() { auto counts = cudaq::sample(kernel{}); counts.dump(); // ~50% |0>, ~50% |1> }
h-gate-cudaq.txt ยท Last modified: by 127.0.0.1
