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
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JitLibrary {
#[prost(string, tag = "1")]
pub description: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub gadget_types: ::prost::alloc::vec::Vec<JitGadgetType>,
#[prost(message, repeated, tag = "3")]
pub port_types: ::prost::alloc::vec::Vec<JitPortType>,
#[prost(message, repeated, tag = "5")]
pub program: ::prost::alloc::vec::Vec<JitInstruction>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnloadJitLibrary {
/// unloading the jit will also unload all the error model types and check
/// model types that are only used by the specified gadget types
#[prost(uint64, repeated, tag = "1")]
pub gtype: ::prost::alloc::vec::Vec<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JitPortType {
#[prost(message, optional, tag = "1")]
pub base: ::core::option::Option<super::bin::PortType>,
#[prost(message, repeated, tag = "3")]
pub stabilizers: ::prost::alloc::vec::Vec<jit_port_type::Stabilizer>,
/// number of logical qubits encoded by this port type. Together with the
/// observable list in `base`, this fixes the column layout of any matrix
/// indexed by port observables: the first `2 * k` observables are logical
/// (`LX_0, LZ_0, LX_1, LZ_1, ...`) and the remaining ones are stabilizer
/// generators (one column per generator listed in `stabilizers`).
#[prost(uint64, tag = "4")]
pub k: u64,
}
/// Nested message and enum types in `JitPortType`.
pub mod jit_port_type {
/// also need the information of the virtual stabilizer measurements
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Stabilizer {
#[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 JitGadgetType {
#[prost(message, optional, tag = "1")]
pub base: ::core::option::Option<super::bin::GadgetType>,
/// finished checks are those that only involves physical measurements and
/// input virtual measurements; they can be expanded immediately and should
/// be constructed in the check model that binds to this gadget
#[prost(message, repeated, tag = "2")]
pub finished_checks: ::prost::alloc::vec::Vec<jit_gadget_type::Check>,
/// unfinished checks are those that involve ONE output virtual measurements;
/// they cannot be expanded immediately because we don't know the future
/// measurements yet. The number of unfinished checks should be equal to the
/// number of output stabilizers. Note that the check is excluding the output
/// virtual stabilizer measurement because it is implied by the check index.
#[prost(message, repeated, tag = "3")]
pub unfinished_checks: ::prost::alloc::vec::Vec<jit_gadget_type::Check>,
#[prost(message, repeated, tag = "4")]
pub errors: ::prost::alloc::vec::Vec<jit_gadget_type::Error>,
}
/// Nested message and enum types in `JitGadgetType`.
pub mod jit_gadget_type {
/// define how to dynamically generate the check model for this gadget
/// the check model is generated immediately when the JIT gadget is
/// instantiated: it includes those finished checks (which, by definition,
/// involves only current and past measurements and thus satisfies the deq bin
/// semantics) and updates the unfinished checks in the JIT compiler.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PresentMeasurement {
/// if the measurement comes from an input port stabilizer, the port index is
/// provided; otherwise the measurement refers to a physical measurement of
/// this gadget
#[prost(uint64, optional, tag = "1")]
pub input_port: ::core::option::Option<u64>,
/// if input port is not set, then this is the physical measurement index of
/// the current gadget. Otherwise, it is a virtual measurement from an input
/// port, and the index refers to the stabilizer index in the JIT port type
#[prost(uint64, tag = "2")]
pub measurement_index: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Check {
/// reuse the base error definition in deq bin, but ignore the field of
/// remote measurements because here we only refer to local measurements
/// (virtual or not).
#[prost(message, optional, tag = "1")]
pub base: ::core::option::Option<super::super::bin::check_model_type::Check>,
#[prost(message, repeated, tag = "2")]
pub measurements: ::prost::alloc::vec::Vec<PresentMeasurement>,
}
/// define how to dynamically generate the error model for this gadget. Just
/// like the error model in deq bin, an error happening inside a gadget
/// belongs to the gadget's attaching error model. However, in JIT compilation,
/// the error model may not be immediately generated because some of the errors
/// trigger unfinished checks, which themselves have not been generated yet.
/// Even worse, due to the updates of unfinished checks, the degree of the
/// hyperedge is not determined yet. For example, an error triggering one
/// unfinished check might end up with triggering multiple checks due to
/// transversal logical CNOTs that propagates the error effect to multiple
/// logical qubits. In the JIT compiler, such errors are recorded in the memory
/// until all its referring unfinished checks are resolved. Only when all the
/// errors are resolved, an error model is generated and attached to the check
/// model.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
/// reuse the base error definition in deq bin, but ignore the field of
/// remote checks because here we only refer to local checks (finished or
/// not).
#[prost(message, optional, tag = "1")]
pub base: ::core::option::Option<super::super::bin::error_model_type::Error>,
/// the list of finished checks that it triggers
#[prost(uint64, repeated, tag = "2")]
pub finished_checks: ::prost::alloc::vec::Vec<u64>,
/// the list of unfinished checks that it triggers; if left empty, then the
/// error is resolved immediately; otherwise, it will wait until all the
/// unfinished checks and its propagated ones are completely resolved
#[prost(uint64, repeated, tag = "3")]
pub unfinished_checks: ::prost::alloc::vec::Vec<u64>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JitInstruction {
/// unlike the instruction in deq-bin which can instantiate either a gadget,
/// a check model or an error model, here in JIT compilation an instruction
/// can only instantiate a gadget, because the check model and error model are
/// dynamically generated based on the checks and errors defined in the JIT
/// gadget type.
#[prost(message, optional, tag = "1")]
pub gadget: ::core::option::Option<super::bin::Gadget>,
/// modify the probability of the errors
#[prost(message, optional, tag = "2")]
pub probability_modifier: ::core::option::Option<super::bin::ProbabilityModifier>,
}