Exemplo n.º 1
0
#
# Single qubit serializers and deserializers
#
#############################################

#
# Single qubit serializers for arbitrary rotations
#
SINGLE_QUBIT_SERIALIZERS = [
    op_serializer.GateOpSerializer(
        gate_type=ops.PhasedXPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
                serialized_type=float,
                op_getter='phase_exponent',
            ),
            op_serializer.SerializingArg(
                serialized_name='half_turns',
                serialized_type=float,
                op_getter='exponent',
            ),
        ],
    ),
    op_serializer.GateOpSerializer(
        gate_type=ops.XPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
Exemplo n.º 2
0
#
# Single qubit serializers and deserializers
#
#############################################

#
# Single qubit serializers for arbitrary rotations
#
SINGLE_QUBIT_SERIALIZERS = [
    op_serializer.GateOpSerializer(
        gate_type=ops.PhasedXPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
                serialized_type=float,
                op_getter='phase_exponent',
            ),
            op_serializer.SerializingArg(
                serialized_name='half_turns',
                serialized_type=float,
                op_getter='exponent',
            ),
        ],
    ),
    op_serializer.GateOpSerializer(
        gate_type=ops.XPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
Exemplo n.º 3
0
#############################################
#
# Single qubit serializers and deserializers
#
#############################################

#
# Single qubit serializers for arbitrary rotations
#
SINGLE_QUBIT_SERIALIZERS = [
    op_serializer.GateOpSerializer(
        gate_type=ops.PhasedXPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(serialized_name='axis_half_turns',
                                         serialized_type=float,
                                         gate_getter='phase_exponent'),
            op_serializer.SerializingArg(serialized_name='half_turns',
                                         serialized_type=float,
                                         gate_getter='exponent'),
        ]),
    op_serializer.GateOpSerializer(
        gate_type=ops.XPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(serialized_name='axis_half_turns',
                                         serialized_type=float,
                                         gate_getter=lambda x: 0.0),
            op_serializer.SerializingArg(serialized_name='half_turns',
                                         serialized_type=float,
                                         gate_getter='exponent'),
Exemplo n.º 4
0
#
# Single qubit serializers and deserializers
#
#############################################

#
# Single qubit serializers for arbitrary rotations
#
SINGLE_QUBIT_SERIALIZERS = [
    op_serializer.GateOpSerializer(
        gate_type=ops.PhasedXPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
                serialized_type=float,
                gate_getter='phase_exponent',
            ),
            op_serializer.SerializingArg(
                serialized_name='half_turns',
                serialized_type=float,
                gate_getter='exponent',
            ),
        ],
    ),
    op_serializer.GateOpSerializer(
        gate_type=ops.XPowGate,
        serialized_gate_id='xy',
        args=[
            op_serializer.SerializingArg(
                serialized_name='axis_half_turns',
Exemplo n.º 5
0
from typing import cast, List

from cirq import ops, protocols
from cirq.google import op_serializer, op_deserializer, serializable_gate_set

# The xmon gate set.
XMON = serializable_gate_set.SerializableGateSet(
    gate_set_name='xmon',
    serializers=[
        op_serializer.GateOpSerializer(
            gate_type=ops.PhasedXPowGate,
            serialized_gate_id='exp_w',
            args=[
                op_serializer.SerializingArg(serialized_name='axis_half_turns',
                                             serialized_type=float,
                                             gate_getter='phase_exponent'),
                op_serializer.SerializingArg(serialized_name='half_turns',
                                             serialized_type=float,
                                             gate_getter='exponent')
            ]),
        op_serializer.GateOpSerializer(gate_type=ops.ZPowGate,
                                       serialized_gate_id='exp_z',
                                       args=[
                                           op_serializer.SerializingArg(
                                               serialized_name='half_turns',
                                               serialized_type=float,
                                               gate_getter='exponent')
                                       ]),
        op_serializer.GateOpSerializer(
            gate_type=ops.XPowGate,