pub enum StateError {
TooManyQubits(usize),
InvalidQubit {
qubit: usize,
n: usize,
},
SameQubits(usize),
UnitarySizeMismatch {
expected: usize,
got: usize,
},
MatrixSizeMismatch {
expected: usize,
got: usize,
},
EmptyMixture,
MixtureSizeMismatch {
states: usize,
probs: usize,
},
QubitCountMismatch {
expected: usize,
got: usize,
},
ProbabilitiesNotNormalized(f64),
NegativeProbability,
InvalidProbability(f64),
}Expand description
Errors produced by state construction and gate application.
Note: Eq is intentionally not derived (some variants carry an f64,
which has no total equality), only PartialEq.
Variants§
TooManyQubits(usize)
The requested number of qubits exceeds the supported limit.
InvalidQubit
A gate referenced a qubit index that does not exist.
SameQubits(usize)
A two-qubit gate was given the same qubit for control and target.
UnitarySizeMismatch
A unitary matrix supplied to crate::State::apply_unitary had the wrong
dimension for this state’s qubit count.
Fields
MatrixSizeMismatch
A flat data vector supplied to crate::density::Matrix::from_row_major
(or a Kraus operator passed to
crate::density::DensityMatrix::apply_kraus) had the wrong number of
entries/dimension.
Fields
EmptyMixture
crate::density::DensityMatrix::from_mixture was given an empty list
of states.
MixtureSizeMismatch
crate::density::DensityMatrix::from_mixture was given mismatched
numbers of states and probabilities.
Fields
QubitCountMismatch
crate::density::DensityMatrix::from_mixture was given states with
differing qubit counts.
Fields
ProbabilitiesNotNormalized(f64)
crate::density::DensityMatrix::from_mixture was given probabilities
that do not sum to 1 (within tolerance).
NegativeProbability
crate::density::DensityMatrix::from_mixture was given a negative
probability.
InvalidProbability(f64)
A noise-channel constructor (e.g.
crate::density::DensityMatrix::bit_flip_kraus or
crate::density::DensityMatrix::depolarizing_kraus) was given an
error probability outside [0, 1].
Trait Implementations§
Source§impl Debug for StateError
impl Debug for StateError
Source§impl Display for StateError
impl Display for StateError
Source§impl Error for StateError
impl Error for StateError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()