quantrs2_anneal/quantum_error_correction/
config.rs1use crate::ising::IsingError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum QuantumErrorCorrectionError {
9 #[error("Ising error: {0}")]
11 IsingError(#[from] IsingError),
12
13 #[error("Error correction code error: {0}")]
15 CodeError(String),
16
17 #[error("Syndrome detection error: {0}")]
19 SyndromeError(String),
20
21 #[error("Logical operation error: {0}")]
23 LogicalOperationError(String),
24
25 #[error("Decoding error: {0}")]
27 DecodingError(String),
28
29 #[error("Threshold error: {0}")]
31 ThresholdError(String),
32
33 #[error("Resource estimation error: {0}")]
35 ResourceEstimationError(String),
36}
37
38pub type QECResult<T> = Result<T, QuantumErrorCorrectionError>;
40
41#[derive(Debug, Clone)]
43pub struct QECConfig {
44 pub code_type: ErrorCorrectionCode,
46 pub code_parameters: CodeParameters,
48 pub error_threshold: f64,
50 pub correction_frequency: f64,
52 pub logical_operations: Vec<LogicalOperation>,
54 pub fault_tolerance_level: usize,
56 pub resource_constraints: ResourceConstraints,
58 pub annealing_integration: AnnealingIntegration,
60}
61
62use super::{
64 annealing_integration::AnnealingIntegration, codes::CodeParameters, codes::ErrorCorrectionCode,
65 logical_operations::LogicalOperation, resource_constraints::ResourceConstraints,
66};
67
68impl Default for QECConfig {
69 fn default() -> Self {
70 Self {
71 code_type: ErrorCorrectionCode::RepetitionCode,
72 code_parameters: CodeParameters::default(),
73 error_threshold: 0.01,
74 correction_frequency: 1000.0,
75 logical_operations: Vec::new(),
76 fault_tolerance_level: 1,
77 resource_constraints: ResourceConstraints::default(),
78 annealing_integration: AnnealingIntegration::default(),
79 }
80 }
81}