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)
Bases: CollectionNode
Collects 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
Column 1 | Column 2 |
|---|---|
num_subsystems | The number of subsystems being collected. |
template_idxs | Specification of which entries of the template parameter value array to write to. |
Methods Summary
Column 1 | Column 2 |
|---|---|
collect(registers, outputs, rng) | Collect. |
get_style() | Return the style of this node when plotted. |
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. |
validate_and_update(register_descriptions) | Validate provided register descriptions are compatible, update with changes. |
Attributes Documentation
num_subsystems
The number of subsystems being collected.
template_idxs
Specification of which entries of the template parameter value array to write to.
Methods Documentation
collect
collect(registers, outputs, rng)
Collect.
Parameters
- registers – Registers to collect from.
- outputs – Where to output.
- rng – A randomness generator.
get_style
outputs_to
reads_from
validate_and_update
validate_and_update(register_descriptions)
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.