diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto index 0326e482f73..2dea102fed2 100644 --- a/cirq-google/cirq_google/api/v2/program.proto +++ b/cirq-google/cirq_google/api/v2/program.proto @@ -215,8 +215,32 @@ message WaitGate { FloatArg duration_nanos = 1; } +// Representation of cirq.DepolarizingChannel +message DepolarizingChannel { + FloatArg probability = 1; + int32 num_qubits = 2; +} + +// Representation of cirq.RandomGateChannel +message RandomGateChannel { + FloatArg probability = 1; + Operation sub_gate = 2; +} + +// Representation of noisy channels +// These should only be used for serialization +// of noisy circuits for simulation. +// These channels would generally not be supported +// by hardware. +message NoiseChannel { + oneof channel_value { + DepolarizingChannel depolarizingchannel = 1; + RandomGateChannel randomgatechannel = 2; + } +} + // An operation acts on a set of qubits. -// next available id = 27 +// next available id = 28 message Operation { // Previously deprecated fields. Do not use. reserved 1, 2; @@ -241,6 +265,7 @@ message Operation { SingleQubitCliffordGate singlequbitcliffordgate = 21; ResetGate resetgate = 24; ISwapLikeGate iswaplikegate = 26; + NoiseChannel noisechannel = 27; } // Which qubits the operation acts on. diff --git a/cirq-google/cirq_google/api/v2/program_pb2.py b/cirq-google/cirq_google/api/v2/program_pb2.py index 3e662b06a54..1d52d97dcfc 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.py +++ b/cirq-google/cirq_google/api/v2/program_pb2.py @@ -16,7 +16,7 @@ from . import ndarrays_pb2 as cirq__google_dot_api_dot_v2_dot_ndarrays__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\x1a!cirq_google/api/v2/ndarrays.proto\"\xaf\x01\n\x07Program\x12\x32\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.LanguageB\x02\x18\x01\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07programJ\x04\x08\x03\x10\x04\"\xaf\x02\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x12\x32\n\x0cmoment_value\x18\x04 \x01(\x0b\x32\x1a.cirq.google.api.v2.MomentH\x00\x12\x38\n\x0foperation_value\x18\x05 \x01(\x0b\x32\x1d.cirq.google.api.v2.OperationH\x00\x12,\n\ttag_value\x18\x06 \x01(\x0b\x32\x17.cirq.google.api.v2.TagH\x00\x42\r\n\x0b\x63onst_value\"\xec\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\x12\x16\n\x0emoment_indices\x18\x03 \x03(\x05\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"\x9e\x01\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\x12\x19\n\x11operation_indices\x18\x04 \x03(\x05J\x04\x08\x03\x10\x04\"C\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12!\n\x15\x61rg_function_language\x18\x02 \x01(\tB\x02\x18\x01\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x99\x01\n\rISwapLikeGate\x12I\n\roriginal_gate\x18\x01 \x01(\x0e\x32\x32.cirq.google.api.v2.ISwapLikeGate.OriginalCirqGate\"=\n\x10OriginalCirqGate\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0c\n\x08SYCAMORE\x10\x01\x12\n\n\x06WILLOW\x10\x02\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xe7\t\n\tOperation\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x32\n\tresetgate\x18\x18 \x01(\x0b\x32\x1d.cirq.google.api.v2.ResetGateH\x00\x12:\n\riswaplikegate\x18\x1a \x01(\x0b\x32!.cirq.google.api.v2.ISwapLikeGateH\x00\x12-\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.QubitB\x02\x18\x01\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x12\x13\n\x0btag_indices\x18\x17 \x03(\x05\x12/\n\x0e\x63onditioned_on\x18\x19 \x03(\x0b\x32\x17.cirq.google.api.v2.ArgB\x0c\n\ngate_valueB\x07\n\x05tokenJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"\xb6\x03\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x12\x30\n\x07no_sync\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.NoSyncTagH\x00\x12\x38\n\x0bphase_match\x18\x03 \x01(\x0b\x32!.cirq.google.api.v2.PhaseMatchTagH\x00\x12\x36\n\nphysical_z\x18\x04 \x01(\x0b\x32 .cirq.google.api.v2.PhysicalZTagH\x00\x12@\n\x0f\x63lassical_state\x18\x05 \x01(\x0b\x32%.cirq.google.api.v2.ClassicalStateTagH\x00\x12=\n\x0e\x66sim_via_model\x18\x07 \x01(\x0b\x32#.cirq.google.api.v2.FSimViaModelTagH\x00\x12\x37\n\x0cinternal_tag\x18\x08 \x01(\x0b\x32\x1f.cirq.google.api.v2.InternalTagH\x00\x42\x05\n\x03tag\"\x0f\n\rPhaseMatchTag\"\x0e\n\x0cPhysicalZTag\"\x13\n\x11\x43lassicalStateTag\"\x11\n\x0f\x46SimViaModelTag\"\x84\x01\n\tNoSyncTag\x12\x11\n\x07reverse\x18\x01 \x01(\x05H\x00\x12!\n\x17remove_all_syncs_before\x18\x02 \x01(\x08H\x00\x12\x11\n\x07\x66orward\x18\x03 \x01(\x05H\x01\x12 \n\x16remove_all_syncs_after\x18\x04 \x01(\x08H\x01\x42\x05\n\x03revB\x05\n\x03\x66wd\"\xd5\x02\n\x0bInternalTag\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12\x13\n\x0btag_package\x18\x02 \x01(\t\x12>\n\x08tag_args\x18\x03 \x03(\x0b\x32,.cirq.google.api.v2.InternalTag.TagArgsEntry\x12\x44\n\x0b\x63ustom_args\x18\x04 \x03(\x0b\x32/.cirq.google.api.v2.InternalTag.CustomArgsEntry\x1aG\n\x0cTagArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x1aP\n\x0f\x43ustomArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.CustomArg:\x02\x38\x01\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\xdb\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x12=\n\x0fmeasurement_key\x18\x05 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKeyH\x00\x42\x05\n\x03\x61rg\"\xc4\x04\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x12\x14\n\nbool_value\x18\t \x01(\x08H\x00\x12\x15\n\x0b\x62ytes_value\x18\n \x01(\x0cH\x00\x12\x34\n\rcomplex_value\x18\x0b \x01(\x0b\x32\x1b.cirq.google.api.v2.ComplexH\x00\x12\x30\n\x0btuple_value\x18\x0c \x01(\x0b\x32\x19.cirq.google.api.v2.TupleH\x00\x12\x34\n\rndarray_value\x18\r \x01(\x0b\x32\x1b.cirq.google.api.v2.NDArrayH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"\xbd\x01\n\x05Tuple\x12=\n\rsequence_type\x18\x01 \x01(\x0e\x32&.cirq.google.api.v2.Tuple.SequenceType\x12\'\n\x06values\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"L\n\x0cSequenceType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x08\n\x04LIST\x10\x01\x12\t\n\x05TUPLE\x10\x02\x12\x07\n\x03SET\x10\x03\x12\r\n\tFROZENSET\x10\x04\"1\n\x07\x43omplex\x12\x12\n\nreal_value\x18\x01 \x01(\x01\x12\x12\n\nimag_value\x18\x02 \x01(\x01\"\x85\x05\n\x07NDArray\x12?\n\x10\x63omplex128_array\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.Complex128ArrayH\x00\x12=\n\x0f\x63omplex64_array\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.Complex64ArrayH\x00\x12\x39\n\rfloat16_array\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.Float16ArrayH\x00\x12\x39\n\rfloat32_array\x18\x04 \x01(\x0b\x32 .cirq.google.api.v2.Float32ArrayH\x00\x12\x39\n\rfloat64_array\x18\x05 \x01(\x0b\x32 .cirq.google.api.v2.Float64ArrayH\x00\x12\x35\n\x0bint64_array\x18\x06 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int64ArrayH\x00\x12\x35\n\x0bint32_array\x18\x07 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int32ArrayH\x00\x12\x35\n\x0bint16_array\x18\x08 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int16ArrayH\x00\x12\x33\n\nint8_array\x18\t \x01(\x0b\x32\x1d.cirq.google.api.v2.Int8ArrayH\x00\x12\x35\n\x0buint8_array\x18\n \x01(\x0b\x32\x1e.cirq.google.api.v2.UInt8ArrayH\x00\x12\x31\n\tbit_array\x18\x0b \x01(\x0b\x32\x1c.cirq.google.api.v2.BitArrayH\x00\x42\x05\n\x03\x61rr\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xc1\x03\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\x12\x32\n\x0crepeat_until\x18\x06 \x01(\x0b\x32\x17.cirq.google.api.v2.ArgH\x00\x88\x01\x01\x12/\n\x0e\x63onditioned_on\x18\x07 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\x12\x1a\n\x12use_repetition_ids\x18\x08 \x01(\x08\x42\x0f\n\r_repeat_until\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"P\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x03(\t\x12\x12\n\x05index\x18\x03 \x01(\x05H\x00\x88\x01\x01\x42\x08\n\x06_index\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"C\n\x15\x46unctionInterpolation\x12\x14\n\x08x_values\x18\x01 \x03(\x02\x42\x02\x10\x01\x12\x14\n\x08y_values\x18\x02 \x03(\x02\x42\x02\x10\x01\"k\n\tCustomArg\x12P\n\x1b\x66unction_interpolation_data\x18\x01 \x01(\x0b\x32).cirq.google.api.v2.FunctionInterpolationH\x00\x42\x0c\n\ncustom_arg\"\xe6\x02\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x12\x45\n\x0b\x63ustom_args\x18\x05 \x03(\x0b\x32\x30.cirq.google.api.v2.InternalGate.CustomArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x1aP\n\x0f\x43ustomArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.CustomArg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xab\x01\n\tResetGate\x12\x12\n\nreset_type\x18\x01 \x01(\t\x12?\n\targuments\x18\x02 \x03(\x0b\x32,.cirq.google.api.v2.ResetGate.ArgumentsEntry\x1aI\n\x0e\x41rgumentsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\x1a!cirq_google/api/v2/ndarrays.proto\"\xaf\x01\n\x07Program\x12\x32\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.LanguageB\x02\x18\x01\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07programJ\x04\x08\x03\x10\x04\"\xaf\x02\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x12\x32\n\x0cmoment_value\x18\x04 \x01(\x0b\x32\x1a.cirq.google.api.v2.MomentH\x00\x12\x38\n\x0foperation_value\x18\x05 \x01(\x0b\x32\x1d.cirq.google.api.v2.OperationH\x00\x12,\n\ttag_value\x18\x06 \x01(\x0b\x32\x17.cirq.google.api.v2.TagH\x00\x42\r\n\x0b\x63onst_value\"\xec\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\x12\x16\n\x0emoment_indices\x18\x03 \x03(\x05\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"\x9e\x01\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\x12\x19\n\x11operation_indices\x18\x04 \x03(\x05J\x04\x08\x03\x10\x04\"C\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12!\n\x15\x61rg_function_language\x18\x02 \x01(\tB\x02\x18\x01\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x99\x01\n\rISwapLikeGate\x12I\n\roriginal_gate\x18\x01 \x01(\x0e\x32\x32.cirq.google.api.v2.ISwapLikeGate.OriginalCirqGate\"=\n\x10OriginalCirqGate\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0c\n\x08SYCAMORE\x10\x01\x12\n\n\x06WILLOW\x10\x02\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\\\n\x13\x44\x65polarizingChannel\x12\x31\n\x0bprobability\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x12\n\nnum_qubits\x18\x02 \x01(\x05\"w\n\x11RandomGateChannel\x12\x31\n\x0bprobability\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12/\n\x08sub_gate\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\"\xab\x01\n\x0cNoiseChannel\x12\x46\n\x13\x64\x65polarizingchannel\x18\x01 \x01(\x0b\x32\'.cirq.google.api.v2.DepolarizingChannelH\x00\x12\x42\n\x11randomgatechannel\x18\x02 \x01(\x0b\x32%.cirq.google.api.v2.RandomGateChannelH\x00\x42\x0f\n\rchannel_value\"\xa1\n\n\tOperation\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x32\n\tresetgate\x18\x18 \x01(\x0b\x32\x1d.cirq.google.api.v2.ResetGateH\x00\x12:\n\riswaplikegate\x18\x1a \x01(\x0b\x32!.cirq.google.api.v2.ISwapLikeGateH\x00\x12\x38\n\x0cnoisechannel\x18\x1b \x01(\x0b\x32 .cirq.google.api.v2.NoiseChannelH\x00\x12-\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.QubitB\x02\x18\x01\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x12\x13\n\x0btag_indices\x18\x17 \x03(\x05\x12/\n\x0e\x63onditioned_on\x18\x19 \x03(\x0b\x32\x17.cirq.google.api.v2.ArgB\x0c\n\ngate_valueB\x07\n\x05tokenJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"\xb6\x03\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x12\x30\n\x07no_sync\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.NoSyncTagH\x00\x12\x38\n\x0bphase_match\x18\x03 \x01(\x0b\x32!.cirq.google.api.v2.PhaseMatchTagH\x00\x12\x36\n\nphysical_z\x18\x04 \x01(\x0b\x32 .cirq.google.api.v2.PhysicalZTagH\x00\x12@\n\x0f\x63lassical_state\x18\x05 \x01(\x0b\x32%.cirq.google.api.v2.ClassicalStateTagH\x00\x12=\n\x0e\x66sim_via_model\x18\x07 \x01(\x0b\x32#.cirq.google.api.v2.FSimViaModelTagH\x00\x12\x37\n\x0cinternal_tag\x18\x08 \x01(\x0b\x32\x1f.cirq.google.api.v2.InternalTagH\x00\x42\x05\n\x03tag\"\x0f\n\rPhaseMatchTag\"\x0e\n\x0cPhysicalZTag\"\x13\n\x11\x43lassicalStateTag\"\x11\n\x0f\x46SimViaModelTag\"\x84\x01\n\tNoSyncTag\x12\x11\n\x07reverse\x18\x01 \x01(\x05H\x00\x12!\n\x17remove_all_syncs_before\x18\x02 \x01(\x08H\x00\x12\x11\n\x07\x66orward\x18\x03 \x01(\x05H\x01\x12 \n\x16remove_all_syncs_after\x18\x04 \x01(\x08H\x01\x42\x05\n\x03revB\x05\n\x03\x66wd\"\xd5\x02\n\x0bInternalTag\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12\x13\n\x0btag_package\x18\x02 \x01(\t\x12>\n\x08tag_args\x18\x03 \x03(\x0b\x32,.cirq.google.api.v2.InternalTag.TagArgsEntry\x12\x44\n\x0b\x63ustom_args\x18\x04 \x03(\x0b\x32/.cirq.google.api.v2.InternalTag.CustomArgsEntry\x1aG\n\x0cTagArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x1aP\n\x0f\x43ustomArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.CustomArg:\x02\x38\x01\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\xdb\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x12=\n\x0fmeasurement_key\x18\x05 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKeyH\x00\x42\x05\n\x03\x61rg\"\xc4\x04\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x12\x14\n\nbool_value\x18\t \x01(\x08H\x00\x12\x15\n\x0b\x62ytes_value\x18\n \x01(\x0cH\x00\x12\x34\n\rcomplex_value\x18\x0b \x01(\x0b\x32\x1b.cirq.google.api.v2.ComplexH\x00\x12\x30\n\x0btuple_value\x18\x0c \x01(\x0b\x32\x19.cirq.google.api.v2.TupleH\x00\x12\x34\n\rndarray_value\x18\r \x01(\x0b\x32\x1b.cirq.google.api.v2.NDArrayH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"\xbd\x01\n\x05Tuple\x12=\n\rsequence_type\x18\x01 \x01(\x0e\x32&.cirq.google.api.v2.Tuple.SequenceType\x12\'\n\x06values\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"L\n\x0cSequenceType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x08\n\x04LIST\x10\x01\x12\t\n\x05TUPLE\x10\x02\x12\x07\n\x03SET\x10\x03\x12\r\n\tFROZENSET\x10\x04\"1\n\x07\x43omplex\x12\x12\n\nreal_value\x18\x01 \x01(\x01\x12\x12\n\nimag_value\x18\x02 \x01(\x01\"\x85\x05\n\x07NDArray\x12?\n\x10\x63omplex128_array\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.Complex128ArrayH\x00\x12=\n\x0f\x63omplex64_array\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.Complex64ArrayH\x00\x12\x39\n\rfloat16_array\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.Float16ArrayH\x00\x12\x39\n\rfloat32_array\x18\x04 \x01(\x0b\x32 .cirq.google.api.v2.Float32ArrayH\x00\x12\x39\n\rfloat64_array\x18\x05 \x01(\x0b\x32 .cirq.google.api.v2.Float64ArrayH\x00\x12\x35\n\x0bint64_array\x18\x06 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int64ArrayH\x00\x12\x35\n\x0bint32_array\x18\x07 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int32ArrayH\x00\x12\x35\n\x0bint16_array\x18\x08 \x01(\x0b\x32\x1e.cirq.google.api.v2.Int16ArrayH\x00\x12\x33\n\nint8_array\x18\t \x01(\x0b\x32\x1d.cirq.google.api.v2.Int8ArrayH\x00\x12\x35\n\x0buint8_array\x18\n \x01(\x0b\x32\x1e.cirq.google.api.v2.UInt8ArrayH\x00\x12\x31\n\tbit_array\x18\x0b \x01(\x0b\x32\x1c.cirq.google.api.v2.BitArrayH\x00\x42\x05\n\x03\x61rr\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xc1\x03\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\x12\x32\n\x0crepeat_until\x18\x06 \x01(\x0b\x32\x17.cirq.google.api.v2.ArgH\x00\x88\x01\x01\x12/\n\x0e\x63onditioned_on\x18\x07 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\x12\x1a\n\x12use_repetition_ids\x18\x08 \x01(\x08\x42\x0f\n\r_repeat_until\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"P\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x03(\t\x12\x12\n\x05index\x18\x03 \x01(\x05H\x00\x88\x01\x01\x42\x08\n\x06_index\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"C\n\x15\x46unctionInterpolation\x12\x14\n\x08x_values\x18\x01 \x03(\x02\x42\x02\x10\x01\x12\x14\n\x08y_values\x18\x02 \x03(\x02\x42\x02\x10\x01\"k\n\tCustomArg\x12P\n\x1b\x66unction_interpolation_data\x18\x01 \x01(\x0b\x32).cirq.google.api.v2.FunctionInterpolationH\x00\x42\x0c\n\ncustom_arg\"\xe6\x02\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x12\x45\n\x0b\x63ustom_args\x18\x05 \x03(\x0b\x32\x30.cirq.google.api.v2.InternalGate.CustomArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x1aP\n\x0f\x43ustomArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.cirq.google.api.v2.CustomArg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xab\x01\n\tResetGate\x12\x12\n\nreset_type\x18\x01 \x01(\t\x12?\n\targuments\x18\x02 \x03(\x0b\x32,.cirq.google.api.v2.ResetGate.ArgumentsEntry\x1aI\n\x0e\x41rgumentsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -84,96 +84,102 @@ _globals['_MEASUREMENTGATE']._serialized_end=2190 _globals['_WAITGATE']._serialized_start=2192 _globals['_WAITGATE']._serialized_end=2256 - _globals['_OPERATION']._serialized_start=2259 - _globals['_OPERATION']._serialized_end=3514 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3516 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3576 - _globals['_TAG']._serialized_start=3579 - _globals['_TAG']._serialized_end=4017 - _globals['_PHASEMATCHTAG']._serialized_start=4019 - _globals['_PHASEMATCHTAG']._serialized_end=4034 - _globals['_PHYSICALZTAG']._serialized_start=4036 - _globals['_PHYSICALZTAG']._serialized_end=4050 - _globals['_CLASSICALSTATETAG']._serialized_start=4052 - _globals['_CLASSICALSTATETAG']._serialized_end=4071 - _globals['_FSIMVIAMODELTAG']._serialized_start=4073 - _globals['_FSIMVIAMODELTAG']._serialized_end=4090 - _globals['_NOSYNCTAG']._serialized_start=4093 - _globals['_NOSYNCTAG']._serialized_end=4225 - _globals['_INTERNALTAG']._serialized_start=4228 - _globals['_INTERNALTAG']._serialized_end=4569 - _globals['_INTERNALTAG_TAGARGSENTRY']._serialized_start=4416 - _globals['_INTERNALTAG_TAGARGSENTRY']._serialized_end=4487 - _globals['_INTERNALTAG_CUSTOMARGSENTRY']._serialized_start=4489 - _globals['_INTERNALTAG_CUSTOMARGSENTRY']._serialized_end=4569 - _globals['_GATE']._serialized_start=4571 - _globals['_GATE']._serialized_end=4589 - _globals['_QUBIT']._serialized_start=4591 - _globals['_QUBIT']._serialized_end=4610 - _globals['_ARG']._serialized_start=4613 - _globals['_ARG']._serialized_end=4832 - _globals['_ARGVALUE']._serialized_start=4835 - _globals['_ARGVALUE']._serialized_end=5415 - _globals['_REPEATEDINT64']._serialized_start=5417 - _globals['_REPEATEDINT64']._serialized_end=5448 - _globals['_REPEATEDDOUBLE']._serialized_start=5450 - _globals['_REPEATEDDOUBLE']._serialized_end=5482 - _globals['_REPEATEDSTRING']._serialized_start=5484 - _globals['_REPEATEDSTRING']._serialized_end=5516 - _globals['_REPEATEDBOOLEAN']._serialized_start=5518 - _globals['_REPEATEDBOOLEAN']._serialized_end=5551 - _globals['_TUPLE']._serialized_start=5554 - _globals['_TUPLE']._serialized_end=5743 - _globals['_TUPLE_SEQUENCETYPE']._serialized_start=5667 - _globals['_TUPLE_SEQUENCETYPE']._serialized_end=5743 - _globals['_COMPLEX']._serialized_start=5745 - _globals['_COMPLEX']._serialized_end=5794 - _globals['_NDARRAY']._serialized_start=5797 - _globals['_NDARRAY']._serialized_end=6442 - _globals['_ARGFUNCTION']._serialized_start=6444 - _globals['_ARGFUNCTION']._serialized_end=6510 - _globals['_CIRCUITOPERATION']._serialized_start=6513 - _globals['_CIRCUITOPERATION']._serialized_end=6962 - _globals['_REPETITIONSPECIFICATION']._serialized_start=6965 - _globals['_REPETITIONSPECIFICATION']._serialized_end=7153 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=7105 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=7133 - _globals['_QUBITMAPPING']._serialized_start=7156 - _globals['_QUBITMAPPING']._serialized_end=7328 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=7234 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=7328 - _globals['_MEASUREMENTKEY']._serialized_start=7330 - _globals['_MEASUREMENTKEY']._serialized_end=7410 - _globals['_MEASUREMENTKEYMAPPING']._serialized_start=7413 - _globals['_MEASUREMENTKEYMAPPING']._serialized_end=7639 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=7518 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=7639 - _globals['_ARGMAPPING']._serialized_start=7642 - _globals['_ARGMAPPING']._serialized_end=7802 - _globals['_ARGMAPPING_ARGENTRY']._serialized_start=7714 - _globals['_ARGMAPPING_ARGENTRY']._serialized_end=7802 - _globals['_FUNCTIONINTERPOLATION']._serialized_start=7804 - _globals['_FUNCTIONINTERPOLATION']._serialized_end=7871 - _globals['_CUSTOMARG']._serialized_start=7873 - _globals['_CUSTOMARG']._serialized_end=7980 - _globals['_INTERNALGATE']._serialized_start=7983 - _globals['_INTERNALGATE']._serialized_end=8341 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=8187 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=8259 - _globals['_INTERNALGATE_CUSTOMARGSENTRY']._serialized_start=4489 - _globals['_INTERNALGATE_CUSTOMARGSENTRY']._serialized_end=4569 - _globals['_COUPLERPULSEGATE']._serialized_start=8344 - _globals['_COUPLERPULSEGATE']._serialized_end=8816 - _globals['_CLIFFORDTABLEAU']._serialized_start=8819 - _globals['_CLIFFORDTABLEAU']._serialized_end=8958 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=8960 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=9039 - _globals['_IDENTITYGATE']._serialized_start=9041 - _globals['_IDENTITYGATE']._serialized_end=9074 - _globals['_HPOWGATE']._serialized_start=9076 - _globals['_HPOWGATE']._serialized_end=9134 - _globals['_RESETGATE']._serialized_start=9137 - _globals['_RESETGATE']._serialized_end=9308 - _globals['_RESETGATE_ARGUMENTSENTRY']._serialized_start=9235 - _globals['_RESETGATE_ARGUMENTSENTRY']._serialized_end=9308 + _globals['_DEPOLARIZINGCHANNEL']._serialized_start=2258 + _globals['_DEPOLARIZINGCHANNEL']._serialized_end=2350 + _globals['_RANDOMGATECHANNEL']._serialized_start=2352 + _globals['_RANDOMGATECHANNEL']._serialized_end=2471 + _globals['_NOISECHANNEL']._serialized_start=2474 + _globals['_NOISECHANNEL']._serialized_end=2645 + _globals['_OPERATION']._serialized_start=2648 + _globals['_OPERATION']._serialized_end=3961 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3963 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=4023 + _globals['_TAG']._serialized_start=4026 + _globals['_TAG']._serialized_end=4464 + _globals['_PHASEMATCHTAG']._serialized_start=4466 + _globals['_PHASEMATCHTAG']._serialized_end=4481 + _globals['_PHYSICALZTAG']._serialized_start=4483 + _globals['_PHYSICALZTAG']._serialized_end=4497 + _globals['_CLASSICALSTATETAG']._serialized_start=4499 + _globals['_CLASSICALSTATETAG']._serialized_end=4518 + _globals['_FSIMVIAMODELTAG']._serialized_start=4520 + _globals['_FSIMVIAMODELTAG']._serialized_end=4537 + _globals['_NOSYNCTAG']._serialized_start=4540 + _globals['_NOSYNCTAG']._serialized_end=4672 + _globals['_INTERNALTAG']._serialized_start=4675 + _globals['_INTERNALTAG']._serialized_end=5016 + _globals['_INTERNALTAG_TAGARGSENTRY']._serialized_start=4863 + _globals['_INTERNALTAG_TAGARGSENTRY']._serialized_end=4934 + _globals['_INTERNALTAG_CUSTOMARGSENTRY']._serialized_start=4936 + _globals['_INTERNALTAG_CUSTOMARGSENTRY']._serialized_end=5016 + _globals['_GATE']._serialized_start=5018 + _globals['_GATE']._serialized_end=5036 + _globals['_QUBIT']._serialized_start=5038 + _globals['_QUBIT']._serialized_end=5057 + _globals['_ARG']._serialized_start=5060 + _globals['_ARG']._serialized_end=5279 + _globals['_ARGVALUE']._serialized_start=5282 + _globals['_ARGVALUE']._serialized_end=5862 + _globals['_REPEATEDINT64']._serialized_start=5864 + _globals['_REPEATEDINT64']._serialized_end=5895 + _globals['_REPEATEDDOUBLE']._serialized_start=5897 + _globals['_REPEATEDDOUBLE']._serialized_end=5929 + _globals['_REPEATEDSTRING']._serialized_start=5931 + _globals['_REPEATEDSTRING']._serialized_end=5963 + _globals['_REPEATEDBOOLEAN']._serialized_start=5965 + _globals['_REPEATEDBOOLEAN']._serialized_end=5998 + _globals['_TUPLE']._serialized_start=6001 + _globals['_TUPLE']._serialized_end=6190 + _globals['_TUPLE_SEQUENCETYPE']._serialized_start=6114 + _globals['_TUPLE_SEQUENCETYPE']._serialized_end=6190 + _globals['_COMPLEX']._serialized_start=6192 + _globals['_COMPLEX']._serialized_end=6241 + _globals['_NDARRAY']._serialized_start=6244 + _globals['_NDARRAY']._serialized_end=6889 + _globals['_ARGFUNCTION']._serialized_start=6891 + _globals['_ARGFUNCTION']._serialized_end=6957 + _globals['_CIRCUITOPERATION']._serialized_start=6960 + _globals['_CIRCUITOPERATION']._serialized_end=7409 + _globals['_REPETITIONSPECIFICATION']._serialized_start=7412 + _globals['_REPETITIONSPECIFICATION']._serialized_end=7600 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=7552 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=7580 + _globals['_QUBITMAPPING']._serialized_start=7603 + _globals['_QUBITMAPPING']._serialized_end=7775 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=7681 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=7775 + _globals['_MEASUREMENTKEY']._serialized_start=7777 + _globals['_MEASUREMENTKEY']._serialized_end=7857 + _globals['_MEASUREMENTKEYMAPPING']._serialized_start=7860 + _globals['_MEASUREMENTKEYMAPPING']._serialized_end=8086 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=7965 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=8086 + _globals['_ARGMAPPING']._serialized_start=8089 + _globals['_ARGMAPPING']._serialized_end=8249 + _globals['_ARGMAPPING_ARGENTRY']._serialized_start=8161 + _globals['_ARGMAPPING_ARGENTRY']._serialized_end=8249 + _globals['_FUNCTIONINTERPOLATION']._serialized_start=8251 + _globals['_FUNCTIONINTERPOLATION']._serialized_end=8318 + _globals['_CUSTOMARG']._serialized_start=8320 + _globals['_CUSTOMARG']._serialized_end=8427 + _globals['_INTERNALGATE']._serialized_start=8430 + _globals['_INTERNALGATE']._serialized_end=8788 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=8634 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=8706 + _globals['_INTERNALGATE_CUSTOMARGSENTRY']._serialized_start=4936 + _globals['_INTERNALGATE_CUSTOMARGSENTRY']._serialized_end=5016 + _globals['_COUPLERPULSEGATE']._serialized_start=8791 + _globals['_COUPLERPULSEGATE']._serialized_end=9263 + _globals['_CLIFFORDTABLEAU']._serialized_start=9266 + _globals['_CLIFFORDTABLEAU']._serialized_end=9405 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=9407 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=9486 + _globals['_IDENTITYGATE']._serialized_start=9488 + _globals['_IDENTITYGATE']._serialized_end=9521 + _globals['_HPOWGATE']._serialized_start=9523 + _globals['_HPOWGATE']._serialized_end=9581 + _globals['_RESETGATE']._serialized_start=9584 + _globals['_RESETGATE']._serialized_end=9755 + _globals['_RESETGATE_ARGUMENTSENTRY']._serialized_start=9682 + _globals['_RESETGATE_ARGUMENTSENTRY']._serialized_end=9755 # @@protoc_insertion_point(module_scope) diff --git a/cirq-google/cirq_google/api/v2/program_pb2.pyi b/cirq-google/cirq_google/api/v2/program_pb2.pyi index bbe7c2f43ce..d47dc4be301 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/program_pb2.pyi @@ -546,10 +546,84 @@ class WaitGate(google.protobuf.message.Message): global___WaitGate = WaitGate +@typing.final +class DepolarizingChannel(google.protobuf.message.Message): + """Representation of cirq.DepolarizingChannel""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + PROBABILITY_FIELD_NUMBER: builtins.int + NUM_QUBITS_FIELD_NUMBER: builtins.int + num_qubits: builtins.int + @property + def probability(self) -> global___FloatArg: ... + def __init__( + self, + *, + probability: global___FloatArg | None = ..., + num_qubits: builtins.int = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["probability", b"probability"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["num_qubits", b"num_qubits", "probability", b"probability"]) -> None: ... + +global___DepolarizingChannel = DepolarizingChannel + +@typing.final +class RandomGateChannel(google.protobuf.message.Message): + """Representation of cirq.RandomGateChannel""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + PROBABILITY_FIELD_NUMBER: builtins.int + SUB_GATE_FIELD_NUMBER: builtins.int + @property + def probability(self) -> global___FloatArg: ... + @property + def sub_gate(self) -> global___Operation: ... + def __init__( + self, + *, + probability: global___FloatArg | None = ..., + sub_gate: global___Operation | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["probability", b"probability", "sub_gate", b"sub_gate"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["probability", b"probability", "sub_gate", b"sub_gate"]) -> None: ... + +global___RandomGateChannel = RandomGateChannel + +@typing.final +class NoiseChannel(google.protobuf.message.Message): + """Representation of noisy channels + These should only be used for serialization + of noisy circuits for simulation. + These channels would generally not be supported + by hardware. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + DEPOLARIZINGCHANNEL_FIELD_NUMBER: builtins.int + RANDOMGATECHANNEL_FIELD_NUMBER: builtins.int + @property + def depolarizingchannel(self) -> global___DepolarizingChannel: ... + @property + def randomgatechannel(self) -> global___RandomGateChannel: ... + def __init__( + self, + *, + depolarizingchannel: global___DepolarizingChannel | None = ..., + randomgatechannel: global___RandomGateChannel | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["channel_value", b"channel_value", "depolarizingchannel", b"depolarizingchannel", "randomgatechannel", b"randomgatechannel"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["channel_value", b"channel_value", "depolarizingchannel", b"depolarizingchannel", "randomgatechannel", b"randomgatechannel"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["channel_value", b"channel_value"]) -> typing.Literal["depolarizingchannel", "randomgatechannel"] | None: ... + +global___NoiseChannel = NoiseChannel + @typing.final class Operation(google.protobuf.message.Message): """An operation acts on a set of qubits. - next available id = 27 + next available id = 28 """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -571,6 +645,7 @@ class Operation(google.protobuf.message.Message): SINGLEQUBITCLIFFORDGATE_FIELD_NUMBER: builtins.int RESETGATE_FIELD_NUMBER: builtins.int ISWAPLIKEGATE_FIELD_NUMBER: builtins.int + NOISECHANNEL_FIELD_NUMBER: builtins.int QUBITS_FIELD_NUMBER: builtins.int QUBIT_CONSTANT_INDEX_FIELD_NUMBER: builtins.int TOKEN_VALUE_FIELD_NUMBER: builtins.int @@ -615,6 +690,8 @@ class Operation(google.protobuf.message.Message): @property def iswaplikegate(self) -> global___ISwapLikeGate: ... @property + def noisechannel(self) -> global___NoiseChannel: ... + @property def qubits(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Qubit]: """Which qubits the operation acts on. Operations should populate one of the following two @@ -661,6 +738,7 @@ class Operation(google.protobuf.message.Message): singlequbitcliffordgate: global___SingleQubitCliffordGate | None = ..., resetgate: global___ResetGate | None = ..., iswaplikegate: global___ISwapLikeGate | None = ..., + noisechannel: global___NoiseChannel | None = ..., qubits: collections.abc.Iterable[global___Qubit] | None = ..., qubit_constant_index: collections.abc.Iterable[builtins.int] | None = ..., token_value: builtins.str = ..., @@ -669,10 +747,10 @@ class Operation(google.protobuf.message.Message): tag_indices: collections.abc.Iterable[builtins.int] | None = ..., conditioned_on: collections.abc.Iterable[global___Arg] | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswaplikegate", b"iswaplikegate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "resetgate", b"resetgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["conditioned_on", b"conditioned_on", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswaplikegate", b"iswaplikegate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "resetgate", b"resetgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "tag_indices", b"tag_indices", "tags", b"tags", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... + def HasField(self, field_name: typing.Literal["couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswaplikegate", b"iswaplikegate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "noisechannel", b"noisechannel", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "resetgate", b"resetgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["conditioned_on", b"conditioned_on", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswaplikegate", b"iswaplikegate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "noisechannel", b"noisechannel", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "resetgate", b"resetgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "tag_indices", b"tag_indices", "tags", b"tags", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... @typing.overload - def WhichOneof(self, oneof_group: typing.Literal["gate_value", b"gate_value"]) -> typing.Literal["xpowgate", "ypowgate", "zpowgate", "phasedxpowgate", "phasedxzgate", "czpowgate", "fsimgate", "iswappowgate", "measurementgate", "waitgate", "internalgate", "couplerpulsegate", "identitygate", "hpowgate", "singlequbitcliffordgate", "resetgate", "iswaplikegate"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["gate_value", b"gate_value"]) -> typing.Literal["xpowgate", "ypowgate", "zpowgate", "phasedxpowgate", "phasedxzgate", "czpowgate", "fsimgate", "iswappowgate", "measurementgate", "waitgate", "internalgate", "couplerpulsegate", "identitygate", "hpowgate", "singlequbitcliffordgate", "resetgate", "iswaplikegate", "noisechannel"] | None: ... @typing.overload def WhichOneof(self, oneof_group: typing.Literal["token", b"token"]) -> typing.Literal["token_value", "token_constant_index"] | None: ... diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index 61db4eb30a0..61764ef90fa 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -275,6 +275,20 @@ def _serialize_gate_op( arg_func_langs.float_arg_to_proto( gate.q1_detune_mhz, out=msg.couplerpulsegate.q1_detune_mhz ) + elif isinstance(gate, cirq.DepolarizingChannel): + arg_func_langs.float_arg_to_proto( + gate.p, out=msg.noisechannel.depolarizingchannel.probability + ) + elif isinstance(gate, cirq.RandomGateChannel): + arg_func_langs.float_arg_to_proto( + gate.probability, out=msg.noisechannel.randomgatechannel.probability + ) + self._serialize_gate_op( + gate.sub_gate(*op.qubits), + msg=msg.noisechannel.randomgatechannel.sub_gate, + constants=constants, + raw_constants=raw_constants, + ) else: raise ValueError(f'Cannot serialize op {op!r} of type {type(gate)}') @@ -730,6 +744,36 @@ def _deserialize_gate_op( or 0.0, ) op = gate(*qubits) + elif which_gate_type == 'noisechannel': + which_channel_type = operation_proto.noisechannel.WhichOneof('channel_value') + if which_channel_type == 'depolarizingchannel': + p = arg_func_langs.float_arg_from_proto( + operation_proto.noisechannel.depolarizingchannel.probability + ) + if not isinstance(p, float): + raise ValueError( + f"Depolarizing noise probability {p} " "cannot be symbol or None" + ) # pragma: nocover + op = cirq.DepolarizingChannel(p=p)(*qubits) + elif which_channel_type == 'randomgatechannel': + p = arg_func_langs.float_arg_from_proto( + operation_proto.noisechannel.randomgatechannel.probability + ) + sub_gate = self._deserialize_gate_op( + operation_proto.noisechannel.randomgatechannel.sub_gate, + constants=constants, + deserialized_constants=deserialized_constants, + ) + if sub_gate is None or sub_gate.gate is None: + raise ValueError( + "Not a valid gate for RandomGateChannel: " f"{operation_proto}" + ) # pragma: nocover + op = cirq.RandomGateChannel(probability=p, sub_gate=sub_gate.gate)(*qubits) + else: + raise ValueError( + f'Unsupported serialized noise channel with type "{which_channel_type}".' + f'\n\noperation_proto:\n{operation_proto}' + ) # pragma: nocover else: raise ValueError( f'Unsupported serialized gate with type "{which_gate_type}".' diff --git a/cirq-google/cirq_google/serialization/circuit_serializer_test.py b/cirq-google/cirq_google/serialization/circuit_serializer_test.py index 86b092dac04..32b779eb3f6 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer_test.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer_test.py @@ -386,6 +386,32 @@ def circuit_proto(json: dict, qubits: list[str]): ), ), (cirq.I(Q0), op_proto({'identitygate': {'qid_shape': [2]}, 'qubit_constant_index': [0]})), + ( + cirq.depolarize(0.5)(Q0), + op_proto( + { + 'noisechannel': {'depolarizingchannel': {'probability': {'float_value': 0.5}}}, + 'qubit_constant_index': [0], + } + ), + ), + ( + cirq.X(Q0).with_probability(0.5), + op_proto( + { + 'noisechannel': { + 'randomgatechannel': { + 'probability': {'float_value': 0.5}, + 'sub_gate': { + 'xpowgate': {'exponent': {'float_value': 1.0}}, + 'qubit_constant_index': [0], + }, + } + }, + 'qubit_constant_index': [0], + } + ), + ), ]