Skip to content

Emit

EmitStimGateMethods

Bases: MethodTable


              flowchart TD
              bloqade.stim.dialects.gate.emit.EmitStimGateMethods[EmitStimGateMethods]

              

              click bloqade.stim.dialects.gate.emit.EmitStimGateMethods href "" "bloqade.stim.dialects.gate.emit.EmitStimGateMethods"
            

rotation_gate

rotation_gate(
    emit: EmitStimMain, frame: EmitStimFrame, stmt: Rx
)

Emit rotation gate as I[R_X/R_Y/R_Z(theta=...)] in Stim annotation format.

Source code in .venv/lib/python3.12/site-packages/bloqade/stim/dialects/gate/emit.py
58
59
60
61
62
63
64
65
66
67
@impl(stmts.Rx)
@impl(stmts.Ry)
@impl(stmts.Rz)
def rotation_gate(self, emit: EmitStimMain, frame: EmitStimFrame, stmt: stmts.Rx):
    """Emit rotation gate as I[R_X/R_Y/R_Z(theta=...)] in Stim annotation format."""
    targets: tuple[str, ...] = frame.get_values(stmt.targets)
    angle_str: str = self._format_angle(frame.get(stmt.angle))
    res = f"I[{stmt.name}(theta={angle_str})] " + " ".join(targets)
    frame.write_line(res)
    return ()

t_gate

t_gate(emit: EmitStimMain, frame: EmitStimFrame, stmt: T)

Emit T gate as S[T] or S_DAG[T] in Stim annotation format.

Source code in .venv/lib/python3.12/site-packages/bloqade/stim/dialects/gate/emit.py
43
44
45
46
47
48
49
50
@impl(stmts.T)
def t_gate(self, emit: EmitStimMain, frame: EmitStimFrame, stmt: stmts.T):
    """Emit T gate as S[T] or S_DAG[T] in Stim annotation format."""
    targets: tuple[str, ...] = frame.get_values(stmt.targets)
    gate_name = "S_DAG" if stmt.dagger else "S"
    res = f"{gate_name}[T] " + " ".join(targets)
    frame.write_line(res)
    return ()

u3_gate

u3_gate(emit: EmitStimMain, frame: EmitStimFrame, stmt: U3)

Emit U3 gate as I[U3(theta=..., phi=..., lambda=...)] in Stim annotation format.

Source code in .venv/lib/python3.12/site-packages/bloqade/stim/dialects/gate/emit.py
69
70
71
72
73
74
75
76
77
78
79
80
@impl(stmts.U3)
def u3_gate(self, emit: EmitStimMain, frame: EmitStimFrame, stmt: stmts.U3):
    """Emit U3 gate as I[U3(theta=..., phi=..., lambda=...)] in Stim annotation format."""
    targets: tuple[str, ...] = frame.get_values(stmt.targets)
    theta_str: str = self._format_angle(frame.get(stmt.theta))
    phi_str: str = self._format_angle(frame.get(stmt.phi))
    lam_str: str = self._format_angle(frame.get(stmt.lam))
    res = f"I[U3(theta={theta_str}, phi={phi_str}, lambda={lam_str})] " + " ".join(
        targets
    )
    frame.write_line(res)
    return ()