} u2_data = { "opaque": False, "n_args": 2, "n_bits": 1, "args": ["phi", "lambda"], "bits": ["q"], # gate u2(phi,lambda) q { U(pi/2,phi,lambda) q; } "body": node.GateBody([ node.UniversalUnitary([ node.ExpressionList([ node.BinaryOp([ node.BinaryOperator('/'), node.Real(sympy.pi), node.Int(2) ]), node.Id("phi", 0, ""), node.Id("lambda", 0, "") ]), node.Id("q", 0, "") ]) ]) } h_data = { "opaque": False, "n_args": 0, "n_bits": 1, "args": [], "bits": ["a"],
False, "opaque": False, "n_args": 3, "n_bits": 1, "args": ["theta", "phi", "lambda"], "bits": ["q"], # gate u3(theta,phi,lambda) q { U(theta,phi,lambda) q; } "body": node.GateBody([ node.UniversalUnitary([ node.ExpressionList([ node.Id("theta", 0, ""), node.Id("phi", 0, ""), node.Id("lambda", 0, "") ]), node.Id("q", 0, "") ]) ]) } # 2-parameter 1-pulse single qubit gate QuantumCircuit.definitions["u2"] = { "print": False, "opaque": False, "n_args": 2,
"print": True, "opaque": False, "n_args": 1, "n_bits": 2, "args": ["theta"], "bits": ["a", "b"], # gate rzz(theta) a, b { cx a, b; u1(theta) b; cx a, b; } "body": node.GateBody([ node.CustomUnitary([ node.Id("cx", 0, ""), node.PrimaryList([node.Id("a", 0, ""), node.Id("b", 0, "")]) ]), node.CustomUnitary([ node.Id("u1", 0, ""), node.ExpressionList([node.Id("theta", 0, "")]), node.PrimaryList([node.Id("b", 0, "")]) ]), node.CustomUnitary([ node.Id("cx", 0, ""), node.PrimaryList([node.Id("a", 0, ""), node.Id("b", 0, "")]) ]) ]) }