uniqc.circuit_builder.qubit module#
Named quantum register and qubit types.
This module provides: - Qubit: Named reference to a single qubit within a register - QReg: Named quantum register with indexing and slicing support - QRegSlice: Slice view of a QReg for multi-qubit operations
Example usage:
qr = QReg(name="a", size=4, base_index=0)
q0 = qr[0] # Qubit(name="a[0]", index=0, base_index=0)
q_slice = qr[1:3] # QRegSlice with qubits at indices 1, 2
int(q0) # 0 (physical qubit index)
int(qr[2]) # 2
- class uniqc.circuit_builder.qubit.QReg(name, size, base_index=0)[source]#
Bases:
objectNamed quantum register with indexing and slicing support.
QReg provides named access to qubits within a circuit, supporting integer indexing, negative indexing, and slicing.
- Variables:
name – Name of the register
size – Number of qubits in the register
base_index – Starting physical qubit index (set when mapped to circuit)
- Parameters:
Example
>>> qr = QReg(name="a", size=4, base_index=0) >>> qr[0] Qubit('a[0]', index=0, base_index=0) >>> qr[1:3] QRegSlice(a[1, 2]) >>> len(qr) 4
- class uniqc.circuit_builder.qubit.QRegSlice(register, indices)[source]#
Bases:
objectSlice view of a QReg for multi-qubit operations.
This class provides iteration and indexing over a subset of qubits from a parent register.
- Variables:
register – Parent QReg
indices – List of indices within the parent register
- Parameters: