Index
barrier
barrier(qargs: tuple[Qubit, ...]) -> None
Barrier instruction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qargs
|
tuple[Qubit, ...]
|
The qubits to apply the barrier to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
131 132 133 134 135 136 137 138 139 140 |
|
ccx
ccx(ctrl1: Qubit, ctrl2: Qubit, qarg: Qubit) -> None
Toffoli gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl1
|
Qubit
|
The first control qubit. |
required |
ctrl2
|
Qubit
|
The second control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
422 423 424 425 426 427 428 429 430 431 432 |
|
ch
ch(ctrl: Qubit, qarg: Qubit) -> None
Controlled-Hadamard gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
396 397 398 399 400 401 402 403 404 405 406 407 |
|
cos
cos(value: float) -> float
Cosine math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to take the cosine of. |
required |
Returns:
Type | Description |
---|---|
float
|
The cosine of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
|
cp
cp(ctrl: Qubit, qarg: Qubit, lam: float) -> None
Controlled phase rotation gate. Same as cu1
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
506 507 508 509 510 511 512 513 514 515 516 517 |
|
creg
creg(n_bits: int) -> CReg
Create a new classical register with n_bits
bits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_bits
|
int
|
The number of bits in the register. |
required |
Returns:
Type | Description |
---|---|
CReg
|
The newly created classical register. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
crx
crx(ctrl: Qubit, qarg: Qubit, lam: float) -> None
Controlled Rx rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
448 449 450 451 452 453 454 455 456 457 458 459 460 |
|
cry
cry(ctrl: Qubit, qarg: Qubit, lam: float) -> None
Controlled Ry rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
463 464 465 466 467 468 469 470 471 472 473 474 475 |
|
crz
crz(ctrl: Qubit, qarg: Qubit, lam: float) -> None
Controlled Rz rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
478 479 480 481 482 483 484 485 486 487 488 489 |
|
cswap
cswap(ctrl: Qubit, qarg1: Qubit, qarg2: Qubit) -> None
Controlled Swap gate (Fredkin gate).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg1
|
Qubit
|
The first target qubit. |
required |
qarg2
|
Qubit
|
The second target qubit. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
435 436 437 438 439 440 441 442 443 444 445 |
|
csx
csx(ctrl: Qubit, qarg: Qubit) -> None
Controlled-Sqrt(X) gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
371 372 373 374 375 376 377 378 379 380 |
|
cu
cu(
ctrl: Qubit,
qarg: Qubit,
theta: float,
phi: float,
lam: float,
gamma: float,
) -> None
Controlled 4-parameter unitary gate.
This is equal to:
gate cu(theta,phi,lambda,gamma) c, t{ p(gamma) c; p((lambda+phi)/2) c; p((lambda-phi)/2) t; cx c,t; u(-theta/2,0,-(phi+lambda)/2) t; cx c,t; u(theta/2,phi,0) t; }
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
theta
|
float
|
The angle of rotation. |
required |
phi
|
float
|
The angle of rotation. |
required |
lam
|
float
|
The angle of rotation. |
required |
gamma
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
|
cu1
cu1(ctrl: Qubit, qarg: Qubit, lam: float) -> None
Controlled phase rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
492 493 494 495 496 497 498 499 500 501 502 503 |
|
cu3
cu3(
ctrl: Qubit,
qarg: Qubit,
theta: float,
phi: float,
lam: float,
) -> None
Controlled 3-parameter unitary gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
theta
|
float
|
The angle of rotation. |
required |
phi
|
float
|
The angle of rotation. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
|
cx
cx(ctrl: Qubit, qarg: Qubit) -> None
Controlled-X (CNOT) gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
83 84 85 86 87 88 89 90 91 92 |
|
cy
cy(ctrl: Qubit, qarg: Qubit) -> None
Controlled-Y gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
383 384 385 386 387 388 389 390 391 392 393 |
|
cz
cz(ctrl: Qubit, qarg: Qubit) -> None
Controlled-Z gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The control qubit. |
required |
qarg
|
Qubit
|
The target qubit |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
359 360 361 362 363 364 365 366 367 368 |
|
exp
exp(value: float) -> float
Exponential math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to exponentiate. |
required |
Returns:
Type | Description |
---|---|
float
|
The exponential of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
h
h(qarg: Qubit) -> None
Hadamard gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
155 156 157 158 159 160 161 162 163 164 |
|
id
id(qarg: Qubit) -> None
Identity gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
143 144 145 146 147 148 149 150 151 152 |
|
inline
inline(text: str) -> None
Inline QASM code into the current program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The QASM code to inline. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
9 10 11 12 13 14 15 16 17 |
|
ln
ln(value: float) -> float
logarithm math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to take the natural logarithm of. |
required |
Returns:
Type | Description |
---|---|
float
|
The natural logarithm of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
measure
measure(qreg: QReg, creg: CReg) -> None
measure(qarg: Qubit, cbit: Bit) -> None
measure(qarg, cbit) -> None
Measure the qubit qarg
and store the result in the classical bit cbit
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
The qubit to measure. |
required | |
cbit
|
The classical bit to store the result in. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
71 72 73 74 75 76 77 78 79 80 |
|
p
p(qarg: Qubit, lam: float) -> None
Phase gate.
This is equivalent to u(0,0,lam), and u1(lam)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
lam
|
float
|
The angle of phase. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
qreg
qreg(n_qubits: int) -> QReg
Create a new quantum register with n_qubits
qubits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_qubits
|
int
|
The number of qubits in the register. |
required |
Returns:
Type | Description |
---|---|
QReg
|
The newly created quantum register. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
reset
reset(qarg: Qubit) -> None
Reset the qubit qarg
to the |0⟩ state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to reset. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
50 51 52 53 54 55 56 57 58 59 60 |
|
rx
rx(qarg: Qubit, theta: float) -> None
Single qubit rotation about the X axis on block sphere
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
theta
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
292 293 294 295 296 297 298 299 300 301 |
|
rxx
rxx(ctrl: Qubit, qarg: Qubit, theta: float) -> None
XX rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The first qubit. |
required |
qarg
|
Qubit
|
The second qubit. |
required |
theta
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
566 567 568 569 570 571 572 573 574 575 576 577 |
|
ry
ry(qarg: Qubit, theta: float) -> None
Single qubit rotation about the Y axis on block sphere
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
theta
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
304 305 306 307 308 309 310 311 312 313 314 315 |
|
rz
rz(qarg: Qubit, theta: float) -> None
Single qubit rotation about the Z axis on block sphere
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
theta
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
318 319 320 321 322 323 324 325 326 327 |
|
rzz
rzz(ctrl: Qubit, qarg: Qubit, theta: float) -> None
ZZ rotation gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The first qubit. |
required |
qarg
|
Qubit
|
The second qubit. |
required |
theta
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
580 581 582 583 584 585 586 587 588 589 590 591 |
|
s
s(qarg: Qubit) -> None
S gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
218 219 220 221 222 223 224 225 226 227 |
|
sdg
sdg(qarg: Qubit) -> None
Hermitian conjugate of the S gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
230 231 232 233 234 235 236 237 238 239 240 |
|
sin
sin(value: float) -> float
Sine math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to take the sine of. |
required |
Returns:
Type | Description |
---|---|
float
|
The sine of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
594 595 596 597 598 599 600 601 602 603 604 605 606 |
|
sqrt
sqrt(value: float) -> float
Square root math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to take the square root of. |
required |
Returns:
Type | Description |
---|---|
float
|
The square root of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
673 674 675 676 677 678 679 680 681 682 683 684 |
|
swap
swap(ctrl: Qubit, qarg: Qubit) -> None
Swap gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctrl
|
Qubit
|
The first qubit. |
required |
qarg
|
Qubit
|
The second qubit. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
410 411 412 413 414 415 416 417 418 419 |
|
sx
sx(qarg: Qubit) -> None
Sqrt(X) gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
243 244 245 246 247 248 249 250 251 252 |
|
sxdg
sxdg(qarg: Qubit) -> None
Hermitian conjugate of Sqrt(X) gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
255 256 257 258 259 260 261 262 263 264 |
|
t
t(qarg: Qubit) -> None
T gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
267 268 269 270 271 272 273 274 275 276 |
|
tan
tan(value: float) -> float
Tangent math function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to take the tangent of. |
required |
Returns:
Type | Description |
---|---|
float
|
The tangent of |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
tdg
tdg(qarg: Qubit) -> None
Hermitian conjugate of the T gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
279 280 281 282 283 284 285 286 287 288 289 |
|
u
u(
qarg: Qubit, theta: float, phi: float, lam: float
) -> None
U gate.
Note
See https://arxiv.org/pdf/1707.03429 for definition of angles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
theta
|
float
|
The angle of rotation |
required |
phi
|
float
|
The angle of rotation |
required |
lam
|
float
|
The angle of rotation |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
u1
u1(qarg: Qubit, lam: float) -> None
1 Parameter single qubit unitary gate.
This is equivalent to u(0,0,lambda).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
330 331 332 333 334 335 336 337 338 339 340 341 |
|
u2
u2(qarg: Qubit, phi: float, lam: float) -> None
2 Parameter single qubit unitary gate.
This is equivalent to u(pi/2,phi,lambda)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
phi
|
float
|
The angle of rotation. |
required |
lam
|
float
|
The angle of rotation. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
u3
u3(
qarg: Qubit, theta: float, phi: float, lam: float
) -> None
U3 gate, same as u
Note
See https://arxiv.org/pdf/1707.03429 for definition of angles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
theta
|
float
|
The angle of rotation |
required |
phi
|
float
|
The angle of rotation |
required |
lam
|
float
|
The angle of rotation |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
x
x(qarg: Qubit) -> None
Pauli-X gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
167 168 169 170 171 172 173 174 175 176 |
|
y
y(qarg: Qubit) -> None
Pauli-Y gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
179 180 181 182 183 184 185 186 187 188 |
|
z
z(qarg: Qubit) -> None
Pauli-Z gate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to apply the gate to. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/_wrappers.py
191 192 193 194 195 196 197 198 199 200 |
|