deq-runtime 0.3.0

deq: Real-time Quantum Error Correction Decoding System
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
// This file is @generated by prost-build.
/// a library contains a set of gadget, check-model and error-model types, and an
/// reference logical program that illustrates how to use them
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Library {
    #[prost(string, tag = "1")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "2")]
    pub gadget_types: ::prost::alloc::vec::Vec<GadgetType>,
    /// TODO: rename to CodeType code_types?
    #[prost(message, repeated, tag = "3")]
    pub port_types: ::prost::alloc::vec::Vec<PortType>,
    #[prost(message, repeated, tag = "4")]
    pub check_model_types: ::prost::alloc::vec::Vec<CheckModelType>,
    #[prost(message, repeated, tag = "5")]
    pub error_model_types: ::prost::alloc::vec::Vec<ErrorModelType>,
    /// a reference program to illustrate how to use the gadgets, check models and
    /// error models types; when the logical program is exactly the same as the
    /// input to the compiler, then it's safe to directly run the reference program
    /// which guarantees correct decoding hypergraph construction; otherwise, the
    /// decoding system needs to be more careful about the correctness
    #[prost(message, repeated, tag = "6")]
    pub program: ::prost::alloc::vec::Vec<Instruction>,
    #[prost(message, optional, tag = "7")]
    pub visual_config: ::core::option::Option<super::visualizer::VisualConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Instruction {
    #[prost(oneof = "instruction::Create", tags = "1, 2, 3")]
    pub create: ::core::option::Option<instruction::Create>,
}
/// Nested message and enum types in `Instruction`.
pub mod instruction {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Create {
        #[prost(message, tag = "1")]
        Gadget(super::Gadget),
        #[prost(message, tag = "2")]
        CheckModel(super::CheckModel),
        #[prost(message, tag = "3")]
        ErrorModel(super::ErrorModel),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GadgetType {
    /// globally unique id of the gadget type
    #[prost(uint64, tag = "1")]
    pub gtype: u64,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "4")]
    pub measurements: ::prost::alloc::vec::Vec<gadget_type::Measurement>,
    #[prost(message, repeated, tag = "5")]
    pub inputs: ::prost::alloc::vec::Vec<gadget_type::Port>,
    #[prost(message, repeated, tag = "6")]
    pub outputs: ::prost::alloc::vec::Vec<gadget_type::Port>,
    /// mapping from input logical observable corrections to the output logical
    /// observable correction:
    /// size = |output_observables| rows x |input_observables|+1 columns
    /// (the last column is for the constant term)
    /// the constant term is usually zero, except for a gadget that applies a
    /// virtual logical Pauli gate (no physical gates but only change the
    /// correction propagation)
    #[prost(message, optional, tag = "7")]
    pub correction_propagation: ::core::option::Option<super::util::BitMatrix>,
    #[prost(message, repeated, tag = "8")]
    pub readouts: ::prost::alloc::vec::Vec<gadget_type::Readout>,
    /// mapping from input logical observables to the logical readouts
    /// size = |readouts| rows x |input_observables|+1 columns
    /// (the last column is for the constant term)
    #[prost(message, optional, tag = "9")]
    pub readout_propagation: ::core::option::Option<super::util::BitMatrix>,
    /// mapping from logical readouts to output observables (feed-forward Pauli)
    /// size = |output_observables| rows x |readouts| columns
    /// formerly named "conditional_correction"
    #[prost(message, optional, tag = "10")]
    pub logical_correction: ::core::option::Option<super::util::BitMatrix>,
    /// mapping from internal measurements to output observable corrections
    /// size = |output_observables| rows x |measurements| columns
    /// This encodes how physical measurement outcomes update the Pauli frame,
    /// capturing destabilizer contributions from preparation gadgets
    #[prost(message, optional, tag = "15")]
    pub physical_correction: ::core::option::Option<super::util::BitMatrix>,
    /// the mesh of the gadget object (not individual gate but the outline)
    #[prost(message, repeated, tag = "12")]
    pub mesh: ::prost::alloc::vec::Vec<super::visualizer::Mesh>,
    #[prost(message, optional, tag = "13")]
    pub realization: ::core::option::Option<super::visualizer::Realization>,
    /// Whether this gadget type counts as a "free hop" for window decoding.
    /// Free-hop gadgets contribute 0 to the hop distance during window
    /// exploration. When not set, the value is determined by whether the gadget
    /// has physical measurements (is_free_hop = measurements is empty).
    /// When set explicitly, the user-provided value is used.
    #[prost(bool, optional, tag = "14")]
    pub is_free_hop: ::core::option::Option<bool>,
}
/// Nested message and enum types in `GadgetType`.
pub mod gadget_type {
    /// how many measurements are there; for the decoder, we don't really care
    /// about the details of the measurements: we only need to know how many
    /// measurements to be expected from the physical controller
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Measurement {
        /// the details of the measurement is irrelevant to the decoder
        #[prost(string, tag = "1")]
        pub tag: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "2")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
    }
    /// input ports and output ports
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Port {
        /// refer to the type of port to instantiate
        #[prost(uint64, tag = "1")]
        pub ptype: u64,
        #[prost(string, tag = "2")]
        pub tag: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "3")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
        /// for visualization: map from port support to the gadget support
        #[prost(uint64, repeated, tag = "4")]
        pub support_mapping: ::prost::alloc::vec::Vec<u64>,
    }
    /// logical readouts
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Readout {
        #[prost(string, tag = "1")]
        pub tag: ::prost::alloc::string::String,
        /// all measurements indices are local to the current gadget
        #[prost(uint64, repeated, tag = "2")]
        pub measurement_indices: ::prost::alloc::vec::Vec<u64>,
        /// where to display the readout bit
        #[prost(message, optional, tag = "3")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PortType {
    /// globally unique id of the port type
    #[prost(uint64, tag = "1")]
    pub ptype: u64,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "4")]
    pub observables: ::prost::alloc::vec::Vec<port_type::Observable>,
    #[prost(message, repeated, tag = "5")]
    pub mesh: ::prost::alloc::vec::Vec<super::visualizer::Mesh>,
    #[prost(message, repeated, tag = "6")]
    pub positions: ::prost::alloc::vec::Vec<super::visualizer::Position>,
}
/// Nested message and enum types in `PortType`.
pub mod port_type {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Observable {
        /// the details of the logical observable is irrelevant to the decoder
        #[prost(string, tag = "1")]
        pub tag: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "2")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckModelType {
    #[prost(uint64, tag = "1")]
    pub ctype: u64,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub description: ::prost::alloc::string::String,
    /// the gadget type that this check model can attach to; 0 means "any gadget
    /// type"
    #[prost(uint64, tag = "4")]
    pub gtype: u64,
    #[prost(message, repeated, tag = "5")]
    pub remote_gadgets: ::prost::alloc::vec::Vec<check_model_type::RemoteGadget>,
    #[prost(message, repeated, tag = "7")]
    pub checks: ::prost::alloc::vec::Vec<check_model_type::Check>,
}
/// Nested message and enum types in `CheckModelType`.
pub mod check_model_type {
    /// each check model first declare the list of remote gadgets that it needs
    /// access to; this not only helps batching the remote accesses, but also
    /// allows a decoder implementation to fetch all the required data beforehand
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct RemoteGadget {
        /// the index of the remote gadget to start from; if not provided, it is
        /// relative from the current gadget
        #[prost(uint64, optional, tag = "1")]
        pub previous_remote_gadget: ::core::option::Option<u64>,
        /// setting this to 0 means "any gadget type"
        #[prost(uint64, tag = "4")]
        pub expecting_gtype: u64,
        /// after hopping to the remote gadget, we might want to set a bias of the
        /// measurements so that gadgets with multiple ports can reuse the same check
        /// model simply by setting different biases at runtime
        #[prost(uint64, tag = "5")]
        pub measurement_bias: u64,
        /// optionally, give the remote gadget a name for easier debugging
        #[prost(string, tag = "6")]
        pub tag: ::prost::alloc::string::String,
        /// if the absolute index is provided, we use that directly; note that it is
        /// preferred to use relative address for offline processing because absolute
        /// indexing depends on the context and is harder to understand the
        /// relationship; only runtime tools like JIT compiler should generate them
        #[prost(uint64, optional, tag = "7")]
        pub absolute_gid: ::core::option::Option<u64>,
        /// the relative trajectory to find the target gadget
        /// a check should mostly involve local measurements (no hops)
        #[prost(oneof = "remote_gadget::Port", tags = "2, 3")]
        pub port: ::core::option::Option<remote_gadget::Port>,
    }
    /// Nested message and enum types in `RemoteGadget`.
    pub mod remote_gadget {
        /// the relative trajectory to find the target gadget
        /// a check should mostly involve local measurements (no hops)
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Port {
            #[prost(uint64, tag = "2")]
            Input(u64),
            #[prost(uint64, tag = "3")]
            Output(u64),
        }
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct RemoteMeasurement {
        /// optionally refer to the remote gadget
        #[prost(uint64, optional, tag = "1")]
        pub remote_gadget: ::core::option::Option<u64>,
        /// measurement id within a gadget specified by relative trajectory
        /// local if trajectory is empty; for remote gadgets, the actual index is
        /// measurement_index plus the measurement_bias in the RemoteGadget above
        #[prost(uint64, tag = "2")]
        pub measurement_index: u64,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Check {
        #[prost(string, tag = "1")]
        pub tag: ::prost::alloc::string::String,
        #[prost(message, repeated, tag = "2")]
        pub measurements: ::prost::alloc::vec::Vec<RemoteMeasurement>,
        #[prost(bool, tag = "3")]
        pub naturally_flipped: bool,
        /// optionally specify the position of the check; otherwise computed from the
        /// last measurement it refers to
        #[prost(message, optional, tag = "4")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
        #[prost(string, tag = "5")]
        pub color: ::prost::alloc::string::String,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorModelType {
    #[prost(uint64, tag = "1")]
    pub etype: u64,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub description: ::prost::alloc::string::String,
    /// the check model type that this error model can attach to; 0 means "any
    /// check model type"
    #[prost(uint64, tag = "4")]
    pub ctype: u64,
    #[prost(message, repeated, tag = "5")]
    pub remote_check_models: ::prost::alloc::vec::Vec<
        error_model_type::RemoteCheckModel,
    >,
    #[prost(message, repeated, tag = "6")]
    pub errors: ::prost::alloc::vec::Vec<error_model_type::Error>,
}
/// Nested message and enum types in `ErrorModelType`.
pub mod error_model_type {
    /// each error model first declare the list of remote check models that it need
    /// access to; this not only helps batching the remote accesses, but also
    /// allows a decoder implementation to know which check model needs to be
    /// locked beforehand
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct RemoteCheckModel {
        /// the index of the remote check model to start from; if not provided, it is
        /// relative from the current check model
        #[prost(uint64, optional, tag = "1")]
        pub previous_remote_check_model: ::core::option::Option<u64>,
        /// setting this to 0 means "any check model type"
        #[prost(uint64, tag = "4")]
        pub expecting_ctype: u64,
        /// after hopping to the remote check model, we might want to set a bias of
        /// the checks so that check models with multiple ports can reuse the same
        /// error model simply by setting different biases at runtime
        #[prost(uint64, tag = "5")]
        pub check_bias: u64,
        /// optionally, give the remote check model a name for easier debugging
        #[prost(string, tag = "6")]
        pub tag: ::prost::alloc::string::String,
        /// if the absolute index is provided, we use that directly; note that it is
        /// preferred to use relative address for offline processing because absolute
        /// indexing depends on the context and is harder to understand the
        /// relationship; only runtime tools like JIT compiler should generate them
        #[prost(uint64, optional, tag = "7")]
        pub absolute_cid: ::core::option::Option<u64>,
        /// the relative trajectory to find the target check model
        /// a check should mostly involve local measurements (no hops)
        #[prost(oneof = "remote_check_model::Port", tags = "2, 3")]
        pub port: ::core::option::Option<remote_check_model::Port>,
    }
    /// Nested message and enum types in `RemoteCheckModel`.
    pub mod remote_check_model {
        /// the relative trajectory to find the target check model
        /// a check should mostly involve local measurements (no hops)
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Port {
            #[prost(uint64, tag = "2")]
            Input(u64),
            #[prost(uint64, tag = "3")]
            Output(u64),
        }
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct RemoteCheck {
        /// optionally refer to the remote check model
        #[prost(uint64, optional, tag = "1")]
        pub remote_check_model: ::core::option::Option<u64>,
        /// check id within a check model, the actual index is
        /// check_index plus the check_bias in the RemoteCheckModel above
        #[prost(uint64, tag = "2")]
        pub check_index: u64,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Error {
        #[prost(string, tag = "1")]
        pub tag: ::prost::alloc::string::String,
        #[prost(message, repeated, tag = "2")]
        pub checks: ::prost::alloc::vec::Vec<RemoteCheck>,
        /// the list of logical observables that it flips. The index is local to the
        /// gadget that the error belongs to, and the index is based on the
        /// array that concatenates all the output ports' logical observables
        #[prost(uint64, repeated, tag = "3")]
        pub residual: ::prost::alloc::vec::Vec<u64>,
        /// the list of readouts that it flips. The index is local to the gadget
        #[prost(uint64, repeated, tag = "4")]
        pub readout_flips: ::prost::alloc::vec::Vec<u64>,
        /// the probability of the error happening: between 0 and 1
        #[prost(double, tag = "5")]
        pub probability: f64,
        /// optionally specify the position of the error; otherwise computed from the
        /// average of all the checks it refers to
        #[prost(message, optional, tag = "6")]
        pub relative: ::core::option::Option<super::super::visualizer::Position>,
        #[prost(string, tag = "7")]
        pub color: ::prost::alloc::string::String,
    }
}
/// modifier for bit matrices: supports toggle (XOR) and overwrite semantics
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BitMatrixModifier {
    /// XOR toggle specific bits in the matrix
    #[prost(message, optional, tag = "1")]
    pub toggle: ::core::option::Option<super::util::BitMatrix>,
    /// alternatively, overwrite the entire matrix (applied after toggle)
    #[prost(message, optional, tag = "2")]
    pub overwrite: ::core::option::Option<super::util::BitMatrix>,
}
/// modifier for gadget instances: allows runtime modification of the
/// propagation matrices without creating new gadget types
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GadgetModifier {
    /// modify the correction_propagation matrix
    /// dimension: |output_observables| x (|input_observables| + 1)
    #[prost(message, optional, tag = "1")]
    pub correction_propagation_mod: ::core::option::Option<BitMatrixModifier>,
    /// modify the readout_propagation matrix
    /// dimension: |readouts| x (|input_observables| + 1)
    #[prost(message, optional, tag = "2")]
    pub readout_propagation_mod: ::core::option::Option<BitMatrixModifier>,
    /// modify the logical_correction matrix (logical feed-forward)
    /// dimension: |output_observables| x |readouts|
    #[prost(message, optional, tag = "3")]
    pub logical_correction_mod: ::core::option::Option<BitMatrixModifier>,
    /// apply corrections based on readouts from previous (remote) gadgets
    #[prost(message, optional, tag = "4")]
    pub remote_conditional_correction: ::core::option::Option<
        RemoteConditionalCorrection,
    >,
    /// modify the physical_correction matrix
    /// dimension: |output_observables| x |measurements|
    #[prost(message, optional, tag = "5")]
    pub physical_correction_mod: ::core::option::Option<BitMatrixModifier>,
}
/// Describes how readouts from remote gadgets affect the current gadget's
/// output logical observables. This is only meaningful at runtime and is
/// always empty in offline library definitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoteConditionalCorrection {
    /// The list of remote readouts that this correction depends on.
    /// The order defines the column indices in the correction matrix.
    #[prost(message, repeated, tag = "1")]
    pub remote_readouts: ::prost::alloc::vec::Vec<
        remote_conditional_correction::RemoteReadout,
    >,
    /// Correction matrix mapping remote readouts to output observable corrections.
    /// dimension: |output_observables| rows x |remote_readouts| columns
    #[prost(message, optional, tag = "2")]
    pub correction: ::core::option::Option<super::util::BitMatrix>,
}
/// Nested message and enum types in `RemoteConditionalCorrection`.
pub mod remote_conditional_correction {
    /// Reference to a specific readout from a remote gadget
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct RemoteReadout {
        #[prost(uint64, tag = "1")]
        pub gid: u64,
        #[prost(uint64, tag = "2")]
        pub readout_index: u64,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Gadget {
    /// the gadget type to instantiate
    #[prost(uint64, tag = "1")]
    pub gtype: u64,
    #[prost(string, tag = "2")]
    pub tag: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "3")]
    pub connectors: ::prost::alloc::vec::Vec<gadget::Connector>,
    #[prost(message, optional, tag = "4")]
    pub position: ::core::option::Option<super::visualizer::Position>,
    /// only for visualization: this has no effect on the runtime system; runtime
    /// system will generate gid to serve its own need.
    /// leave this field zero to auto assign gid from 1
    #[prost(uint64, tag = "5")]
    pub gid: u64,
    /// optionally modify the propagation matrices at runtime
    #[prost(message, optional, tag = "6")]
    pub modifier: ::core::option::Option<GadgetModifier>,
}
/// Nested message and enum types in `Gadget`.
pub mod gadget {
    /// connect the input ports to the output ports of existing operations; must
    /// have a length of |gtype.inputs|
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Connector {
        /// the gadget that gives out a port, so that a new gadget can take it as
        /// input
        #[prost(uint64, tag = "1")]
        pub gid: u64,
        #[prost(uint64, tag = "2")]
        pub port: u64,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckModel {
    /// the check model type to instantiate
    #[prost(uint64, tag = "1")]
    pub ctype: u64,
    /// the gadget it attaches to
    #[prost(uint64, tag = "2")]
    pub gid: u64,
    #[prost(string, tag = "3")]
    pub tag: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub modifier: ::core::option::Option<check_model::CheckModelModifier>,
    /// only for visualization: this has no effect on the runtime system; runtime
    /// system will generate cid to serve its own need.
    /// leave this field zero to auto assign cid from 1
    #[prost(uint64, tag = "5")]
    pub cid: u64,
}
/// Nested message and enum types in `CheckModel`.
pub mod check_model {
    /// optionally, it can modify the edge weights and some other reconfigurable
    /// fields
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct CheckModelModifier {
        #[prost(message, repeated, tag = "4")]
        pub reroute_remote_gadgets: ::prost::alloc::vec::Vec<
            check_model_modifier::RerouteRemoteGadget,
        >,
    }
    /// Nested message and enum types in `CheckModelModifier`.
    pub mod check_model_modifier {
        /// we can reroute the remote gadgets; note that this may create new
        /// remote gadgets, and the vector of remote gadgets will be dynamically
        /// extended when needed
        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct RerouteRemoteGadget {
            #[prost(uint64, tag = "1")]
            pub remote_gadget_index: u64,
            #[prost(message, optional, tag = "2")]
            pub value: ::core::option::Option<
                super::super::check_model_type::RemoteGadget,
            >,
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorModel {
    /// the error model type to instantiate
    #[prost(uint64, tag = "1")]
    pub etype: u64,
    /// the check model it attaches to
    #[prost(uint64, tag = "2")]
    pub cid: u64,
    #[prost(string, tag = "3")]
    pub tag: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub modifier: ::core::option::Option<error_model::ErrorModelModifier>,
    /// only for visualization: this has no effect on the runtime system; runtime
    /// system will generate eid to serve its own need.
    /// leave this field zero to auto assign eid from 1
    #[prost(uint64, tag = "5")]
    pub eid: u64,
}
/// Nested message and enum types in `ErrorModel`.
pub mod error_model {
    /// optionally, it can modify the edge weights and some other reconfigurable
    /// fields
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ErrorModelModifier {
        #[prost(message, optional, tag = "1")]
        pub probability_modifier: ::core::option::Option<super::ProbabilityModifier>,
        #[prost(message, repeated, tag = "2")]
        pub reroute_remote_check_models: ::prost::alloc::vec::Vec<
            error_model_modifier::RerouteRemoteCheckModel,
        >,
    }
    /// Nested message and enum types in `ErrorModelModifier`.
    pub mod error_model_modifier {
        /// we can reroute the remote check models; note that this may create new
        /// remote check models, and the vector of remote check models will be
        /// dynamically extended when needed
        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct RerouteRemoteCheckModel {
            #[prost(uint64, tag = "1")]
            pub remote_check_model_index: u64,
            #[prost(message, optional, tag = "2")]
            pub value: ::core::option::Option<
                super::super::error_model_type::RemoteCheckModel,
            >,
        }
    }
}
/// one can modify the probability when instantiate an error model or when
/// loading the outcomes
///
/// these fields are applied sequentially
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProbabilityModifier {
    /// overwrite existing probabilities; the length must be either 0 or equal to
    /// the number of errors in the error model
    #[prost(double, repeated, tag = "1")]
    pub probabilities: ::prost::alloc::vec::Vec<f64>,
    /// sparsely overwrite some probabilities given their indices; we use
    /// separate (packed) array fields for indices and probabilities to save
    /// space, but they should have the same length
    #[prost(uint64, repeated, tag = "2")]
    pub sparse_indices: ::prost::alloc::vec::Vec<u64>,
    #[prost(double, repeated, tag = "3")]
    pub sparse_probabilities: ::prost::alloc::vec::Vec<f64>,
}