// OpenQASM3 U with global phase gamma // void U( Complex a[], double theta, double phi, double lambda, double gamma) { double t = theta/2; Complex t0 = a[0], t1 = a[1], p = exp(CMPLX(0,gamma)), c = p*cos(t), s = p*sin(t), u00 = c, u01 = -exp(CMPLX(0,lambda))*s, u10 = exp(CMPLX(0,phi))*s, u11 = exp(CMPLX(0,phi+lambda))*c; a[0] = u00*t0+u01*t1; a[1] = u10*t0+u11*t1; }