Skip to main content
IBM Quantum Platform

Node

class samplomatic.samplex.nodes.Node

GitHub

Bases: object

Parent class for samplex node operations.

Attributes Summary

Column 1
Column 2
num_parametersThe number of parameter values this node requires at sampling time.
outgoing_register_typeThe virtual gate type of outgoing registers.
parameter_idxsWhich evaluated parameter expressions this node needs access to at sampling time.
trace_infoDebug trace information linking this node back to its originating box(es).

Methods Summary

Column 1
Column 2
get_style()Return the style of this node when plotted.
instantiates()Return a manifest of new virtual registers that this node instantiates.
outputs_to()Return the set of names of outputs this node mutates.
reads_from()Return a manifest of which virtual register values this node needs to read from.
removes()Return a manifest of virtual registers that this node removes.
validate_and_update(register_descriptions)Validate provided register descriptions are compatible, update with changes.
writes_to()Return a manifest of which virtual register values this node needs to write to.

Attributes Documentation

num_parameters

The number of parameter values this node requires at sampling time.

outgoing_register_type

The virtual gate type of outgoing registers.

parameter_idxs

Which evaluated parameter expressions this node needs access to at sampling time.

trace_info

Debug trace information linking this node back to its originating box(es).

Populated only when the samplex was built with debug=True. Contains annotation metadata such as tag and inject-noise refs from the box(es) that produced this node. This information is not serialized.

Methods Documentation

get_style

get_style() → NodeStyle

GitHub

Return the style of this node when plotted.

instantiates

instantiates() → dict[str, tuple[int, VirtualType]]

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.

outputs_to

outputs_to() → set[str]

GitHub

Return the set of names of outputs this node mutates.

reads_from

reads_from() → dict[str, tuple[set[int], VirtualType]]

GitHub

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

removes

removes() → set[str]

GitHub

Return a manifest of virtual registers that this node removes.

It is assumed that registers are removed as a last step; it is not ill-defined to read and write from a removed register.

validate_and_update

validate_and_update(register_descriptions: dict[str, tuple[int, VirtualType]])

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.

writes_to

writes_to() → dict[str, tuple[set[int], VirtualType]]

GitHub

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

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