Skip to main content
IBM Quantum Platform

CombineRegistersNode

class samplomatic.samplex.nodes.CombineRegistersNode(output_type: VirtualType, output_register_name: str, num_output_subsystems: int, operands: dict[str, tuple[Sequence[int], Sequence[int], VirtualType]])

GitHub

Bases: EvaluationNode

Composes one or more registers into a new register.

The registers are composed in the order of operands.

The new register can be larger than any of the registers being composed. In this case, any slice of the new register that remains untouched is initialized to identity. Therefore, this node can be used for virtual gate multiplication of registers of the same type, for tensoring subsystems, for slicing registers, for implicit identity insertion, and for subsystem reordering.

Parameters

  • output_type – What type of register type to collect into.
  • output_register_name – The name of the output register.
  • num_output_subsystems – The number of subsystems of the output register.
  • operands – A map from register names to tuples (source_idxs, destination_idxs, input_type) where source_idxs slices the input register, destination_idxs is of the same length and slices the output register, dictating the location into which to multiply, and input_type is the type of the input register. The order of this map is in standard matrix multiplication order.

Raises

Attributes Summary

Column 1
Column 2
outgoing_register_typeThe virtual gate type of outgoing registers.

Methods Summary

Column 1
Column 2
evaluate(registers, *_)Evaluate this node.
get_style()Return the style of this node when plotted.
instantiates()Return a manifest of new virtual registers that this node instantiates.
reads_from()Return a manifest of which virtual register values this node needs to read from.
validate_and_update(register_descriptions)Validate provided register descriptions are compatible, update with changes.

Attributes Documentation

outgoing_register_type

Methods Documentation

evaluate

evaluate(registers, *_)

GitHub

Evaluate this node.

Parameters

  • registers – At least those registers needed by this node to read from or write to.
  • parameter_values – Parameter values to use during evaluation.

Raises

SamplexRuntimeError – If the number of parameter values received does not equal the number required by this node.

get_style

get_style()

GitHub

Return the style of this node when plotted.

instantiates

instantiates()

GitHub

Return a manifest of new virtual registers that this node instantiates.

Note
  • To change the type or size of a register, both instantiate and remove it.
  • Do not specify reads_from() or writes_to() for an instantiated register, these powers are implicit.

reads_from

reads_from()

GitHub

Return a manifest of which virtual register values this node needs to read from.

validate_and_update

validate_and_update(register_descriptions)

GitHub

Validate provided register descriptions are compatible, update with changes.

This method can be used by a samplex to determine when a node execution order has well-defined dependencies before sampling begins.

Parameters

register_descriptions – A map from existing register names to their size and type.

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