Beispiel #1
0
                               BackendToQPU
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister, Aer
from qiskit.circuit import Parameter

LOGGER = logging.getLogger()
# Set level to logging.DEBUG in order to see more information
LOGGER.setLevel(logging.WARNING)

# redirects log writing to terminal
STREAM_HANDLER = logging.StreamHandler()
STREAM_HANDLER.setLevel(logging.DEBUG)
LOGGER.addHandler(STREAM_HANDLER)

PYGATES_1QB = [
    X, Y, Z, I, S, T,
    S.dag(),
    T.dag(), H,
    RX(3.14),
    RY(3.14),
    RZ(3.14),
    U2(3.14, 3.14),
    R(3.14, 3.14),
    U3(3.14, 3.14, 3.14)
]
PYGATES_2QB = [
    SWAP, CNOT,
    Y.ctrl(),
    Z.ctrl(),
    H.ctrl(),
    RZ(3.14).ctrl(),
    RXX(3.14),
Beispiel #2
0
RZZ = AbstractGate("RZZ", [float], arity=2, matrix_generator=_gen_rzz)
R = AbstractGate("R", [float] * 2, arity=1, matrix_generator=_gen_r)
MS = AbstractGate("MS", [float, int], arity=lambda theta, nb_qbits: nb_qbits,
                  circuit_generator=_gen_ms)


GATE_DIC = {
    "h": H,
    "x": X,
    "y": Y,
    "z": Z,
    "swap": SWAP,
    "i": I,
    "id": I,
    "s": S,
    "sdg": S.dag(),
    "t": T,
    "tdg": T.dag(),
    "rx": RX,
    "ry": RY,
    "rz": RZ,
    "rxx": RXX,
    "rzz": RZZ,
    "p": RZ,
    "r": R,
    "ms": MS,
    "u": U3,
    # below: deprecated
    "u0": I,
    "U": U,
    "xbase": X,