bloqade.stim.parse.lowering.Stim
classStim¶source
bloqade.stim.parse.lowering.Stim
Bases: lowering.LoweringABC[Node]
Signature
class Stim(*, max_lines: int = 3, hint_indent: int = 2, hint_show_lineno: bool = True, stacktrace: bool = True, nonstim_noise_ops: dict[str, kirin.ir.Statement] = dict(), ignore_unknown_stim: bool = False, error_unknown_nonstim: bool = False)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
max_lines | int | 3 | |
hint_indent | int | 2 | |
hint_show_lineno | bool | True | |
stacktrace | bool | True | |
nonstim_noise_ops | dict[str, kirin.ir.Statement] | dict() | |
ignore_unknown_stim | bool | False | |
error_unknown_nonstim | bool | False |
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
max_lines | int | field(default=3, kw_only=True) | |
hint_indent | int | field(default=2, kw_only=True) | |
hint_show_lineno | bool | field(default=True, kw_only=True) | |
stacktrace | bool | field(default=True, kw_only=True) | |
nonstim_noise_ops | dict[str, kirin.ir.Statement] | field(default_factory=dict, kw_only=True) | |
ignore_unknown_stim | bool | field(default=False, kw_only=True) | |
error_unknown_nonstim | bool | field(default=False, kw_only=True) |
methodrun¶source
bloqade.stim.parse.lowering.Stim.run
Signature
def run(stmt: Node, *, source: str | None = None, globals: dict[str, Any] | None = None, file: str | None = None, lineno_offset: int = 0, col_offset: int = 0, compactify: bool = True) -> ir.RegionParameters
| Name | Type | Default | Description |
|---|---|---|---|
stmt | Node | required | |
source | str | None | None | |
globals | dict[str, Any] | None | None | |
file | str | None | None | |
lineno_offset | int | 0 | |
col_offset | int | 0 | |
compactify | bool | True |
Returns
ir.Region
methodget_frame¶source
bloqade.stim.parse.lowering.Stim.get_frame
Signature
def get_frame(stmt: Node, source: str | None = None, globals: dict[str, Any] | None = None, file: str | None = None, lineno_offset: int = 0, col_offset: int = 0, compactify: bool = True) -> lowering.FrameParameters
| Name | Type | Default | Description |
|---|---|---|---|
stmt | Node | required | |
source | str | None | None | |
globals | dict[str, Any] | None | None | |
file | str | None | None | |
lineno_offset | int | 0 | |
col_offset | int | 0 | |
compactify | bool | True |
Returns
lowering.Frame
methodlower_literal¶source
bloqade.stim.parse.lowering.Stim.lower_literal
Signature
def lower_literal(state: lowering.State[Node], value: LiteralType) -> ir.SSAValueParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
value | LiteralType |
Returns
ir.SSAValue
methodlower_global¶source
bloqade.stim.parse.lowering.Stim.lower_global
Signature
def lower_global(state: lowering.State[Node], node: Node) -> lowering.LoweringABC.ResultParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | Node |
Returns
lowering.LoweringABC.Result
methodvisit¶source
bloqade.stim.parse.lowering.Stim.visit
def visit(state: lowering.State[Node], node: Node) -> lowering.ResultParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | Node |
Returns
lowering.Result
methodvisit_RZ¶source
bloqade.stim.parse.lowering.Stim.visit_RZ
Signature
def visit_RZ(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_RX¶source
bloqade.stim.parse.lowering.Stim.visit_RX
Signature
def visit_RX(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_RY¶source
bloqade.stim.parse.lowering.Stim.visit_RY
Signature
def visit_RY(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MX¶source
bloqade.stim.parse.lowering.Stim.visit_MX
Signature
def visit_MX(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MY¶source
bloqade.stim.parse.lowering.Stim.visit_MY
Signature
def visit_MY(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MZ¶source
bloqade.stim.parse.lowering.Stim.visit_MZ
Signature
def visit_MZ(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MXX¶source
bloqade.stim.parse.lowering.Stim.visit_MXX
Signature
def visit_MXX(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MYY¶source
bloqade.stim.parse.lowering.Stim.visit_MYY
Signature
def visit_MYY(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MZZ¶source
bloqade.stim.parse.lowering.Stim.visit_MZZ
Signature
def visit_MZZ(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_MPP¶source
bloqade.stim.parse.lowering.Stim.visit_MPP
Signature
def visit_MPP(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_TICK¶source
bloqade.stim.parse.lowering.Stim.visit_TICK
Signature
def visit_TICK(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_DETECTOR¶source
bloqade.stim.parse.lowering.Stim.visit_DETECTOR
Signature
def visit_DETECTOR(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_OBSERVABLE_INCLUDE¶source
bloqade.stim.parse.lowering.Stim.visit_OBSERVABLE_INCLUDE
Signature
def visit_OBSERVABLE_INCLUDE(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_QUBIT_COORDS¶source
bloqade.stim.parse.lowering.Stim.visit_QUBIT_COORDS
Signature
def visit_QUBIT_COORDS(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_X¶source
bloqade.stim.parse.lowering.Stim.visit_X
Signature
def visit_X(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_Y¶source
bloqade.stim.parse.lowering.Stim.visit_Y
Signature
def visit_Y(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_Z¶source
bloqade.stim.parse.lowering.Stim.visit_Z
Signature
def visit_Z(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_I¶source
bloqade.stim.parse.lowering.Stim.visit_I
Signature
def visit_I(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_H¶source
bloqade.stim.parse.lowering.Stim.visit_H
Signature
def visit_H(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_S¶source
bloqade.stim.parse.lowering.Stim.visit_S
Signature
def visit_S(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_S_DAG¶source
bloqade.stim.parse.lowering.Stim.visit_S_DAG
Signature
def visit_S_DAG(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SQRT_X¶source
bloqade.stim.parse.lowering.Stim.visit_SQRT_X
Signature
def visit_SQRT_X(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SQRT_Y¶source
bloqade.stim.parse.lowering.Stim.visit_SQRT_Y
Signature
def visit_SQRT_Y(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SQRT_X_DAG¶source
bloqade.stim.parse.lowering.Stim.visit_SQRT_X_DAG
Signature
def visit_SQRT_X_DAG(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SQRT_Y_DAG¶source
bloqade.stim.parse.lowering.Stim.visit_SQRT_Y_DAG
Signature
def visit_SQRT_Y_DAG(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SWAP¶source
bloqade.stim.parse.lowering.Stim.visit_SWAP
Signature
def visit_SWAP(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_CX¶source
bloqade.stim.parse.lowering.Stim.visit_CX
Signature
def visit_CX(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_CY¶source
bloqade.stim.parse.lowering.Stim.visit_CY
Signature
def visit_CY(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_CZ¶source
bloqade.stim.parse.lowering.Stim.visit_CZ
Signature
def visit_CZ(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SPP¶source
bloqade.stim.parse.lowering.Stim.visit_SPP
Signature
def visit_SPP(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_SPP_DAG¶source
bloqade.stim.parse.lowering.Stim.visit_SPP_DAG
Signature
def visit_SPP_DAG(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_X_ERROR¶source
bloqade.stim.parse.lowering.Stim.visit_X_ERROR
Signature
def visit_X_ERROR(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_Y_ERROR¶source
bloqade.stim.parse.lowering.Stim.visit_Y_ERROR
Signature
def visit_Y_ERROR(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_Z_ERROR¶source
bloqade.stim.parse.lowering.Stim.visit_Z_ERROR
Signature
def visit_Z_ERROR(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_DEPOLARIZE1¶source
bloqade.stim.parse.lowering.Stim.visit_DEPOLARIZE1
Signature
def visit_DEPOLARIZE1(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_DEPOLARIZE2¶source
bloqade.stim.parse.lowering.Stim.visit_DEPOLARIZE2
Signature
def visit_DEPOLARIZE2(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_PAULI_CHANNEL_1¶source
bloqade.stim.parse.lowering.Stim.visit_PAULI_CHANNEL_1
Signature
def visit_PAULI_CHANNEL_1(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_PAULI_CHANNEL_2¶source
bloqade.stim.parse.lowering.Stim.visit_PAULI_CHANNEL_2
Signature
def visit_PAULI_CHANNEL_2(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.StatementParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement
methodvisit_I_ERROR¶source
bloqade.stim.parse.lowering.Stim.visit_I_ERROR
Signature
def visit_I_ERROR(state: lowering.State[Node], node: stim.CircuitInstruction) -> ir.Statement | NoneParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
ir.Statement | None
methodvisit_CircuitInstruction¶source
bloqade.stim.parse.lowering.Stim.visit_CircuitInstruction
Signature
def visit_CircuitInstruction(state: lowering.State[Node], node: stim.CircuitInstruction) -> lowering.ResultParameters
| Name | Type | Description |
|---|---|---|
state | lowering.State[Node] | |
node | stim.CircuitInstruction |
Returns
lowering.Result