Skip to main content

deq_runtime/proto/
deq.bin.rs

1// This file is @generated by prost-build.
2/// a library contains a set of gadget, check-model and error-model types, and a
3/// reference logical program that illustrates how to use them
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Library {
6    #[prost(string, tag = "1")]
7    pub description: ::prost::alloc::string::String,
8    #[prost(message, repeated, tag = "2")]
9    pub gadget_types: ::prost::alloc::vec::Vec<GadgetType>,
10    /// TODO: rename to CodeType code_types?
11    #[prost(message, repeated, tag = "3")]
12    pub port_types: ::prost::alloc::vec::Vec<PortType>,
13    #[prost(message, repeated, tag = "4")]
14    pub check_model_types: ::prost::alloc::vec::Vec<CheckModelType>,
15    #[prost(message, repeated, tag = "5")]
16    pub error_model_types: ::prost::alloc::vec::Vec<ErrorModelType>,
17    /// a reference program to illustrate how to use the gadgets, check models and
18    /// error models types; when the logical program is exactly the same as the
19    /// input to the compiler, then it's safe to directly run the reference program
20    /// which guarantees correct decoding hypergraph construction; otherwise, the
21    /// decoding system needs to be more careful about the correctness
22    #[prost(message, repeated, tag = "6")]
23    pub program: ::prost::alloc::vec::Vec<Instruction>,
24    #[prost(message, optional, tag = "7")]
25    pub visual_config: ::core::option::Option<super::visualizer::VisualConfig>,
26    /// JSON-compatible reference metadata; no effect on the decoding system.
27    /// Values may contain nested objects, arrays, strings, numbers, booleans, and
28    /// null.
29    #[prost(message, optional, tag = "8")]
30    pub metadata: ::core::option::Option<::prost_types::Struct>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct Instruction {
34    #[prost(oneof = "instruction::Create", tags = "1, 2, 3")]
35    pub create: ::core::option::Option<instruction::Create>,
36}
37/// Nested message and enum types in `Instruction`.
38pub mod instruction {
39    #[derive(Clone, PartialEq, ::prost::Oneof)]
40    pub enum Create {
41        #[prost(message, tag = "1")]
42        Gadget(super::Gadget),
43        #[prost(message, tag = "2")]
44        CheckModel(super::CheckModel),
45        #[prost(message, tag = "3")]
46        ErrorModel(super::ErrorModel),
47    }
48}
49#[derive(Clone, PartialEq, ::prost::Message)]
50pub struct GadgetType {
51    /// globally unique id of the gadget type
52    #[prost(uint64, tag = "1")]
53    pub gtype: u64,
54    #[prost(string, tag = "2")]
55    pub name: ::prost::alloc::string::String,
56    #[prost(string, tag = "3")]
57    pub description: ::prost::alloc::string::String,
58    #[prost(message, repeated, tag = "4")]
59    pub measurements: ::prost::alloc::vec::Vec<gadget_type::Measurement>,
60    #[prost(message, repeated, tag = "5")]
61    pub inputs: ::prost::alloc::vec::Vec<gadget_type::Port>,
62    #[prost(message, repeated, tag = "6")]
63    pub outputs: ::prost::alloc::vec::Vec<gadget_type::Port>,
64    /// mapping from input logical observable corrections to the output logical
65    /// observable correction:
66    /// size = |output_observables| rows x |input_observables|+1 columns
67    /// (the last column is for the constant term)
68    /// the constant term is usually zero, except for a gadget that applies a
69    /// virtual logical Pauli gate (no physical gates but only change the
70    /// correction propagation)
71    #[prost(message, optional, tag = "7")]
72    pub correction_propagation: ::core::option::Option<super::util::BitMatrix>,
73    #[prost(message, repeated, tag = "8")]
74    pub readouts: ::prost::alloc::vec::Vec<gadget_type::Readout>,
75    /// mapping from input logical observables to the logical readouts
76    /// size = |readouts| rows x |input_observables|+1 columns
77    /// (the last column is for the constant term)
78    #[prost(message, optional, tag = "9")]
79    pub readout_propagation: ::core::option::Option<super::util::BitMatrix>,
80    /// mapping from logical readouts to output observables (feed-forward Pauli)
81    /// size = |output_observables| rows x |readouts| columns
82    /// formerly named "conditional_correction"
83    #[prost(message, optional, tag = "10")]
84    pub logical_correction: ::core::option::Option<super::util::BitMatrix>,
85    /// mapping from internal measurements to output observable corrections
86    /// size = |output_observables| rows x |measurements| columns
87    /// This encodes how physical measurement outcomes update the Pauli frame,
88    /// capturing destabilizer contributions from preparation gadgets
89    #[prost(message, optional, tag = "15")]
90    pub physical_correction: ::core::option::Option<super::util::BitMatrix>,
91    /// the mesh of the gadget object (not individual gate but the outline)
92    #[prost(message, repeated, tag = "12")]
93    pub mesh: ::prost::alloc::vec::Vec<super::visualizer::Mesh>,
94    #[prost(message, optional, tag = "13")]
95    pub realization: ::core::option::Option<super::visualizer::Realization>,
96    /// Whether this gadget type counts as a "free hop" for window decoding.
97    /// Free-hop gadgets contribute 0 to the hop distance during window
98    /// exploration. When not set, the value is determined by whether the gadget
99    /// has physical measurements (is_free_hop = measurements is empty).
100    /// When set explicitly, the user-provided value is used.
101    #[prost(bool, optional, tag = "14")]
102    pub is_free_hop: ::core::option::Option<bool>,
103    #[prost(message, optional, tag = "16")]
104    pub loss_model: ::core::option::Option<gadget_type::LossModel>,
105}
106/// Nested message and enum types in `GadgetType`.
107pub mod gadget_type {
108    /// how many measurements are there; for the decoder, we don't really care
109    /// about the details of the measurements: we only need to know how many
110    /// measurements to be expected from the physical controller
111    #[derive(Clone, PartialEq, ::prost::Message)]
112    pub struct Measurement {
113        /// the details of the measurement is irrelevant to the decoder
114        #[prost(string, tag = "1")]
115        pub tag: ::prost::alloc::string::String,
116        #[prost(message, optional, tag = "2")]
117        pub relative: ::core::option::Option<super::super::visualizer::Position>,
118    }
119    /// input ports and output ports
120    #[derive(Clone, PartialEq, ::prost::Message)]
121    pub struct Port {
122        /// refer to the type of port to instantiate
123        #[prost(uint64, tag = "1")]
124        pub ptype: u64,
125        #[prost(string, tag = "2")]
126        pub tag: ::prost::alloc::string::String,
127        #[prost(message, optional, tag = "3")]
128        pub relative: ::core::option::Option<super::super::visualizer::Position>,
129        /// for visualization: map from port support to the gadget support
130        #[prost(uint64, repeated, tag = "4")]
131        pub support_mapping: ::prost::alloc::vec::Vec<u64>,
132    }
133    /// logical readouts
134    #[derive(Clone, PartialEq, ::prost::Message)]
135    pub struct Readout {
136        #[prost(string, tag = "1")]
137        pub tag: ::prost::alloc::string::String,
138        /// all measurements indices are local to the current gadget
139        #[prost(uint64, repeated, tag = "2")]
140        pub measurement_indices: ::prost::alloc::vec::Vec<u64>,
141        /// where to display the readout bit
142        #[prost(message, optional, tag = "3")]
143        pub relative: ::core::option::Option<super::super::visualizer::Position>,
144    }
145    /// Static atom-loss template for this gadget type: the declared loss sites in
146    /// its body, their local heralds and Pauli-envelope generators, within-gadget
147    /// continuation links, and the physical qubits on which a loss leaves or
148    /// enters the gadget. Propagation is captured inline until it reaches another
149    /// declared loss site. Left unset for loss-free gadget types.
150    ///
151    /// Generators are referenced by index into `ErrorModelType.errors` of the
152    /// FIRST error model attached to this gadget (`attaching_eid_vec\[0\]`, i.e. the
153    /// first one created against its check model). That is the error model the
154    /// gadget type was compiled with: the JIT compiler emits exactly one bin error
155    /// per `deq.jit.JitGadgetType.errors` entry, in order, so the two index
156    /// domains coincide.
157    ///
158    /// Attaching further error models is allowed and is the normal way to add
159    /// extra noise; the loss model simply never references them, and they take
160    /// part in decoding as ordinary edges. The only requirement is ordering — the
161    /// compiled error model must be attached first, or the generator indices
162    /// address the wrong error list.
163    #[derive(Clone, PartialEq, ::prost::Message)]
164    pub struct LossModel {
165        #[prost(message, repeated, tag = "1")]
166        pub losses: ::prost::alloc::vec::Vec<loss_model::Loss>,
167        /// One entry per input physical qubit (in concatenated input-port order);
168        /// `input_losses\[j\]` describes a loss entering on input qubit `j`. Qubits
169        /// with no continuation keep a default, empty slot.
170        #[prost(message, repeated, tag = "2")]
171        pub input_losses: ::prost::alloc::vec::Vec<loss_model::InputLoss>,
172    }
173    /// Nested message and enum types in `LossModel`.
174    pub mod loss_model {
175        #[derive(Clone, PartialEq, ::prost::Message)]
176        pub struct Loss {
177            /// Probability from the LOSS_ERROR instruction that creates this loss
178            #[prost(double, tag = "1")]
179            pub probability: f64,
180            /// Generators caused by an already-active loss, as error indices,
181            /// inherited from all descendants. A loss-only generator carries
182            /// probability 0 in its `errors` entry until a loss activates it.
183            #[prost(uint64, repeated, tag = "2")]
184            pub continuation_errors: ::prost::alloc::vec::Vec<u64>,
185            /// Generators that apply only when the loss starts here (never inherited),
186            /// as error indices.
187            #[prost(uint64, repeated, tag = "3")]
188            pub source_errors: ::prost::alloc::vec::Vec<u64>,
189            /// Within-gadget continuation links, as indices into this gadget's
190            /// `losses`, recorded when propagation reaches another declared loss site.
191            /// Children have greater indices so a single forward pass builds the DAG.
192            #[prost(uint64, repeated, tag = "4")]
193            pub child_losses: ::prost::alloc::vec::Vec<u64>,
194            /// Physical-qubit positions on the concatenated OUTPUT ports on which this
195            /// loss leaves the gadget, each in `[0, sum of output-port n)`. The
196            /// cross-gadget analog of `child_losses`, linked to the connected gadget's
197            /// `input_losses` at runtime.
198            #[prost(uint64, repeated, tag = "5")]
199            pub child_output_qubits: ::prost::alloc::vec::Vec<u64>,
200            /// Local physical measurements that directly herald this loss node. The
201            /// runtime folds herald evidence forward along the child links: a loss
202            /// site is kept when some herald in its forward reach fired as a loss and
203            /// none fired as a non-loss.
204            #[prost(uint64, repeated, tag = "6")]
205            pub loss_measurements: ::prost::alloc::vec::Vec<u64>,
206        }
207        /// Continuation template for a loss that ENTERS this gadget on an input
208        /// physical qubit. It carries no probability (fixed by the parent loss that
209        /// exits into it) and may fan out to within-gadget nodes and output qubits.
210        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
211        pub struct InputLoss {
212            /// Generators activated at the entry, before any within-gadget fan-out, as
213            /// error indices.
214            #[prost(uint64, repeated, tag = "1")]
215            pub continuation_errors: ::prost::alloc::vec::Vec<u64>,
216            /// Within-gadget loss nodes this entering loss propagates into, as indices
217            /// into `losses` (the analog of `Loss.child_losses`).
218            #[prost(uint64, repeated, tag = "2")]
219            pub child_losses: ::prost::alloc::vec::Vec<u64>,
220            /// Physical-qubit positions on the concatenated OUTPUT ports on which the
221            /// entering loss leaves the gadget, each in `[0, sum of output-port n)`.
222            #[prost(uint64, repeated, tag = "3")]
223            pub child_output_qubits: ::prost::alloc::vec::Vec<u64>,
224            /// Local physical measurements that directly herald the entering loss.
225            #[prost(uint64, repeated, tag = "4")]
226            pub loss_measurements: ::prost::alloc::vec::Vec<u64>,
227        }
228    }
229}
230#[derive(Clone, PartialEq, ::prost::Message)]
231pub struct PortType {
232    /// globally unique id of the port type
233    #[prost(uint64, tag = "1")]
234    pub ptype: u64,
235    #[prost(string, tag = "2")]
236    pub name: ::prost::alloc::string::String,
237    #[prost(string, tag = "3")]
238    pub description: ::prost::alloc::string::String,
239    #[prost(message, repeated, tag = "4")]
240    pub observables: ::prost::alloc::vec::Vec<port_type::Observable>,
241    #[prost(message, repeated, tag = "5")]
242    pub mesh: ::prost::alloc::vec::Vec<super::visualizer::Mesh>,
243    #[prost(message, repeated, tag = "6")]
244    pub positions: ::prost::alloc::vec::Vec<super::visualizer::Position>,
245    /// number of physical qubits carried by a port of this type (the code's `n`).
246    #[prost(uint64, tag = "7")]
247    pub n: u64,
248}
249/// Nested message and enum types in `PortType`.
250pub mod port_type {
251    #[derive(Clone, PartialEq, ::prost::Message)]
252    pub struct Observable {
253        /// the details of the logical observable is irrelevant to the decoder
254        #[prost(string, tag = "1")]
255        pub tag: ::prost::alloc::string::String,
256        #[prost(message, optional, tag = "2")]
257        pub relative: ::core::option::Option<super::super::visualizer::Position>,
258    }
259}
260#[derive(Clone, PartialEq, ::prost::Message)]
261pub struct CheckModelType {
262    #[prost(uint64, tag = "1")]
263    pub ctype: u64,
264    #[prost(string, tag = "2")]
265    pub name: ::prost::alloc::string::String,
266    #[prost(string, tag = "3")]
267    pub description: ::prost::alloc::string::String,
268    /// the gadget type that this check model can attach to; 0 means "any gadget
269    /// type"
270    #[prost(uint64, tag = "4")]
271    pub gtype: u64,
272    #[prost(message, repeated, tag = "5")]
273    pub remote_gadgets: ::prost::alloc::vec::Vec<check_model_type::RemoteGadget>,
274    #[prost(message, repeated, tag = "7")]
275    pub checks: ::prost::alloc::vec::Vec<check_model_type::Check>,
276}
277/// Nested message and enum types in `CheckModelType`.
278pub mod check_model_type {
279    /// each check model first declare the list of remote gadgets that it needs
280    /// access to; this not only helps batching the remote accesses, but also
281    /// allows a decoder implementation to fetch all the required data beforehand
282    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
283    pub struct RemoteGadget {
284        /// the index of the remote gadget to start from; if not provided, it is
285        /// relative from the current gadget
286        #[prost(uint64, optional, tag = "1")]
287        pub previous_remote_gadget: ::core::option::Option<u64>,
288        /// setting this to 0 means "any gadget type"
289        #[prost(uint64, tag = "4")]
290        pub expecting_gtype: u64,
291        /// after hopping to the remote gadget, we might want to set a bias of the
292        /// measurements so that gadgets with multiple ports can reuse the same check
293        /// model simply by setting different biases at runtime
294        #[prost(uint64, tag = "5")]
295        pub measurement_bias: u64,
296        /// optionally, give the remote gadget a name for easier debugging
297        #[prost(string, tag = "6")]
298        pub tag: ::prost::alloc::string::String,
299        /// if the absolute index is provided, we use that directly; note that it is
300        /// preferred to use relative address for offline processing because absolute
301        /// indexing depends on the context and is harder to understand the
302        /// relationship; only runtime tools like JIT compiler should generate them
303        #[prost(uint64, optional, tag = "7")]
304        pub absolute_gid: ::core::option::Option<u64>,
305        /// the relative trajectory to find the target gadget
306        /// a check should mostly involve local measurements (no hops)
307        #[prost(oneof = "remote_gadget::Port", tags = "2, 3")]
308        pub port: ::core::option::Option<remote_gadget::Port>,
309    }
310    /// Nested message and enum types in `RemoteGadget`.
311    pub mod remote_gadget {
312        /// the relative trajectory to find the target gadget
313        /// a check should mostly involve local measurements (no hops)
314        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
315        pub enum Port {
316            #[prost(uint64, tag = "2")]
317            Input(u64),
318            #[prost(uint64, tag = "3")]
319            Output(u64),
320        }
321    }
322    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
323    pub struct RemoteMeasurement {
324        /// optionally refer to the remote gadget
325        #[prost(uint64, optional, tag = "1")]
326        pub remote_gadget: ::core::option::Option<u64>,
327        /// measurement id within a gadget specified by relative trajectory
328        /// local if trajectory is empty; for remote gadgets, the actual index is
329        /// measurement_index plus the measurement_bias in the RemoteGadget above
330        #[prost(uint64, tag = "2")]
331        pub measurement_index: u64,
332    }
333    #[derive(Clone, PartialEq, ::prost::Message)]
334    pub struct Check {
335        #[prost(string, tag = "1")]
336        pub tag: ::prost::alloc::string::String,
337        #[prost(message, repeated, tag = "2")]
338        pub measurements: ::prost::alloc::vec::Vec<RemoteMeasurement>,
339        #[prost(bool, tag = "3")]
340        pub naturally_flipped: bool,
341        /// optionally specify the position of the check; otherwise computed from the
342        /// last measurement it refers to
343        #[prost(message, optional, tag = "4")]
344        pub relative: ::core::option::Option<super::super::visualizer::Position>,
345        #[prost(string, tag = "5")]
346        pub color: ::prost::alloc::string::String,
347    }
348}
349#[derive(Clone, PartialEq, ::prost::Message)]
350pub struct ErrorModelType {
351    #[prost(uint64, tag = "1")]
352    pub etype: u64,
353    #[prost(string, tag = "2")]
354    pub name: ::prost::alloc::string::String,
355    #[prost(string, tag = "3")]
356    pub description: ::prost::alloc::string::String,
357    /// the check model type that this error model can attach to; 0 means "any
358    /// check model type"
359    #[prost(uint64, tag = "4")]
360    pub ctype: u64,
361    #[prost(message, repeated, tag = "5")]
362    pub remote_check_models: ::prost::alloc::vec::Vec<
363        error_model_type::RemoteCheckModel,
364    >,
365    #[prost(message, repeated, tag = "6")]
366    pub errors: ::prost::alloc::vec::Vec<error_model_type::Error>,
367}
368/// Nested message and enum types in `ErrorModelType`.
369pub mod error_model_type {
370    /// each error model first declare the list of remote check models that it need
371    /// access to; this not only helps batching the remote accesses, but also
372    /// allows a decoder implementation to know which check model needs to be
373    /// locked beforehand
374    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
375    pub struct RemoteCheckModel {
376        /// the index of the remote check model to start from; if not provided, it is
377        /// relative from the current check model
378        #[prost(uint64, optional, tag = "1")]
379        pub previous_remote_check_model: ::core::option::Option<u64>,
380        /// setting this to 0 means "any check model type"
381        #[prost(uint64, tag = "4")]
382        pub expecting_ctype: u64,
383        /// after hopping to the remote check model, we might want to set a bias of
384        /// the checks so that check models with multiple ports can reuse the same
385        /// error model simply by setting different biases at runtime
386        #[prost(uint64, tag = "5")]
387        pub check_bias: u64,
388        /// optionally, give the remote check model a name for easier debugging
389        #[prost(string, tag = "6")]
390        pub tag: ::prost::alloc::string::String,
391        /// if the absolute index is provided, we use that directly; note that it is
392        /// preferred to use relative address for offline processing because absolute
393        /// indexing depends on the context and is harder to understand the
394        /// relationship; only runtime tools like JIT compiler should generate them
395        #[prost(uint64, optional, tag = "7")]
396        pub absolute_cid: ::core::option::Option<u64>,
397        /// the relative trajectory to find the target check model
398        /// a check should mostly involve local measurements (no hops)
399        #[prost(oneof = "remote_check_model::Port", tags = "2, 3")]
400        pub port: ::core::option::Option<remote_check_model::Port>,
401    }
402    /// Nested message and enum types in `RemoteCheckModel`.
403    pub mod remote_check_model {
404        /// the relative trajectory to find the target check model
405        /// a check should mostly involve local measurements (no hops)
406        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
407        pub enum Port {
408            #[prost(uint64, tag = "2")]
409            Input(u64),
410            #[prost(uint64, tag = "3")]
411            Output(u64),
412        }
413    }
414    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
415    pub struct RemoteCheck {
416        /// optionally refer to the remote check model
417        #[prost(uint64, optional, tag = "1")]
418        pub remote_check_model: ::core::option::Option<u64>,
419        /// check id within a check model, the actual index is
420        /// check_index plus the check_bias in the RemoteCheckModel above
421        #[prost(uint64, tag = "2")]
422        pub check_index: u64,
423    }
424    #[derive(Clone, PartialEq, ::prost::Message)]
425    pub struct Error {
426        #[prost(string, tag = "1")]
427        pub tag: ::prost::alloc::string::String,
428        #[prost(message, repeated, tag = "2")]
429        pub checks: ::prost::alloc::vec::Vec<RemoteCheck>,
430        /// the list of logical observables that it flips. The index is local to the
431        /// gadget that the error belongs to, and the index is based on the
432        /// array that concatenates all the output ports' logical observables
433        #[prost(uint64, repeated, tag = "3")]
434        pub residual: ::prost::alloc::vec::Vec<u64>,
435        /// the list of readouts that it flips. The index is local to the gadget
436        #[prost(uint64, repeated, tag = "4")]
437        pub readout_flips: ::prost::alloc::vec::Vec<u64>,
438        /// the probability of the error happening: between 0 and 1
439        #[prost(double, tag = "5")]
440        pub probability: f64,
441        /// optionally specify the position of the error; otherwise computed from the
442        /// average of all the checks it refers to
443        #[prost(message, optional, tag = "6")]
444        pub relative: ::core::option::Option<super::super::visualizer::Position>,
445        #[prost(string, tag = "7")]
446        pub color: ::prost::alloc::string::String,
447    }
448}
449/// modifier for bit matrices: supports toggle (XOR) and overwrite semantics
450#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
451pub struct BitMatrixModifier {
452    /// XOR toggle specific bits in the matrix
453    #[prost(message, optional, tag = "1")]
454    pub toggle: ::core::option::Option<super::util::BitMatrix>,
455    /// alternatively, overwrite the entire matrix (applied after toggle)
456    #[prost(message, optional, tag = "2")]
457    pub overwrite: ::core::option::Option<super::util::BitMatrix>,
458}
459/// modifier for gadget instances: allows runtime modification of the
460/// propagation matrices without creating new gadget types
461#[derive(Clone, PartialEq, ::prost::Message)]
462pub struct GadgetModifier {
463    /// modify the correction_propagation matrix
464    /// dimension: |output_observables| x (|input_observables| + 1)
465    #[prost(message, optional, tag = "1")]
466    pub correction_propagation_mod: ::core::option::Option<BitMatrixModifier>,
467    /// modify the readout_propagation matrix
468    /// dimension: |readouts| x (|input_observables| + 1)
469    #[prost(message, optional, tag = "2")]
470    pub readout_propagation_mod: ::core::option::Option<BitMatrixModifier>,
471    /// modify the logical_correction matrix (logical feed-forward)
472    /// dimension: |output_observables| x |readouts|
473    #[prost(message, optional, tag = "3")]
474    pub logical_correction_mod: ::core::option::Option<BitMatrixModifier>,
475    /// apply corrections based on readouts from previous (remote) gadgets
476    #[prost(message, optional, tag = "4")]
477    pub remote_conditional_correction: ::core::option::Option<
478        RemoteConditionalCorrection,
479    >,
480    /// modify the physical_correction matrix
481    /// dimension: |output_observables| x |measurements|
482    #[prost(message, optional, tag = "5")]
483    pub physical_correction_mod: ::core::option::Option<BitMatrixModifier>,
484}
485/// Describes how readouts from remote gadgets affect the current gadget's
486/// output logical observables. This is only meaningful at runtime and is
487/// always empty in offline library definitions.
488#[derive(Clone, PartialEq, ::prost::Message)]
489pub struct RemoteConditionalCorrection {
490    /// The list of remote readouts that this correction depends on.
491    /// The order defines the column indices in the correction matrix.
492    #[prost(message, repeated, tag = "1")]
493    pub remote_readouts: ::prost::alloc::vec::Vec<
494        remote_conditional_correction::RemoteReadout,
495    >,
496    /// Correction matrix mapping remote readouts to output observable corrections.
497    /// dimension: |output_observables| rows x |remote_readouts| columns
498    #[prost(message, optional, tag = "2")]
499    pub correction: ::core::option::Option<super::util::BitMatrix>,
500}
501/// Nested message and enum types in `RemoteConditionalCorrection`.
502pub mod remote_conditional_correction {
503    /// Reference to a specific readout from a remote gadget
504    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
505    pub struct RemoteReadout {
506        #[prost(uint64, tag = "1")]
507        pub gid: u64,
508        #[prost(uint64, tag = "2")]
509        pub readout_index: u64,
510    }
511}
512#[derive(Clone, PartialEq, ::prost::Message)]
513pub struct Gadget {
514    /// the gadget type to instantiate
515    #[prost(uint64, tag = "1")]
516    pub gtype: u64,
517    #[prost(string, tag = "2")]
518    pub tag: ::prost::alloc::string::String,
519    #[prost(message, repeated, tag = "3")]
520    pub connectors: ::prost::alloc::vec::Vec<gadget::Connector>,
521    #[prost(message, optional, tag = "4")]
522    pub position: ::core::option::Option<super::visualizer::Position>,
523    /// only for visualization: this has no effect on the runtime system; runtime
524    /// system will generate gid to serve its own need.
525    /// leave this field zero to auto assign gid from 1
526    #[prost(uint64, tag = "5")]
527    pub gid: u64,
528    /// optionally modify the propagation matrices at runtime
529    #[prost(message, optional, tag = "6")]
530    pub modifier: ::core::option::Option<GadgetModifier>,
531}
532/// Nested message and enum types in `Gadget`.
533pub mod gadget {
534    /// connect the input ports to the output ports of existing operations; must
535    /// have a length of |gtype.inputs|
536    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
537    pub struct Connector {
538        /// the gadget that gives out a port, so that a new gadget can take it as
539        /// input
540        #[prost(uint64, tag = "1")]
541        pub gid: u64,
542        #[prost(uint64, tag = "2")]
543        pub port: u64,
544    }
545}
546#[derive(Clone, PartialEq, ::prost::Message)]
547pub struct CheckModel {
548    /// the check model type to instantiate
549    #[prost(uint64, tag = "1")]
550    pub ctype: u64,
551    /// the gadget it attaches to
552    #[prost(uint64, tag = "2")]
553    pub gid: u64,
554    #[prost(string, tag = "3")]
555    pub tag: ::prost::alloc::string::String,
556    #[prost(message, optional, tag = "4")]
557    pub modifier: ::core::option::Option<check_model::CheckModelModifier>,
558    /// only for visualization: this has no effect on the runtime system; runtime
559    /// system will generate cid to serve its own need.
560    /// leave this field zero to auto assign cid from 1
561    #[prost(uint64, tag = "5")]
562    pub cid: u64,
563    /// Optional early model registered once per JIT gadget type. Its instance
564    /// uses the same eid and error indices as the eventual full model. This is
565    /// not an attached model. Probabilities and correction effects are unchanged.
566    /// Each error's unfinished checks are replaced by one remote check at the
567    /// reserved absolute cid UINT64_MAX - 2, which is always outside the window.
568    /// Window decoding drops a committing error with any external check, while
569    /// buffer errors project away external vertices. Original indices are kept
570    /// in the type for probability modifiers; no probabilities are zeroed.
571    /// Window decoding may select it when no full model is attached and no output
572    /// path reaches another gadget in the window, including boundary buffers.
573    /// Interior and reconvergent paths require the full model. Early commitment
574    /// need not match a full model whose future checks later disappear or cancel.
575    /// Monolithic decoding ignores this fallback.
576    #[prost(message, optional, tag = "6")]
577    pub terminal_error_model: ::core::option::Option<ErrorModel>,
578    /// Number of full ErrorModel instances required before decoding; defaults to
579    /// one. Set zero for an intentionally error-free model, or declare the full
580    /// count when attaching multiple models. Terminal fallback requires count one.
581    #[prost(uint64, optional, tag = "7")]
582    pub error_model_count: ::core::option::Option<u64>,
583}
584/// Nested message and enum types in `CheckModel`.
585pub mod check_model {
586    /// optionally, it can modify the edge weights and some other reconfigurable
587    /// fields
588    #[derive(Clone, PartialEq, ::prost::Message)]
589    pub struct CheckModelModifier {
590        #[prost(message, repeated, tag = "4")]
591        pub reroute_remote_gadgets: ::prost::alloc::vec::Vec<
592            check_model_modifier::RerouteRemoteGadget,
593        >,
594    }
595    /// Nested message and enum types in `CheckModelModifier`.
596    pub mod check_model_modifier {
597        /// we can reroute the remote gadgets; note that this may create new
598        /// remote gadgets, and the vector of remote gadgets will be dynamically
599        /// extended when needed
600        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
601        pub struct RerouteRemoteGadget {
602            #[prost(uint64, tag = "1")]
603            pub remote_gadget_index: u64,
604            #[prost(message, optional, tag = "2")]
605            pub value: ::core::option::Option<
606                super::super::check_model_type::RemoteGadget,
607            >,
608        }
609    }
610}
611#[derive(Clone, PartialEq, ::prost::Message)]
612pub struct ErrorModel {
613    /// the error model type to instantiate
614    #[prost(uint64, tag = "1")]
615    pub etype: u64,
616    /// the check model it attaches to
617    #[prost(uint64, tag = "2")]
618    pub cid: u64,
619    #[prost(string, tag = "3")]
620    pub tag: ::prost::alloc::string::String,
621    #[prost(message, optional, tag = "4")]
622    pub modifier: ::core::option::Option<error_model::ErrorModelModifier>,
623    /// only for visualization: this has no effect on the runtime system; runtime
624    /// system will generate eid to serve its own need.
625    /// leave this field zero to auto assign eid from 1
626    #[prost(uint64, tag = "5")]
627    pub eid: u64,
628}
629/// Nested message and enum types in `ErrorModel`.
630pub mod error_model {
631    /// optionally, it can modify the edge weights and some other reconfigurable
632    /// fields
633    #[derive(Clone, PartialEq, ::prost::Message)]
634    pub struct ErrorModelModifier {
635        #[prost(message, optional, tag = "1")]
636        pub probability_modifier: ::core::option::Option<super::ProbabilityModifier>,
637        #[prost(message, repeated, tag = "2")]
638        pub reroute_remote_check_models: ::prost::alloc::vec::Vec<
639            error_model_modifier::RerouteRemoteCheckModel,
640        >,
641    }
642    /// Nested message and enum types in `ErrorModelModifier`.
643    pub mod error_model_modifier {
644        /// we can reroute the remote check models; note that this may create new
645        /// remote check models, and the vector of remote check models will be
646        /// dynamically extended when needed
647        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
648        pub struct RerouteRemoteCheckModel {
649            #[prost(uint64, tag = "1")]
650            pub remote_check_model_index: u64,
651            #[prost(message, optional, tag = "2")]
652            pub value: ::core::option::Option<
653                super::super::error_model_type::RemoteCheckModel,
654            >,
655        }
656    }
657}
658/// one can modify the probability when instantiate an error model or when
659/// loading the outcomes
660///
661/// these fields are applied sequentially
662#[derive(Clone, PartialEq, ::prost::Message)]
663pub struct ProbabilityModifier {
664    /// overwrite existing probabilities; the length must be either 0 or equal to
665    /// the number of errors in the error model
666    #[prost(double, repeated, tag = "1")]
667    pub probabilities: ::prost::alloc::vec::Vec<f64>,
668    /// sparsely overwrite some probabilities given their indices; we use
669    /// separate (packed) array fields for indices and probabilities to save
670    /// space, but they should have the same length
671    #[prost(uint64, repeated, tag = "2")]
672    pub sparse_indices: ::prost::alloc::vec::Vec<u64>,
673    #[prost(double, repeated, tag = "3")]
674    pub sparse_probabilities: ::prost::alloc::vec::Vec<f64>,
675}