U2Register¶
- class samplomatic.virtual_registers.U2Register(virtual_gates: ndarray)[source]¶
- Bases: - GroupRegister- Virtual register of 2x2 Unitary matrices. - The equality method of this class is overridden to ignore global phase. - Attributes Summary - Valid arguments for - convert_to().- The array shape of any single virtual gate. - The number of qubits each virtual gate acts on. - The group name in 1-1 correspondence with this virtual gate type. - Methods Summary - identity(num_subsystems, num_samples)- Instantiate a new register of identity virtual gates. - inplace_multiply(other[, subsystem_idxs])- Inplace-multiply each virtual gate with the corresponding element of - other.- invert()- Return a new virtual register that inverts each virtual gate. - left_inplace_multiply(other[, subsystem_idxs])- Left inplace-multiply each virtual gate with the corresponding element of - other.- left_multiply(other[, subsystem_idxs])- Left multiply each virtual gate with the corresponding element of - other.- multiply(other[, subsystem_idxs])- Multiply each virtual gate with the corresponding element of - other.- Attributes Documentation - CONVERTABLE_TYPES: frozenset[VirtualType] = frozenset({VirtualType.U2})¶
- Valid arguments for - convert_to().
 - TYPE: VirtualType = 'u2'¶
- The group name in 1-1 correspondence with this virtual gate type. 
 - Methods Documentation - classmethod identity(num_subsystems, num_samples)[source]¶
- Instantiate a new register of identity virtual gates. 
 - inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))[source]¶
- Inplace-multiply each virtual gate with the corresponding element of - other.- Parameters:
- other – Another virtual register of the same type. 
- subsystem_idxs – The indices of the subsystems to multiply, in self. 
 
- Raises:
- VirtualGateError – When the shapes do not match. 
 
 - left_inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))[source]¶
- Left inplace-multiply each virtual gate with the corresponding element of - other.- Parameters:
- other – Another virtual register of the same type. 
- subsystem_idxs – The indices of the subsystems to multiply, in self. 
 
- Raises:
- VirtualGateError – When the shapes do not match. 
 
 - left_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))[source]¶
- Left multiply each virtual gate with the corresponding element of - other.- Parameters:
- other – Another virtual register of the same type. 
- subsystem_idxs – The indices of the subsystems to multiply, in self. 
 
- Returns:
- A new virtual register of the same type. 
- Raises:
- VirtualGateError – When the shapes do not match. 
 
 - multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))[source]¶
- Multiply each virtual gate with the corresponding element of - other.- Parameters:
- other – Another virtual register of the same type. 
- subsystem_idxs – The indices of the subsystems to multiply, in self. 
 
- Returns:
- A new virtual register of the same type. 
- Raises:
- VirtualGateError – When the shapes do not match.