Skip to main content
Single-qubit gates act on one Wire at a time. Every gate function in this reference is imported directly from b01t and can be called inside any decorated program body. Which gates are available depends on context: exact programs (@coherent, @primitive) reject parametric rotations, while broad programs (@parametric, @adaptive) accept all gates listed here. Calling a gate outside a decorated build context raises DSLValidationError.

Gate overview

* rz is allowed in broad-path phase blocks (@parametric) but is not in the exact gate set and cannot be used in @coherent or @primitive programs.

x

Pauli-X gate. Flips |0⟩ to |1⟩ and |1⟩ to |0⟩. This is the quantum analogue of a classical NOT gate. x is self-inverse: x(x(q)) = I. Allowed in: exact programs, compute blocks, phase blocks (no), top-level broad programs.
q
Wire
required
The target qubit wire.

h

Hadamard gate. Maps |0⟩ to (|0⟩ + |1⟩)/√2 and |1⟩ to (|0⟩ − |1⟩)/√2, creating an equal superposition. h is self-inverse. Allowed in: exact programs (top-level), top-level broad programs. Not allowed in compute or phase blocks — it is neither a permutation gate nor a diagonal gate.
q
Wire
required
The target qubit wire.

z

Pauli-Z gate. Leaves |0⟩ unchanged and maps |1⟩ to −|1⟩. z is self-inverse and is a diagonal gate. Allowed in: exact programs, phase blocks.
q
Wire
required
The target qubit wire.

s

S gate (phase gate). Applies a π/2 phase to |1⟩, equivalent to √Z. s and sdg are inverses of each other. Allowed in: exact programs, phase blocks.
q
Wire
required
The target qubit wire.

sdg

S-dagger gate (S†). The inverse of s. Applies a −π/2 phase to |1⟩. Allowed in: exact programs, phase blocks.
q
Wire
required
The target qubit wire.

t

T gate (π/8 gate). Applies a π/4 phase to |1⟩, equivalent to √S. Together with h and cx, the T gate generates a universal gate set. t and tdg are inverses. Allowed in: exact programs, phase blocks.
q
Wire
required
The target qubit wire.

tdg

T-dagger gate (T†). The inverse of t. Applies a −π/4 phase to |1⟩. Allowed in: exact programs, phase blocks.
q
Wire
required
The target qubit wire.

rx

Rotation about the X axis by angle theta (in radians). Parametric — not in the exact gate set. Allowed in: @parametric and @adaptive programs only. Raises DSLValidationError inside @coherent or @primitive.
theta
float
required
Rotation angle in radians.
q
Wire
required
The target qubit wire.

ry

Rotation about the Y axis by angle theta (in radians). Parametric — not in the exact gate set. Allowed in: @parametric and @adaptive programs only.
theta
float
required
Rotation angle in radians.
q
Wire
required
The target qubit wire.

rz

Rotation about the Z axis by angle theta (in radians). Parametric — not in the exact gate set. rz is a diagonal gate and is allowed in broad-path phase blocks inside @parametric programs. Allowed in: @parametric and @adaptive programs; allowed in broad-path phase blocks. Raises DSLValidationError inside @coherent or @primitive.
theta
float
required
Rotation angle in radians.
q
Wire
required
The target qubit wire.