Node¶
- class samplomatic.samplex.nodes.Node[source]¶
Bases:
objectParent class for samplex node operations.
Attributes Summary
The number of parameter values this node requires at sampling time.
The virtual gate type of outgoing registers.
Which evaluated parameter expressions this node needs access to at sampling time.
Methods Summary
Return the style of this node when plotted.
Return a manifest of new virtual registers that this node instantiates.
Return the set of names of outputs this node mutates.
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.
Return a manifest of which virtual register values this node needs to write to.
Attributes Documentation
- NODE_REGISTRY: set[type[Node]] = {<class 'samplomatic.samplex.nodes.change_basis_node.ChangeBasisNode'>, <class 'samplomatic.samplex.nodes.collect_template_values.CollectTemplateValues'>, <class 'samplomatic.samplex.nodes.collect_z2_to_output_node.CollectZ2ToOutputNode'>, <class 'samplomatic.samplex.nodes.combine_registers_node.CombineRegistersNode'>, <class 'samplomatic.samplex.nodes.conversion_node.ConversionNode'>, <class 'samplomatic.samplex.nodes.inject_noise_node.InjectNoiseNode'>, <class 'samplomatic.samplex.nodes.multiplication_node.LeftMultiplicationNode'>, <class 'samplomatic.samplex.nodes.multiplication_node.RightMultiplicationNode'>, <class 'samplomatic.samplex.nodes.pauli_past_clifford_node.PauliPastCliffordNode'>, <class 'samplomatic.samplex.nodes.slice_register_node.SliceRegisterNode'>, <class 'samplomatic.samplex.nodes.twirl_sampling_node.TwirlSamplingNode'>, <class 'samplomatic.samplex.nodes.u2_param_multiplication_node.LeftU2ParametricMultiplicationNode'>, <class 'samplomatic.samplex.nodes.u2_param_multiplication_node.RightU2ParametricMultiplicationNode'>}¶
- 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.
Methods Documentation
- instantiates() dict[str, tuple[int, VirtualType]][source]¶
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()orwrites_to()for an instantiated register, these powers are implicit.
- reads_from() dict[str, tuple[set[int], VirtualType]][source]¶
Return a manifest of which virtual register values this node needs to read from.
- removes() set[str][source]¶
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(register_descriptions: dict[str, tuple[int, VirtualType]])[source]¶
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.