U2Register
class samplomatic.virtual_registers.U2Register(virtual_gates: ndarray)
Bases: GroupRegister
Virtual register of 2x2 Unitary matrices.
The equality method of this class is overridden to ignore global phase.
Attributes Summary
Column 1 | Column 2 |
|---|---|
CONVERTABLE_TYPES | Valid arguments for convert_to(). |
GATE_SHAPE | The array shape of any single virtual gate. |
SUBSYSTEM_SIZE | The number of qubits each virtual gate acts on. |
TYPE | The group name in 1-1 correspondence with this virtual gate type. |
Methods Summary
Column 1 | Column 2 |
|---|---|
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
Type: frozenset[VirtualType]
Default value: frozenset({VirtualType.U2})
Valid arguments for convert_to().
GATE_SHAPE
SUBSYSTEM_SIZE
TYPE
Type: VirtualType
Default value: 'u2'
The group name in 1-1 correspondence with this virtual gate type.
Methods Documentation
identity
classmethod identity(num_subsystems, num_samples)
Instantiate a new register of identity virtual gates.
inplace_multiply
inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))
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.
invert
left_inplace_multiply
left_inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))
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
left_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))
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
multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))
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.