Skip to main content
IBM Quantum Platform

U2Register

class samplomatic.virtual_registers.U2Register(virtual_gates: ndarray)

GitHub

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_TYPESValid arguments for convert_to().
GATE_SHAPEThe array shape of any single virtual gate.
SUBSYSTEM_SIZEThe number of qubits each virtual gate acts on.
TYPEThe 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

Type: tuple[int, ...]

Default value: (2, 2)

The array shape of any single virtual gate.

SUBSYSTEM_SIZE

Type: int

Default value: 1

The number of qubits each virtual gate acts on.

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)

GitHub

Instantiate a new register of identity virtual gates.

inplace_multiply

inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))

GitHub

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

invert()

GitHub

Return a new virtual register that inverts each virtual gate.

left_inplace_multiply

left_inplace_multiply(other, subsystem_idxs: list[int] | slice = slice(None, None, None))

GitHub

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))

GitHub

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))

GitHub

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.

Was this page helpful?
Report a bug, typo, or request content on GitHub.