Skip to main content

SimError

Enum SimError 

Source
#[non_exhaustive]
pub enum SimError { InvalidProbability(f64), InvalidProbabilityDistribution, InvalidRotationAngle(f64), EmptyStateAfterPruning { epsilon: f64, }, RankOverflow { rank: usize, cap: usize, }, PostselectImpossible { outcome: bool, probability: f64, }, RepeatedQubit(usize), NonCommutingControlledPaulis, InvalidControlledPauli, NonHermitianPauli, MissingBatchRecord { index: usize, }, QubitIndexOutOfRange { index: usize, num_qubits: usize, }, }
Expand description

Errors returned by TableauSimulator operations.

Every variant models a condition the caller can provoke and reasonably handle; internal invariants (a decomposed net phase that is not real, a partner label missing from the amplitude map) are enforced with debug_assert! rather than surfaced here.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidProbability(f64)

A probability was NaN or outside the inclusive unit interval.

§

InvalidProbabilityDistribution

A categorical channel had mismatched alternatives or total mass above one.

§

InvalidRotationAngle(f64)

A Pauli rotation angle was not finite.

§

EmptyStateAfterPruning

Pruning removed every amplitude and would produce a zero state.

Fields

§epsilon: f64

The pruning threshold that erased the state.

§

RankOverflow

A Pauli rotation or measurement pushed the live-label count past the cap.

Stabilizer rank grows by at most a factor of two per T, so this bounds the exponential blow-up of magic-heavy circuits.

Fields

§rank: usize

Live-label count that triggered the overflow.

§cap: usize

The live-label ceiling in force.

§

PostselectImpossible

A forced measurement outcome has (numerically) zero probability, so the requested post-selection is unreachable from the current state.

Fields

§outcome: bool

The requested (impossible) outcome.

§probability: f64

Probability the engine computed for it.

§

RepeatedQubit(usize)

A multi-qubit gate or Clifford support received one qubit more than once.

§

NonCommutingControlledPaulis

A controlled-Pauli operation requires commuting control and target axes.

§

InvalidControlledPauli

A controlled Pauli carries a sign or phase this API does not represent: conditioning on −P is a different operation, not a global phase.

§

NonHermitianPauli

A measurement or rotation axis has an imaginary coefficient, so it is not an observable.

§

MissingBatchRecord

A batched conditional Pauli named a measurement its own batch has not produced. Records are indexed from the start of the batch, so this is a malformed instruction stream rather than a state the run reached.

Fields

§index: usize

The out-of-range record index.

§

QubitIndexOutOfRange

A read-only observable names a qubit outside the live register.

Fields

§index: usize

Largest out-of-range support index.

§num_qubits: usize

Live simulator width.

Trait Implementations§

Source§

impl Clone for SimError

Source§

fn clone(&self) -> SimError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SimError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SimError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for SimError

Source§

fn eq(&self, other: &SimError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SimError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.