Skip to content

bloqade.stim.rewrite.set_observable_partial.SetObservablePartial

← Module overview

classSetObservablePartialsource

bloqade.stim.rewrite.set_observable_partial.SetObservablePartial

Bases: RewriteRule

Rewrite SetObservable using GetRecIdxFromMeasurement placeholders.

class SetObservablePartial

Instead of computing record indices from analysis results immediately, this injects GetRecIdxFromMeasurement statements that will be resolved post-analysis. The observable index is assigned by a simple counter based on statement order.

Attributes

NameTypeDefaultDescription
observable_countintfield(default=0, init=False)

methodrewrite_Statementsource

bloqade.stim.rewrite.set_observable_partial.SetObservablePartial.rewrite_Statement

def rewrite_Statement(node: ir.Statement) -> RewriteResult

Parameters

NameTypeDescription
nodeir.Statement

Returns

RewriteResult

source

methodrewrite_SetObservablesource

bloqade.stim.rewrite.set_observable_partial.SetObservablePartial.rewrite_SetObservable

def rewrite_SetObservable(node: SetObservable) -> RewriteResult

Parameters

NameTypeDescription
nodeSetObservable

Returns

RewriteResult

source