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 src/bloqade/qasm2/_wrappers.py
103 104 105 106 107 108 109 110 111 112 |
|
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 src/bloqade/qasm2/_wrappers.py
319 320 321 322 323 324 325 326 327 328 329 |
|
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 src/bloqade/qasm2/_wrappers.py
305 306 307 308 309 310 311 312 313 314 315 316 |
|
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 src/bloqade/qasm2/_wrappers.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
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 src/bloqade/qasm2/_wrappers.py
33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
crx
crx(ctrl: Qubit, qarg: Qubit, theta: float) -> None
Controlled Rx rotation 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 |
Source code in src/bloqade/qasm2/_wrappers.py
332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
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 src/bloqade/qasm2/_wrappers.py
347 348 349 350 351 352 353 354 355 356 357 358 |
|
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 src/bloqade/qasm2/_wrappers.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
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 src/bloqade/qasm2/_wrappers.py
73 74 75 76 77 78 79 80 81 82 |
|
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 src/bloqade/qasm2/_wrappers.py
292 293 294 295 296 297 298 299 300 301 302 |
|
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 src/bloqade/qasm2/_wrappers.py
280 281 282 283 284 285 286 287 288 289 |
|
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 src/bloqade/qasm2/_wrappers.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
|
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 src/bloqade/qasm2/_wrappers.py
115 116 117 118 119 120 121 122 123 124 |
|
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 src/bloqade/qasm2/_wrappers.py
7 8 9 10 11 12 13 14 15 |
|
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 src/bloqade/qasm2/_wrappers.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
|
measure
measure(qarg: Qubit, cbit: Bit) -> None
Measure the qubit qarg
and store the result in the classical bit cbit
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qarg
|
Qubit
|
The qubit to measure. |
required |
cbit
|
Bit
|
The classical bit to store the result in. |
required |
Source code in src/bloqade/qasm2/_wrappers.py
61 62 63 64 65 66 67 68 69 70 |
|
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 src/bloqade/qasm2/_wrappers.py
18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
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 src/bloqade/qasm2/_wrappers.py
48 49 50 51 52 53 54 55 56 57 58 |
|
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 src/bloqade/qasm2/_wrappers.py
213 214 215 216 217 218 219 220 221 222 |
|
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 src/bloqade/qasm2/_wrappers.py
225 226 227 228 229 230 231 232 233 234 235 236 |
|
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 src/bloqade/qasm2/_wrappers.py
239 240 241 242 243 244 245 246 247 248 |
|
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 src/bloqade/qasm2/_wrappers.py
163 164 165 166 167 168 169 170 171 172 |
|
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 src/bloqade/qasm2/_wrappers.py
175 176 177 178 179 180 181 182 183 184 185 |
|
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 src/bloqade/qasm2/_wrappers.py
377 378 379 380 381 382 383 384 385 386 387 388 389 |
|
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 src/bloqade/qasm2/_wrappers.py
456 457 458 459 460 461 462 463 464 465 466 467 |
|
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 src/bloqade/qasm2/_wrappers.py
188 189 190 191 192 193 194 195 196 197 |
|
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 src/bloqade/qasm2/_wrappers.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
|
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 src/bloqade/qasm2/_wrappers.py
200 201 202 203 204 205 206 207 208 209 210 |
|
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 src/bloqade/qasm2/_wrappers.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
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 src/bloqade/qasm2/_wrappers.py
251 252 253 254 255 256 257 258 259 260 261 262 |
|
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 src/bloqade/qasm2/_wrappers.py
265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
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 src/bloqade/qasm2/_wrappers.py
127 128 129 130 131 132 133 134 135 136 |
|
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 src/bloqade/qasm2/_wrappers.py
139 140 141 142 143 144 145 146 147 148 |
|
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 src/bloqade/qasm2/_wrappers.py
151 152 153 154 155 156 157 158 159 160 |
|