예제 #1
0
        "print":
        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
0
# these circuits, so we may need to modify the algorithm.
# It can happen that a swap in a deeper layer can be removed by permuting
# qubits in the layout. We don't do this.
# It can happen that initial swaps can be removed or partly simplified
# because the initial state is zero. We don't do this.

cx_data = {
    "opaque": False,
    "n_args": 0,
    "n_bits": 2,
    "args": [],
    "bits": ["c", "t"],
    # gate cx c,t { CX c,t; }
    "body": node.GateBody([
        node.Cnot([
            node.Id("c", 0, ""),
            node.Id("t", 0, "")
        ])
    ])
}

swap_data = {
    "opaque": False,
    "n_args": 0,
    "n_bits": 2,
    "args": [],
    "bits": ["a", "b"],
    # gate swap a,b { cx a,b; cx b,a; cx a,b; }
    "body": node.GateBody([
        node.CustomUnitary([
            node.Id("cx", 0, ""),
예제 #3
0
파일: rzz.py 프로젝트: atilag/qiskit-terra
QuantumCircuit.definitions["rzz"] = {
    "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, "")])
        ])
    ])
}
예제 #4
0
# measurement of the same qubit. Near-term experiments cannot implement
# these circuits, so we may need to modify the algorithm.
# It can happen that a swap in a deeper layer can be removed by permuting
# qubits in the layout. We don't do this.
# It can happen that initial swaps can be removed or partly simplified
# because the initial state is zero. We don't do this.

cx_data = {
    "opaque": False,
    "n_args": 0,
    "n_bits": 2,
    "args": [],
    "bits": ["c", "t"],
    # gate cx c,t { CX c,t; }
    "body":
    node.GateBody([node.Cnot([node.Id("c", 0, ""),
                              node.Id("t", 0, "")])])
}

swap_data = {
    "opaque":
    False,
    "n_args":
    0,
    "n_bits":
    2,
    "args": [],
    "bits": ["a", "b"],
    # gate swap a,b { cx a,b; cx b,a; cx a,b; }
    "body":
    node.GateBody([
예제 #5
0
    QuantumCircuit.header = QuantumCircuit.header + "\n" \
        + "include \"qelib1.inc\";"

    # 3-parameter 2-pulse single qubit gate
    QuantumCircuit.definitions["u3"] = {
        "print": 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,
        "n_bits": 1,
        "args": ["phi", "lambda"],