// CNOT, swap q[2] and q[3] // // Python: self.onezero, self.oneone = self.oneone, self.onezero // void CNOT( double complex q[4]) { double complex t = q[3]; q[3] = q[2]; q[2] = t; } // Z gate on first qubit // // Python: self.onezero *= -1; self.oneone *= -1 // void Z( double complex q[4]) { q[2] = -q[2]; q[3] = -q[3]; }