CollectTemplateValues¶
- class samplomatic.samplex.nodes.CollectTemplateValues(template_params_name: str, template_idxs: ndarray[tuple[int, int], dtype[int64]], register_name: str, register_type: VirtualType, subsystem_idxs: ndarray[tuple[int], dtype[int64]], synth: Synth)[source]¶
Bases:
CollectionNodeCollects a register slice and writes corresponding template values to output.
- Parameters:
template_params_name – The name of the output to write template parameters to.
template_idxs – An array of shape
(num_subsystems, num_params_per_subsystem)specifying which entries of the entire template parameter value array to write to.register_name – The name of the register to collect.
register_type – What kind of register type to collect.
subsystem_idxs – The slice of the register to collect.
synth – A synth to take the product of register values and generate template parameter values.
- Raises:
SamplexConstructionError – If
register_typeis not compatible withsynth.SamplexConstructionError – If the second axis of
template_idxsdoes not matchSynth.num_params, or the first axis oftemplate_idxsdoes not match the number of subsystems in each entry ofregisters.
Attributes Summary
The number of subsystems being collected.
Methods Summary
collect(registers, outputs, rng)Collect.
Return the style of this node when plotted.
Return the set of names of outputs this node mutates.
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
- num_subsystems¶
The number of subsystems being collected.
Methods Documentation
- collect(registers, outputs, rng)[source]¶
Collect.
- Parameters:
registers – Registers to collect from.
outputs – Where to output.
rng – A randomness generator.
- reads_from()[source]¶
Return a manifest of which virtual register values this node needs to read from.
- validate_and_update(register_descriptions)[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.