func main() { qreg := quantum.NewQReg(2, 1) quantum.HadamardReg(qreg) quantum.NewRealArrayGate([]float64{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, }).ApplyReg(qreg) quantum.Hadamard(qreg, 1) if qreg.BMeasure(1) == 0 { fmt.Println("constant") } else { fmt.Println("balanced") } os.Exit(0) }
func main() { qreg := quantum.NewQReg(8, 0) quantum.HadamardReg(qreg) fmt.Printf("%d\n", qreg.Measure()) os.Exit(0) }