Ejemplo n.º 1
0
            ),
        ],
    ),
]

#
# Single qubit deserializers for arbitrary rotations
#
SINGLE_QUBIT_DESERIALIZERS = [
    op_deserializer.GateOpDeserializer(
        serialized_gate_id='xy',
        gate_constructor=ops.PhasedXPowGate,
        args=[
            op_deserializer.DeserializingArg(
                serialized_name='axis_half_turns',
                constructor_arg_name='phase_exponent',
            ),
            op_deserializer.DeserializingArg(
                serialized_name='half_turns',
                constructor_arg_name='exponent',
            ),
        ],
    ),
    op_deserializer.GateOpDeserializer(
        serialized_gate_id='z',
        gate_constructor=ops.ZPowGate,
        args=[
            op_deserializer.DeserializingArg(
                serialized_name='half_turns',
                constructor_arg_name='exponent',
            ),
        ],
Ejemplo n.º 2
0
            op_serializer.SerializingArg(serialized_name='half_turns',
                                         serialized_type=float,
                                         gate_getter='exponent'),
            op_serializer.SerializingArg(
                serialized_name='type',
                serialized_type=str,
                gate_getter=lambda x: 'virtual_propagates_forward'),
        ])
]
"""Single qubit deserializers into PhasedXPowGate and ZPowGate"""
SINGLE_QUBIT_DESERIALIZERS = [
    op_deserializer.GateOpDeserializer(
        serialized_gate_id='xy',
        gate_constructor=ops.PhasedXPowGate,
        args=[
            op_deserializer.DeserializingArg(
                serialized_name='axis_half_turns',
                constructor_arg_name='phase_exponent'),
            op_deserializer.DeserializingArg(serialized_name='half_turns',
                                             constructor_arg_name='exponent')
        ]),
    op_deserializer.GateOpDeserializer(serialized_gate_id='z',
                                       gate_constructor=ops.ZPowGate,
                                       args=[
                                           op_deserializer.DeserializingArg(
                                               serialized_name='half_turns',
                                               constructor_arg_name='exponent')
                                       ]),
]
"""Measurement serializer."""
MEASUREMENT_SERIALIZER = op_serializer.GateOpSerializer(
    gate_type=ops.MeasurementGate,
Ejemplo n.º 3
0
            op_serializer.SerializingArg(
                serialized_name='type',
                serialized_type=str,
                gate_getter=lambda x: 'virtual_propagates_forward'),
        ])
]

#
# Single qubit deserializers for arbitrary rotations
#
SINGLE_QUBIT_DESERIALIZERS = [
    op_deserializer.GateOpDeserializer(
        serialized_gate_id='xy',
        gate_constructor=ops.PhasedXPowGate,
        args=[
            op_deserializer.DeserializingArg(
                serialized_name='axis_half_turns',
                constructor_arg_name='phase_exponent'),
            op_deserializer.DeserializingArg(serialized_name='half_turns',
                                             constructor_arg_name='exponent')
        ]),
    op_deserializer.GateOpDeserializer(serialized_gate_id='z',
                                       gate_constructor=ops.ZPowGate,
                                       args=[
                                           op_deserializer.DeserializingArg(
                                               serialized_name='half_turns',
                                               constructor_arg_name='exponent')
                                       ]),
]

#
# Measurement Serializer and Deserializer
Ejemplo n.º 4
0
             op_serializer.SerializingArg(
                 serialized_name='key',
                 serialized_type=str,
                 gate_getter=protocols.measurement_key),
             op_serializer.SerializingArg(serialized_name='invert_mask',
                                          serialized_type=List[bool],
                                          gate_getter='invert_mask')
         ])
 ],
 deserializers=[
     op_deserializer.GateOpDeserializer(
         serialized_gate_id='exp_w',
         gate_constructor=ops.PhasedXPowGate,
         args=[
             op_deserializer.DeserializingArg(
                 serialized_name='axis_half_turns',
                 constructor_arg_name='phase_exponent'),
             op_deserializer.DeserializingArg(
                 serialized_name='half_turns',
                 constructor_arg_name='exponent')
         ]),
     op_deserializer.GateOpDeserializer(
         serialized_gate_id='exp_z',
         gate_constructor=ops.ZPowGate,
         args=[
             op_deserializer.DeserializingArg(
                 serialized_name='half_turns',
                 constructor_arg_name='exponent')
         ]),
     op_deserializer.GateOpDeserializer(
         serialized_gate_id='exp_11',