Ops
ops
QubitAttr
Bases: StimPrintable, ParametrizedAttribute, TypeAttribute
Type for a single qubit.
Source code in xdsl/dialects/stim/ops.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
name = 'stim.qubit'
class-attribute
instance-attribute
qubit: IntAttr
instance-attribute
__init__(qubit: int | IntAttr) -> None
Source code in xdsl/dialects/stim/ops.py
32 33 34 35 | |
parse_parameters(parser: AttrParser) -> Sequence[IntAttr]
classmethod
Source code in xdsl/dialects/stim/ops.py
37 38 39 40 41 | |
print_parameters(printer: Printer) -> None
Source code in xdsl/dialects/stim/ops.py
43 44 45 | |
print_stim(printer: StimPrinter)
Source code in xdsl/dialects/stim/ops.py
47 48 | |
QubitMappingAttr
Bases: StimPrintable, ParametrizedAttribute
This attribute provides a way to indicate the required connectivity or layout of
physical qubits.
It consists of two parameters
- A co-ordinate array (currently it only anticipates a pair of qubits, but this is not fixed)
- A value associated with a qubit referred to in a circuit.
The co-ordinates may be used as a physical address of a qubit, or the relative address with respect to some known physical address.
Operations that attach this as a property may represent the lattice-like structure of a physical quantum computer by having a property with an ArrayAttr[QubitCoordsAttr].
Source code in xdsl/dialects/stim/ops.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
name = 'stim.qubit_coord'
class-attribute
instance-attribute
coords: ArrayAttr[FloatData | IntAttr]
instance-attribute
qubit_name: QubitAttr
instance-attribute
__init__(coords: list[float] | ArrayAttr[FloatData | IntAttr], qubit_name: int | QubitAttr) -> None
Source code in xdsl/dialects/stim/ops.py
75 76 77 78 79 80 81 82 83 84 85 86 87 | |
parse_parameters(parser: AttrParser) -> tuple[ArrayAttr[FloatData | IntAttr], QubitAttr]
classmethod
Source code in xdsl/dialects/stim/ops.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
print_parameters(printer: Printer) -> None
Source code in xdsl/dialects/stim/ops.py
109 110 111 112 113 114 115 116 117 118 119 120 121 | |
print_stim(printer: StimPrinter)
Source code in xdsl/dialects/stim/ops.py
123 124 125 | |
StimCircuitOp
Bases: StimPrintable, IRDLOperation
Base operation containing a stim program
Source code in xdsl/dialects/stim/ops.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
name = 'stim.circuit'
class-attribute
instance-attribute
body = region_def('single_block')
class-attribute
instance-attribute
qubitlayout = opt_prop_def(ArrayAttr[QubitMappingAttr])
class-attribute
instance-attribute
assembly_format = '(`qubitlayout` $qubitlayout^)? attr-dict-with-keyword $body'
class-attribute
instance-attribute
__init__(body: Region, qubitlayout: None | ArrayAttr[QubitMappingAttr])
Source code in xdsl/dialects/stim/ops.py
142 143 | |
verify(verify_nested_ops: bool = True) -> None
Source code in xdsl/dialects/stim/ops.py
145 146 | |
print_stim(printer: StimPrinter)
Source code in xdsl/dialects/stim/ops.py
148 149 150 151 152 | |
stim() -> str
Source code in xdsl/dialects/stim/ops.py
154 155 156 157 158 159 | |
AnnotationOp
dataclass
Bases: StimPrintable, IRDLOperation, ABC
Base Annotation operation.
This is used to indicate operations that are stim annotations, these do not have operational semantics, so this will be used during transforms to ignore these operations.
Source code in xdsl/dialects/stim/ops.py
175 176 177 178 179 180 181 182 | |
QubitCoordsOp
Bases: AnnotationOp
Annotation operation that assigns a qubit reference to a coordinate.
Source code in xdsl/dialects/stim/ops.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
name = 'stim.assign_qubit_coord'
class-attribute
instance-attribute
qubitmapping = prop_def(QubitMappingAttr)
class-attribute
instance-attribute
assembly_format = '$qubitmapping attr-dict'
class-attribute
instance-attribute
__init__(qubitmapping: QubitMappingAttr)
Source code in xdsl/dialects/stim/ops.py
197 198 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
200 201 202 | |
SingleQubitGateOp
Bases: StimPrintable, IRDLOperation, ABC
Base operation for single-qubit gates.
Source code in xdsl/dialects/stim/ops.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
STIM_NAME: str
class-attribute
targets = prop_def(ArrayAttr[QubitAttr])
class-attribute
instance-attribute
assembly_format = '$targets attr-dict'
class-attribute
instance-attribute
__init__(targets: Sequence[QubitAttr | int])
Source code in xdsl/dialects/stim/ops.py
223 224 225 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
227 228 229 230 231 | |
HOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
234 235 236 237 | |
name = 'stim.h'
class-attribute
instance-attribute
STIM_NAME: str = 'H'
class-attribute
SOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
240 241 242 243 | |
name = 'stim.s'
class-attribute
instance-attribute
STIM_NAME: str = 'S'
class-attribute
SDagOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
246 247 248 249 | |
name = 'stim.s_dag'
class-attribute
instance-attribute
STIM_NAME: str = 'S_DAG'
class-attribute
XOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
252 253 254 255 | |
name = 'stim.x'
class-attribute
instance-attribute
STIM_NAME: str = 'X'
class-attribute
YOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
258 259 260 261 | |
name = 'stim.y'
class-attribute
instance-attribute
STIM_NAME: str = 'Y'
class-attribute
ZOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
264 265 266 267 | |
name = 'stim.z'
class-attribute
instance-attribute
STIM_NAME: str = 'Z'
class-attribute
IOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
270 271 272 273 | |
name = 'stim.i'
class-attribute
instance-attribute
STIM_NAME: str = 'I'
class-attribute
SqrtXOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
276 277 278 279 | |
name = 'stim.sqrt_x'
class-attribute
instance-attribute
STIM_NAME: str = 'SQRT_X'
class-attribute
SqrtXDagOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
282 283 284 285 | |
name = 'stim.sqrt_x_dag'
class-attribute
instance-attribute
STIM_NAME: str = 'SQRT_X_DAG'
class-attribute
SqrtYOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
288 289 290 291 | |
name = 'stim.sqrt_y'
class-attribute
instance-attribute
STIM_NAME: str = 'SQRT_Y'
class-attribute
SqrtYDagOp
dataclass
Bases: SingleQubitGateOp
Source code in xdsl/dialects/stim/ops.py
294 295 296 297 | |
name = 'stim.sqrt_y_dag'
class-attribute
instance-attribute
STIM_NAME: str = 'SQRT_Y_DAG'
class-attribute
TwoQubitGateOp
Bases: StimPrintable, IRDLOperation, ABC
Base operation for two-qubit gates.
Source code in xdsl/dialects/stim/ops.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
STIM_NAME: str
class-attribute
targets = prop_def(ArrayAttr[QubitAttr])
class-attribute
instance-attribute
assembly_format = '$targets attr-dict'
class-attribute
instance-attribute
__init__(targets: Sequence[QubitAttr | int])
Source code in xdsl/dialects/stim/ops.py
318 319 320 | |
verify_() -> None
Source code in xdsl/dialects/stim/ops.py
322 323 324 325 326 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
328 329 330 331 332 | |
CXOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
335 336 337 338 | |
name = 'stim.cx'
class-attribute
instance-attribute
STIM_NAME: str = 'CX'
class-attribute
CYOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
341 342 343 344 | |
name = 'stim.cy'
class-attribute
instance-attribute
STIM_NAME: str = 'CY'
class-attribute
CZOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
347 348 349 350 | |
name = 'stim.cz'
class-attribute
instance-attribute
STIM_NAME: str = 'CZ'
class-attribute
SwapOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
353 354 355 356 | |
name = 'stim.swap'
class-attribute
instance-attribute
STIM_NAME: str = 'SWAP'
class-attribute
ISwapOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
359 360 361 362 | |
name = 'stim.iswap'
class-attribute
instance-attribute
STIM_NAME: str = 'ISWAP'
class-attribute
ISwapDagOp
dataclass
Bases: TwoQubitGateOp
Source code in xdsl/dialects/stim/ops.py
365 366 367 368 | |
name = 'stim.iswap_dag'
class-attribute
instance-attribute
STIM_NAME: str = 'ISWAP_DAG'
class-attribute
MeasurementOperation
Bases: StimPrintable, IRDLOperation, ABC
Base operation for measurement gates (M, MX, MY).
Source code in xdsl/dialects/stim/ops.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
STIM_NAME: str
class-attribute
targets = prop_def(ArrayAttr[QubitAttr])
class-attribute
instance-attribute
flip_prob = opt_prop_def(FloatData)
class-attribute
instance-attribute
assembly_format = '(`flip_prob` $flip_prob^)? $targets attr-dict'
class-attribute
instance-attribute
__init__(targets: Sequence[QubitAttr | int], flip_prob: float | FloatData | None = None)
Source code in xdsl/dialects/stim/ops.py
388 389 390 391 392 393 394 395 396 397 398 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
400 401 402 403 404 405 406 | |
MOp
dataclass
Bases: MeasurementOperation
Source code in xdsl/dialects/stim/ops.py
409 410 411 412 | |
name = 'stim.m'
class-attribute
instance-attribute
STIM_NAME: str = 'M'
class-attribute
MXOp
dataclass
Bases: MeasurementOperation
Source code in xdsl/dialects/stim/ops.py
415 416 417 418 | |
name = 'stim.mx'
class-attribute
instance-attribute
STIM_NAME: str = 'MX'
class-attribute
MYOp
dataclass
Bases: MeasurementOperation
Source code in xdsl/dialects/stim/ops.py
421 422 423 424 | |
name = 'stim.my'
class-attribute
instance-attribute
STIM_NAME: str = 'MY'
class-attribute
ResetOperation
Bases: StimPrintable, IRDLOperation, ABC
Base operation for reset gates (R, RX, RY).
Source code in xdsl/dialects/stim/ops.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
STIM_NAME: str
class-attribute
targets = prop_def(ArrayAttr[QubitAttr])
class-attribute
instance-attribute
assembly_format = '$targets attr-dict'
class-attribute
instance-attribute
__init__(targets: Sequence[QubitAttr | int])
Source code in xdsl/dialects/stim/ops.py
443 444 445 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
447 448 449 450 451 | |
ROp
dataclass
Bases: ResetOperation
Source code in xdsl/dialects/stim/ops.py
454 455 456 457 | |
name = 'stim.r'
class-attribute
instance-attribute
STIM_NAME: str = 'R'
class-attribute
RXOp
dataclass
Bases: ResetOperation
Source code in xdsl/dialects/stim/ops.py
460 461 462 463 | |
name = 'stim.rx'
class-attribute
instance-attribute
STIM_NAME: str = 'RX'
class-attribute
RYOp
dataclass
Bases: ResetOperation
Source code in xdsl/dialects/stim/ops.py
466 467 468 469 | |
name = 'stim.ry'
class-attribute
instance-attribute
STIM_NAME: str = 'RY'
class-attribute
MeasureResetOperation
Bases: StimPrintable, IRDLOperation, ABC
Base operation for combined measure-reset gates (MR, MRX, MRY).
Source code in xdsl/dialects/stim/ops.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
STIM_NAME: str
class-attribute
targets = prop_def(ArrayAttr[QubitAttr])
class-attribute
instance-attribute
flip_prob = opt_prop_def(FloatData)
class-attribute
instance-attribute
assembly_format = '(`flip_prob` $flip_prob^)? $targets attr-dict'
class-attribute
instance-attribute
__init__(targets: Sequence[QubitAttr | int], flip_prob: float | FloatData | None = None)
Source code in xdsl/dialects/stim/ops.py
489 490 491 492 493 494 495 496 497 498 499 | |
print_stim(printer: StimPrinter) -> None
Source code in xdsl/dialects/stim/ops.py
501 502 503 504 505 506 507 | |
MROp
dataclass
Bases: MeasureResetOperation
Source code in xdsl/dialects/stim/ops.py
510 511 512 513 | |
name = 'stim.mr'
class-attribute
instance-attribute
STIM_NAME: str = 'MR'
class-attribute
MRXOp
dataclass
Bases: MeasureResetOperation
Source code in xdsl/dialects/stim/ops.py
516 517 518 519 | |
name = 'stim.mrx'
class-attribute
instance-attribute
STIM_NAME: str = 'MRX'
class-attribute
MRYOp
dataclass
Bases: MeasureResetOperation
Source code in xdsl/dialects/stim/ops.py
522 523 524 525 | |