Single-Qubit Gates
Single-qubit gates are unitary transformations that operate on individual qubits in the quantum register. Each gate applies a 2×2 unitary matrix to the target qubit while preserving the joint Hilbert space structure.Hadamard Gate (H)
The Hadamard gate creates an equal superposition between |0⟩ and |1⟩ basis states.Matrix Representation
Implementation
Fromquantum_computer.py:861-873:
Usage Example
Pauli-X Gate (X)
The Pauli-X gate is the quantum NOT gate, flipping |0⟩ ↔ |1⟩.Matrix Representation
Implementation
Fromquantum_computer.py:876-888:
Usage Example
Pauli-Y Gate (Y)
The Pauli-Y gate applies a π rotation around the Y-axis of the Bloch sphere.Matrix Representation
Implementation
Fromquantum_computer.py:890-902:
Usage Example
Pauli-Z Gate (Z)
The Pauli-Z gate applies a phase flip: |0⟩ → |0⟩, |1⟩ → -|1⟩.Matrix Representation
Implementation
Fromquantum_computer.py:904-916:
Usage Example
Identity Gate (I)
The identity gate leaves the qubit state unchanged. While not explicitly implemented as a separate gate class, it corresponds to applying no operation or can be represented using the gate registry.Matrix Representation
Usage
The identity operation is implicitly applied when no gate is specified for a qubit in a circuit layer.Gate Registry
All single-qubit gates are registered in the_GATE_REGISTRY dictionary (quantum_computer.py:1157-1174):
Technical Details
All single-qubit gates operate via the_single_qubit_unitary function (quantum_computer.py:737-784), which:
- Identifies basis state pairs (k0, k1) that differ only in the target qubit bit
- Applies the 2×2 unitary matrix to the amplitude pair:
- α’ = u[0,0]×α + u[0,1]×α_
- α’ = u[1,0]×α + u[1,1]×α_
- Handles complex multiplication of matrix elements with spatial wavefunctions
- Preserves the joint Hilbert space structure for entanglement
See Also
- Two-Qubit Gates - CNOT, CZ, SWAP operations
- Rotation Gates - Parameterized rotation gates
- Phase gates (S, T) for advanced quantum algorithms