Skip to main content

deq_runtime/proto/
deq.visualizer.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3pub struct VisualConfig {
4    /// all the gates will scale according to the qubit radius
5    #[prost(double, tag = "1")]
6    pub qubit_radius: f64,
7}
8#[derive(Clone, PartialEq, ::prost::Message)]
9pub struct Realization {
10    #[prost(message, repeated, tag = "1")]
11    pub locations: ::prost::alloc::vec::Vec<Location>,
12    /// the position of all the qubits; the number of positions must be equal to
13    /// the number of qubits
14    #[prost(message, repeated, tag = "2")]
15    pub positions: ::prost::alloc::vec::Vec<Position2D>,
16}
17#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
18pub struct DisplayMode {
19    #[prost(bool, tag = "1")]
20    pub show_block: bool,
21    #[prost(bool, tag = "2")]
22    pub show_realization: bool,
23    #[prost(bool, tag = "3")]
24    pub show_ports: bool,
25    #[prost(bool, tag = "4")]
26    pub show_check_model: bool,
27    #[prost(bool, tag = "5")]
28    pub show_error_model: bool,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct Location {
32    #[prost(double, tag = "1")]
33    pub t: f64,
34    #[prost(message, optional, tag = "2")]
35    pub operation: ::core::option::Option<Operation>,
36    /// if multiple noise distributions are present, the distribution is the
37    /// product of them
38    #[prost(message, repeated, tag = "3")]
39    pub noises: ::prost::alloc::vec::Vec<NoiseDistribution>,
40}
41#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
42pub struct Operation {
43    #[prost(enumeration = "OperationType", tag = "1")]
44    pub r#type: i32,
45    #[prost(uint32, repeated, tag = "2")]
46    pub support: ::prost::alloc::vec::Vec<u32>,
47    #[prost(string, tag = "3")]
48    pub pauli: ::prost::alloc::string::String,
49    #[prost(bool, tag = "4")]
50    pub inverted: bool,
51}
52/// explicit discrete distribution over (fault set, probability) pairs
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct NoiseDistribution {
55    #[prost(message, repeated, tag = "1")]
56    pub masses: ::prost::alloc::vec::Vec<NoiseMass>,
57}
58#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct NoiseMass {
60    /// we're taking the level out of Fault because all of them should have the
61    /// same level; if this is not true, consider adding a field: `repeated double  levels` in future versions
62    #[prost(message, repeated, tag = "1")]
63    pub faults: ::prost::alloc::vec::Vec<Fault>,
64    #[prost(double, tag = "2")]
65    pub probability: f64,
66    /// (optionally) the index of the edge in the error model
67    #[prost(uint32, optional, tag = "3")]
68    pub edge_index: ::core::option::Option<u32>,
69}
70#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
71pub struct Fault {
72    #[prost(string, tag = "1")]
73    pub r#type: ::prost::alloc::string::String,
74    #[prost(uint32, tag = "2")]
75    pub qubit: u32,
76}
77#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
78pub struct Selectable {
79    #[prost(oneof = "selectable::E", tags = "1, 2, 3, 4, 5, 6")]
80    pub e: ::core::option::Option<selectable::E>,
81}
82/// Nested message and enum types in `Selectable`.
83pub mod selectable {
84    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
85    pub struct Gadget {
86        #[prost(uint64, tag = "1")]
87        pub gid: u64,
88    }
89    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
90    pub struct Location {
91        #[prost(uint64, tag = "1")]
92        pub gid: u64,
93        #[prost(uint32, tag = "2")]
94        pub location_index: u32,
95    }
96    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
97    pub struct Port {
98        #[prost(uint64, tag = "1")]
99        pub gid: u64,
100        #[prost(oneof = "port::Io", tags = "2, 3")]
101        pub io: ::core::option::Option<port::Io>,
102    }
103    /// Nested message and enum types in `Port`.
104    pub mod port {
105        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
106        pub enum Io {
107            #[prost(uint32, tag = "2")]
108            Input(u32),
109            #[prost(uint32, tag = "3")]
110            Output(u32),
111        }
112    }
113    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
114    pub struct Observable {
115        #[prost(uint64, tag = "1")]
116        pub gid: u64,
117        #[prost(uint32, tag = "4")]
118        pub observable_index: u32,
119        #[prost(oneof = "observable::Io", tags = "2, 3")]
120        pub io: ::core::option::Option<observable::Io>,
121    }
122    /// Nested message and enum types in `Observable`.
123    pub mod observable {
124        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
125        pub enum Io {
126            #[prost(uint32, tag = "2")]
127            Input(u32),
128            #[prost(uint32, tag = "3")]
129            Output(u32),
130        }
131    }
132    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
133    pub struct Check {
134        #[prost(uint64, tag = "1")]
135        pub cid: u64,
136        #[prost(uint32, tag = "2")]
137        pub check_index: u32,
138    }
139    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
140    pub struct Error {
141        #[prost(uint64, tag = "1")]
142        pub eid: u64,
143        #[prost(uint32, tag = "2")]
144        pub error_index: u32,
145    }
146    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
147    pub enum E {
148        #[prost(message, tag = "1")]
149        Gadget(Gadget),
150        #[prost(message, tag = "2")]
151        Location(Location),
152        #[prost(message, tag = "3")]
153        Port(Port),
154        #[prost(message, tag = "4")]
155        Observable(Observable),
156        #[prost(message, tag = "5")]
157        Check(Check),
158        #[prost(message, tag = "6")]
159        Error(Error),
160    }
161}
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct MultiSelectable {
164    #[prost(message, repeated, tag = "1")]
165    pub elements: ::prost::alloc::vec::Vec<Selectable>,
166}
167#[derive(Clone, PartialEq, ::prost::Message)]
168pub struct Mesh {
169    #[prost(message, optional, tag = "1")]
170    pub geometry: ::core::option::Option<Geometry>,
171    #[prost(message, optional, tag = "2")]
172    pub material: ::core::option::Option<Material>,
173    #[prost(message, optional, tag = "3")]
174    pub relative: ::core::option::Option<Position>,
175    #[prost(message, optional, tag = "4")]
176    pub rotation: ::core::option::Option<Euler>,
177}
178#[derive(Clone, PartialEq, ::prost::Message)]
179pub struct Geometry {
180    #[prost(string, tag = "1")]
181    pub r#type: ::prost::alloc::string::String,
182    /// geometry-specific size
183    #[prost(double, repeated, tag = "2")]
184    pub size: ::prost::alloc::vec::Vec<f64>,
185    /// other props in JSON string
186    #[prost(string, tag = "3")]
187    pub geometry_props: ::prost::alloc::string::String,
188}
189#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
190pub struct Material {
191    #[prost(string, tag = "1")]
192    pub r#type: ::prost::alloc::string::String,
193    #[prost(string, tag = "2")]
194    pub color: ::prost::alloc::string::String,
195    /// other props in JSON string
196    #[prost(string, tag = "3")]
197    pub material_props: ::prost::alloc::string::String,
198}
199#[derive(Clone, Copy, PartialEq, ::prost::Message)]
200pub struct Position {
201    /// time
202    #[prost(double, tag = "1")]
203    pub t: f64,
204    /// looking from top: increasing i moves downwards, increasing j moves
205    /// rightwards
206    #[prost(double, tag = "2")]
207    pub i: f64,
208    #[prost(double, tag = "3")]
209    pub j: f64,
210}
211#[derive(Clone, Copy, PartialEq, ::prost::Message)]
212pub struct Position2D {
213    #[prost(double, tag = "1")]
214    pub i: f64,
215    #[prost(double, tag = "2")]
216    pub j: f64,
217}
218#[derive(Clone, Copy, PartialEq, ::prost::Message)]
219pub struct Euler {
220    #[prost(double, tag = "1")]
221    pub t: f64,
222    #[prost(double, tag = "2")]
223    pub i: f64,
224    #[prost(double, tag = "3")]
225    pub j: f64,
226}
227#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
228#[repr(i32)]
229pub enum OperationType {
230    Unknown = 0,
231    /// 1 support, self-inverse
232    Hadamard = 1,
233    /// 1 support; Pauli is specified in the `pauli` field (1 char)
234    /// special handling of inversion, but in terms of displaying, just add ^{-1}
235    SqrtPauli = 2,
236    /// 1 support; Pauli string is specified in the `pauli` field (together with
237    /// sign)
238    ///
239    /// * expecting 1 + 1 length pauli string(the first letter is + or -) not
240    ///   invertible
241    Prepare = 3,
242    /// N support; Pauli string and correction string is specified in the `pauli`
243    /// field
244    ///
245    /// * expecting N+1 length pauli string, first half characters (the first
246    ///   letter is + or -) optionally, append '%' + (N+1)-length correction
247    ///   (otherwise the correction is identity)
248    /// * optionally, the labels can be
249    ///   encoded in a JSON array appended to the string these labels
250    ///   correspond to where the measurement results are stored (to
251    ///   some extent) only invertible when the correction is
252    ///   identity, its inverse is itself
253    Measure = 4,
254    /// 2N support, special inverse: qubit 2i is mapped to qubit 2i+1, for all i in
255    /// range(N)
256    /// SWAP is a special case of shuffle
257    Shuffle = 5,
258    /// 1 support, not invertible
259    Discard = 6,
260    /// N support, self-inverse; Pauli string is specified in the `pauli` field
261    ///
262    /// * expecting N+1 length pauli string (the first letter is + or -, given
263    ///   self.\_negate) the labels are appended after the first N+1 letters, in JSON
264    ///   array format
265    ConditionalPauli = 7,
266    /// 1 support, self-inverse; 1 pauli
267    Pauli = 8,
268    /// 2 supports: control and target; Pauli is specified in the `pauli` field (1
269    /// char) self-inverse
270    ControlledPauli = 9,
271}
272impl OperationType {
273    /// String value of the enum field names used in the ProtoBuf definition.
274    ///
275    /// The values are not transformed in any way and thus are considered stable
276    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
277    pub fn as_str_name(&self) -> &'static str {
278        match self {
279            Self::Unknown => "UNKNOWN",
280            Self::Hadamard => "HADAMARD",
281            Self::SqrtPauli => "SQRT_PAULI",
282            Self::Prepare => "PREPARE",
283            Self::Measure => "MEASURE",
284            Self::Shuffle => "SHUFFLE",
285            Self::Discard => "DISCARD",
286            Self::ConditionalPauli => "CONDITIONAL_PAULI",
287            Self::Pauli => "PAULI",
288            Self::ControlledPauli => "CONTROLLED_PAULI",
289        }
290    }
291    /// Creates an enum from field names used in the ProtoBuf definition.
292    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
293        match value {
294            "UNKNOWN" => Some(Self::Unknown),
295            "HADAMARD" => Some(Self::Hadamard),
296            "SQRT_PAULI" => Some(Self::SqrtPauli),
297            "PREPARE" => Some(Self::Prepare),
298            "MEASURE" => Some(Self::Measure),
299            "SHUFFLE" => Some(Self::Shuffle),
300            "DISCARD" => Some(Self::Discard),
301            "CONDITIONAL_PAULI" => Some(Self::ConditionalPauli),
302            "PAULI" => Some(Self::Pauli),
303            "CONTROLLED_PAULI" => Some(Self::ControlledPauli),
304            _ => None,
305        }
306    }
307}