pub struct RuntimeStabilizerBasis { /* private fields */ }Expand description
The live stabilizer basis of a ZX graph, tracking the generators and the selective nodes whose runtime basis choice can still update it.
This is the state that dynamic (selective) fills mutate as each selective is resolved, and the source of derived measurement and output surfaces.
Implementations§
Source§impl RuntimeStabilizerBasis
impl RuntimeStabilizerBasis
Sourcepub fn generators(&self) -> &[PauliString]
pub fn generators(&self) -> &[PauliString]
The Pauli-string generators of this basis, in row order.
Sourcepub fn with_t_nodes_as_ports(self) -> Self
pub fn with_t_nodes_as_ports(self) -> Self
Sourcepub fn into_generators(self) -> StabilizerGenerators
pub fn into_generators(self) -> StabilizerGenerators
Consumes this live basis and materializes its current rows against its current ZX graph.
Sourcepub fn from_block_graph(graph: &BlockGraph) -> Result<Self, RuntimeBasisError>
pub fn from_block_graph(graph: &BlockGraph) -> Result<Self, RuntimeBasisError>
Builds the runtime basis by converting graph to a ZX graph first.
§Errors
Returns a RuntimeBasisError if conversion or basis derivation fails.
Sourcepub fn from_zx_graph(zx_graph: ZXGraph) -> Result<Self, RuntimeBasisError>
pub fn from_zx_graph(zx_graph: ZXGraph) -> Result<Self, RuntimeBasisError>
Builds the runtime basis from an existing ZX graph.
§Errors
Returns a RuntimeBasisError if the stabilizer basis cannot be derived.
Sourcepub fn from_zx_graph_with_limits(
zx_graph: ZXGraph,
limits: ModuleCertificationLimits,
) -> Result<Self, RuntimeBasisError>
pub fn from_zx_graph_with_limits( zx_graph: ZXGraph, limits: ModuleCertificationLimits, ) -> Result<Self, RuntimeBasisError>
Builds a runtime basis under explicit stabilizer-search limits.
§Errors
Returns a basis-derivation or resource-limit error.
Sourcepub fn from_generators(stabilizers: &StabilizerGenerators) -> Self
pub fn from_generators(stabilizers: &StabilizerGenerators) -> Self
Builds the runtime basis directly from already-canonicalized
StabilizerGenerators, reusing their rows and row kinds verbatim
instead of re-deriving the canonical stabilizer table from the ZX graph.
The nth runtime generator is the nth input generator, so the row
ordinals downstream code keys on stay identity-stable. This exists so a
caller that already holds the graph’s StabilizerGenerators avoids
paying for another canonicalization pass, which is otherwise what
from_zx_graph would re-run.
Sourcepub fn for_source_readouts(
stabilizers: &StabilizerGenerators,
) -> Result<Self, RuntimeBasisError>
pub fn for_source_readouts( stabilizers: &StabilizerGenerators, ) -> Result<Self, RuntimeBasisError>
Builds linear X/Z source-outcome coordinates on the complete signed basis.
Public row roles do not define these coordinates: a named anchor can also occur in a logical or private completion row. This basis is used to freeze causal readouts and to remove those same named components from frames. Crossing-node and Y readouts require the ordinary readout convention.
§Errors
Returns an error if a named source measurement lacks a concrete readable row.
Sourcepub fn apply_selective_fill(
&self,
pos: IVec3,
chosen: PauliBasis,
) -> Result<RuntimeStabilizerBasis, RuntimeBasisError>
pub fn apply_selective_fill( &self, pos: IVec3, chosen: PauliBasis, ) -> Result<RuntimeStabilizerBasis, RuntimeBasisError>
Resolves the selective node at pos to the chosen basis and returns
the evolved basis. Readable provenance stays internal to that basis.
§Errors
Returns a RuntimeBasisError if pos is not a live selective, the
basis is not allowed for its kind, or the computation is not Clifford.
Sourcepub fn apply_selective_fills(
&self,
fills: &[(IVec3, PauliBasis)],
) -> Result<RuntimeStabilizerBasis, RuntimeBasisError>
pub fn apply_selective_fills( &self, fills: &[(IVec3, PauliBasis)], ) -> Result<RuntimeStabilizerBasis, RuntimeBasisError>
Resolves one known assignment with the usual ordered basis transitions, but fills the graph only once.
§Errors
Returns RuntimeBasisError when a requested fill is invalid.
§Panics
Panics if validated selective metadata is internally inconsistent.
Sourcepub fn apply_selective_fill_assignments(
&self,
assignments: &[Vec<(IVec3, PauliBasis)>],
) -> Result<Vec<RuntimeStabilizerBasis>, RuntimeBasisError>
pub fn apply_selective_fill_assignments( &self, assignments: &[Vec<(IVec3, PauliBasis)>], ) -> Result<Vec<RuntimeStabilizerBasis>, RuntimeBasisError>
Resolves several assignments while sharing their common fill prefixes. Assignments with different site order use the ordinary independent path.
§Errors
Returns the same validation or fill errors as Self::apply_selective_fills.
§Panics
Panics if validated selective metadata is internally inconsistent.
Sourcepub fn derive_measurement_surface(
&self,
mvar: &str,
deadline: i64,
) -> Result<DerivedSurface, RuntimeBasisError>
pub fn derive_measurement_surface( &self, mvar: &str, deadline: i64, ) -> Result<DerivedSurface, RuntimeBasisError>
Derives the stabilizer surface that witnesses measurement variable
mvar, projected to what is decidable by time layer deadline.
Preserves the evolved readout identity after selective fills and prefers
an output-safe representative when one exists.
§Errors
Returns RuntimeBasisError::UnknownMeasurement if mvar is not a live
measurement variable.
Sourcepub fn derive_causal_measurement_surface(
&self,
mvar: &str,
deadline: i64,
) -> Result<DerivedSurface, RuntimeBasisError>
pub fn derive_causal_measurement_surface( &self, mvar: &str, deadline: i64, ) -> Result<DerivedSurface, RuntimeBasisError>
Selects an output-free readout using only resolved selective choices.
§Errors
Returns an error if mvar is unknown or no causal representative exists.
Sourcepub fn derive_output_correction_rows(
&self,
outputs: &[IVec3],
) -> Result<Vec<OutputCorrectionRow>, RuntimeBasisError>
pub fn derive_output_correction_rows( &self, outputs: &[IVec3], ) -> Result<Vec<OutputCorrectionRow>, RuntimeBasisError>
Derives the compact terminal output-correction rows consumed by
crate::solve_output_correction_symbolic.
§Errors
Returns a RuntimeBasisError if an output is unknown or cannot be
supported.
Sourcepub fn derive_output_correction_surfaces(
&self,
outputs: &[IVec3],
) -> Result<Vec<(OutputCorrectionRow, Stabilizer)>, RuntimeBasisError>
pub fn derive_output_correction_surfaces( &self, outputs: &[IVec3], ) -> Result<Vec<(OutputCorrectionRow, Stabilizer)>, RuntimeBasisError>
Derives compact output rows together with their full stabilizer surfaces. Consumers that must account for effects outside readable generator provenance, such as feedback on auxiliary directions, use the materialized surface.
§Errors
Returns an error if an output is unknown or cannot be supported.
Sourcepub fn into_output_correction_surfaces(
self,
outputs: &[IVec3],
) -> Result<Vec<(OutputCorrectionRow, Stabilizer)>, RuntimeBasisError>
pub fn into_output_correction_surfaces( self, outputs: &[IVec3], ) -> Result<Vec<(OutputCorrectionRow, Stabilizer)>, RuntimeBasisError>
Consumes this basis while deriving output corrections, moving its dense rows and provenance into the solve instead of cloning them.
§Errors
Returns an error if an output is unknown or cannot be supported.
Trait Implementations§
Source§impl Clone for RuntimeStabilizerBasis
impl Clone for RuntimeStabilizerBasis
Source§fn clone(&self) -> RuntimeStabilizerBasis
fn clone(&self) -> RuntimeStabilizerBasis
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for RuntimeStabilizerBasis
impl RefUnwindSafe for RuntimeStabilizerBasis
impl Send for RuntimeStabilizerBasis
impl Sync for RuntimeStabilizerBasis
impl Unpin for RuntimeStabilizerBasis
impl UnsafeUnpin for RuntimeStabilizerBasis
impl UnwindSafe for RuntimeStabilizerBasis
Blanket Implementations§
§impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
fn assign_index(&mut self, index: usize, to: bool)
fn negate_index(&mut self, index: usize)
fn clear_bits(&mut self)
fn assign_random(
&mut self,
bit_count: usize,
random_number_generator: &mut impl RngExt,
)where
BorrowedSelf: BitLength,
§impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
fn assign(&mut self, other: &Other)
fn bitxor_assign(&mut self, other: &Other)
fn bitand_assign(&mut self, other: &Other)
fn bitor_assign(&mut self, other: &Other)
§impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
§impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
fn index(&self, index: usize) -> bool
fn weight(&self) -> usize
fn parity(&self) -> bool
fn is_zero(&self) -> bool
fn is_unit(&self, index: usize) -> bool
fn support<'a>(&'a self) -> impl SortedIteratorwhere
BorrowedSelf: 'a,
fn max_support(&self) -> Option<usize>
fn min_support(&self) -> Option<usize>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].