Table of Contents

Y gate (CUDA-Q)

Y gate implementation using CUDA-Q.

// Compile: nvq++ main.cpp -o main
// Run:     ./main
 
#include <cudaq.h>
 
struct kernel {
    __qpu__ void operator()() {
        cudaq::qubit q;
        y(q);  // |0> -> i|1>; global phase not observable at measurement
        mz(q);
    }
};
 
int main() {
    auto counts = cudaq::sample(kernel{});
    counts.dump();  // 100% |1>
}