deq-runtime 0.3.0

deq: Real-time Quantum Error Correction Decoding System
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct VisualConfig {
    /// all the gates will scale according to the qubit radius
    #[prost(double, tag = "1")]
    pub qubit_radius: f64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Realization {
    #[prost(message, repeated, tag = "1")]
    pub locations: ::prost::alloc::vec::Vec<Location>,
    /// the position of all the qubits; the number of positions must be equal to
    /// the number of qubits
    #[prost(message, repeated, tag = "2")]
    pub positions: ::prost::alloc::vec::Vec<Position2D>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DisplayMode {
    #[prost(bool, tag = "1")]
    pub show_block: bool,
    #[prost(bool, tag = "2")]
    pub show_realization: bool,
    #[prost(bool, tag = "3")]
    pub show_ports: bool,
    #[prost(bool, tag = "4")]
    pub show_check_model: bool,
    #[prost(bool, tag = "5")]
    pub show_error_model: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Location {
    #[prost(double, tag = "1")]
    pub t: f64,
    #[prost(message, optional, tag = "2")]
    pub operation: ::core::option::Option<Operation>,
    /// if multiple noise distributions are present, the distribution is the
    /// product of them
    #[prost(message, repeated, tag = "3")]
    pub noises: ::prost::alloc::vec::Vec<NoiseDistribution>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Operation {
    #[prost(enumeration = "OperationType", tag = "1")]
    pub r#type: i32,
    #[prost(uint32, repeated, tag = "2")]
    pub support: ::prost::alloc::vec::Vec<u32>,
    #[prost(string, tag = "3")]
    pub pauli: ::prost::alloc::string::String,
    #[prost(bool, tag = "4")]
    pub inverted: bool,
}
/// explicit discrete distribution over (fault set, probability) pairs
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NoiseDistribution {
    #[prost(message, repeated, tag = "1")]
    pub masses: ::prost::alloc::vec::Vec<NoiseMass>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NoiseMass {
    /// we're taking the level out of Fault because all of them should have the
    /// same level; if this is not true, consider adding a field: `repeated double  levels` in future versions
    #[prost(message, repeated, tag = "1")]
    pub faults: ::prost::alloc::vec::Vec<Fault>,
    #[prost(double, tag = "2")]
    pub probability: f64,
    /// (optionally) the index of the edge in the error model
    #[prost(uint32, optional, tag = "3")]
    pub edge_index: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Fault {
    #[prost(string, tag = "1")]
    pub r#type: ::prost::alloc::string::String,
    #[prost(uint32, tag = "2")]
    pub qubit: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Selectable {
    #[prost(oneof = "selectable::E", tags = "1, 2, 3, 4, 5, 6")]
    pub e: ::core::option::Option<selectable::E>,
}
/// Nested message and enum types in `Selectable`.
pub mod selectable {
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Gadget {
        #[prost(uint64, tag = "1")]
        pub gid: u64,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Location {
        #[prost(uint64, tag = "1")]
        pub gid: u64,
        #[prost(uint32, tag = "2")]
        pub location_index: u32,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Port {
        #[prost(uint64, tag = "1")]
        pub gid: u64,
        #[prost(oneof = "port::Io", tags = "2, 3")]
        pub io: ::core::option::Option<port::Io>,
    }
    /// Nested message and enum types in `Port`.
    pub mod port {
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Io {
            #[prost(uint32, tag = "2")]
            Input(u32),
            #[prost(uint32, tag = "3")]
            Output(u32),
        }
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Observable {
        #[prost(uint64, tag = "1")]
        pub gid: u64,
        #[prost(uint32, tag = "4")]
        pub observable_index: u32,
        #[prost(oneof = "observable::Io", tags = "2, 3")]
        pub io: ::core::option::Option<observable::Io>,
    }
    /// Nested message and enum types in `Observable`.
    pub mod observable {
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Io {
            #[prost(uint32, tag = "2")]
            Input(u32),
            #[prost(uint32, tag = "3")]
            Output(u32),
        }
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Check {
        #[prost(uint64, tag = "1")]
        pub cid: u64,
        #[prost(uint32, tag = "2")]
        pub check_index: u32,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Error {
        #[prost(uint64, tag = "1")]
        pub eid: u64,
        #[prost(uint32, tag = "2")]
        pub error_index: u32,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum E {
        #[prost(message, tag = "1")]
        Gadget(Gadget),
        #[prost(message, tag = "2")]
        Location(Location),
        #[prost(message, tag = "3")]
        Port(Port),
        #[prost(message, tag = "4")]
        Observable(Observable),
        #[prost(message, tag = "5")]
        Check(Check),
        #[prost(message, tag = "6")]
        Error(Error),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MultiSelectable {
    #[prost(message, repeated, tag = "1")]
    pub elements: ::prost::alloc::vec::Vec<Selectable>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Mesh {
    #[prost(message, optional, tag = "1")]
    pub geometry: ::core::option::Option<Geometry>,
    #[prost(message, optional, tag = "2")]
    pub material: ::core::option::Option<Material>,
    #[prost(message, optional, tag = "3")]
    pub relative: ::core::option::Option<Position>,
    #[prost(message, optional, tag = "4")]
    pub rotation: ::core::option::Option<Euler>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Geometry {
    #[prost(string, tag = "1")]
    pub r#type: ::prost::alloc::string::String,
    /// geometry-specific size
    #[prost(double, repeated, tag = "2")]
    pub size: ::prost::alloc::vec::Vec<f64>,
    /// other props in JSON string
    #[prost(string, tag = "3")]
    pub geometry_props: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Material {
    #[prost(string, tag = "1")]
    pub r#type: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub color: ::prost::alloc::string::String,
    /// other props in JSON string
    #[prost(string, tag = "3")]
    pub material_props: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Position {
    /// time
    #[prost(double, tag = "1")]
    pub t: f64,
    /// looking from top: increasing i moves downwards, increasing j moves
    /// rightwards
    #[prost(double, tag = "2")]
    pub i: f64,
    #[prost(double, tag = "3")]
    pub j: f64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Position2D {
    #[prost(double, tag = "1")]
    pub i: f64,
    #[prost(double, tag = "2")]
    pub j: f64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Euler {
    #[prost(double, tag = "1")]
    pub t: f64,
    #[prost(double, tag = "2")]
    pub i: f64,
    #[prost(double, tag = "3")]
    pub j: f64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationType {
    Unknown = 0,
    /// 1 support, self-inverse
    Hadamard = 1,
    /// 1 support; Pauli is specified in the `pauli` field (1 char)
    /// special handling of inversion, but in terms of displaying, just add ^{-1}
    SqrtPauli = 2,
    /// 1 support; Pauli string is specified in the `pauli` field (together with
    /// sign)
    ///
    /// * expecting 1 + 1 length pauli string(the first letter is + or -) not
    ///   invertible
    Prepare = 3,
    /// N support; Pauli string and correction string is specified in the `pauli`
    /// field
    ///
    /// * expecting N+1 length pauli string, first half characters (the first
    ///   letter is + or -) optionally, append '%' + (N+1)-length correction
    ///   (otherwise the correction is identity)
    /// * optionally, the labels can be
    ///   encoded in a JSON array appended to the string these labels
    ///   correspond to where the measurement results are stored (to
    ///   some extent) only invertible when the correction is
    ///   identity, its inverse is itself
    Measure = 4,
    /// 2N support, special inverse: qubit 2i is mapped to qubit 2i+1, for all i in
    /// range(N)
    /// SWAP is a special case of shuffle
    Shuffle = 5,
    /// 1 support, not invertible
    Discard = 6,
    /// N support, self-inverse; Pauli string is specified in the `pauli` field
    ///
    /// * expecting N+1 length pauli string (the first letter is + or -, given
    ///   self.\_negate) the labels are appended after the first N+1 letters, in JSON
    ///   array format
    ConditionalPauli = 7,
    /// 1 support, self-inverse; 1 pauli
    Pauli = 8,
    /// 2 supports: control and target; Pauli is specified in the `pauli` field (1
    /// char) self-inverse
    ControlledPauli = 9,
}
impl OperationType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unknown => "UNKNOWN",
            Self::Hadamard => "HADAMARD",
            Self::SqrtPauli => "SQRT_PAULI",
            Self::Prepare => "PREPARE",
            Self::Measure => "MEASURE",
            Self::Shuffle => "SHUFFLE",
            Self::Discard => "DISCARD",
            Self::ConditionalPauli => "CONDITIONAL_PAULI",
            Self::Pauli => "PAULI",
            Self::ControlledPauli => "CONTROLLED_PAULI",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UNKNOWN" => Some(Self::Unknown),
            "HADAMARD" => Some(Self::Hadamard),
            "SQRT_PAULI" => Some(Self::SqrtPauli),
            "PREPARE" => Some(Self::Prepare),
            "MEASURE" => Some(Self::Measure),
            "SHUFFLE" => Some(Self::Shuffle),
            "DISCARD" => Some(Self::Discard),
            "CONDITIONAL_PAULI" => Some(Self::ConditionalPauli),
            "PAULI" => Some(Self::Pauli),
            "CONTROLLED_PAULI" => Some(Self::ControlledPauli),
            _ => None,
        }
    }
}