microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billti/num2-sim

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

source/resource_estimator/src/estimates/error.rs

115lines ยท modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use miette::Diagnostic;
5use thiserror::Error;
6
7#[derive(Debug, Error, Diagnostic)]
8pub enum Error {
9 /// Input algorithm has no resources
10 ///
11 /// โœ… This does not contain user data and can be logged
12 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
13 #[error("Algorithm requires at least one magic state or measurement to estimate resources")]
14 #[diagnostic(code("Qsc.Estimates.AlgorithmHasNoResources"))]
15 AlgorithmHasNoResources,
16 /// The number of algorithmic logical qubits cannot be computed.
17 ///
18 /// โœ… This does not contain user data and can be logged
19 /// โœ… This error cannot be triggered by the system.
20 #[error("Cannot compute the number of algorithmic logical qubits: {0}")]
21 #[diagnostic(code("Qsc.Estimates.AlgorithmicLogicalQubitsComputationFailed"))]
22 AlgorithmicLogicalQubitsComputationFailed(String),
23 /// The algorithmic logical depth cannot be computed.
24 ///
25 /// โœ… This does not contain user data and can be logged
26 /// โœ… This error cannot be triggered by the system.
27 #[error("Cannot compute the algorithmic logical depth: {0}")]
28 #[diagnostic(code("Qsc.Estimates.AlgorithmicLogicalDepthComputationFailed"))]
29 AlgorithmicLogicalDepthComputationFailed(String),
30 /// The number of required magic states cannot be computed.
31 ///
32 /// โœ… This does not contain user data and can be logged
33 /// โœ… This error cannot be triggered by the system.
34 #[error("Cannot compute the required number of magic states: {0}")]
35 #[diagnostic(code("Qsc.Estimates.NumberOfMagicStatesComputationFailed"))]
36 NumberOfMagicStatesComputationFailed(String),
37 /// Both constraints for maximal time and
38 /// maximal number of qubits are provided
39 ///
40 /// โœ… This does not contain user data and can be logged
41 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
42 #[error(
43 "Both duration and number of physical qubits constraints are provided, but only one is allowed"
44 )]
45 #[diagnostic(code("Qsc.Estimates.BothDurationAndPhysicalQubitsProvided"))]
46 BothDurationAndPhysicalQubitsProvided,
47 /// No solution found for the provided maximum duration.
48 ///
49 /// โœ… This does not contain user data and can be logged
50 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
51 #[error("No solution found for the provided maximum duration.")]
52 #[diagnostic(code("Qsc.Estimates.MaxDurationTooSmall"))]
53 MaxDurationTooSmall,
54 /// No solution found for the provided maximum number of physical qubits
55 ///
56 /// โœ… This does not contain user data and can be logged
57 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
58 #[error("No solution found for the provided maximum number of physical qubits.")]
59 #[diagnostic(code("Qsc.Estimates.MaxPhysicalQubitsTooSmall"))]
60 MaxPhysicalQubitsTooSmall,
61 /// Logical depth scaling factor is too small
62 ///
63 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
64 #[error("Logical depth scaling factor is too small, it must be at least 1: {0}")]
65 #[diagnostic(code("Qsc.Estimates.LogicalDepthScalingFactorTooSmall"))]
66 LogicalDepthScalingFactorTooSmall(f64),
67 /// Resource estimation failed to find factories
68 ///
69 /// โœ… This error cannot be triggered by the system.
70 #[error("Resource estimation failed to find factories: {0}")]
71 #[diagnostic(code("Qsc.Estimates.FactorySearchFailed"))]
72 FactorySearchFailed(String),
73 /// Constraint-based search only supports one magic state type.
74 ///
75 /// โœ… This error cannot be triggered by the system, since only one magic
76 /// state type is supported.
77 #[error("Constraint-based search only supports one magic state type.")]
78 #[diagnostic(code("Qsc.Estimates.MultipleMagicStatesNotSupported"))]
79 MultipleMagicStatesNotSupported,
80 /// The number of physical qubits required for a code cannot be computed.
81 ///
82 /// โœ… This does not contain user data and can be logged
83 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
84 #[error("The number of physical qubits required for a code cannot be computed: {0}")]
85 #[diagnostic(code("Qsc.Estimates.PhysicalQubitComputationFailed"))]
86 PhysicalQubitComputationFailed(String),
87 /// The number of logical qubits provided by a code cannot be computed.
88 ///
89 /// โœ… This does not contain user data and can be logged
90 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
91 #[error("The number of logical qubits provided by a code cannot be computed: {0}")]
92 #[diagnostic(code("Qsc.Estimates.LogicalQubitComputationFailed"))]
93 LogicalQubitComputationFailed(String),
94 /// The logical cycle time cannot be computed.
95 ///
96 /// โœ… This does not contain user data and can be logged
97 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
98 #[error("The logical cycle time cannot be computed: {0}")]
99 #[diagnostic(code("Qsc.Estimates.LogicalCycleTimeComputationFailed"))]
100 LogicalCycleTimeComputationFailed(String),
101 /// The logical error rate cannot be computed.
102 ///
103 /// โœ… This does not contain user data and can be logged
104 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
105 #[error("The logical error rate cannot be computed: {0}")]
106 #[diagnostic(code("Qsc.Estimates.LogicalErrorRateComputationFailed"))]
107 LogicalErrorRateComputationFailed(String),
108 /// The code parameter cannot be computed.
109 ///
110 /// โœ… This does not contain user data and can be logged
111 /// ๐Ÿง‘โ€๐Ÿ’ป This indicates a user error
112 #[error("The code parameter cannot be computed: {0}")]
113 #[diagnostic(code("Qsc.Estimates.CodeParameterComputationFailed"))]
114 CodeParameterComputationFailed(String),
115}
116