---
title: CollectZ2ToOutputNode (latest version)
description: API reference for samplomatic.samplex.nodes.CollectZ2ToOutputNode in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/samplex-nodes-collect-z-2-to-output-node
---

# CollectZ2ToOutputNode

*class* `samplomatic.samplex.nodes.CollectZ2ToOutputNode(register_name: str, subsystem_idxs: Sequence[int], output_name: str, output_idxs: Sequence[str])`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L25-L89)

Bases: [`CollectionNode`](/docs/api/samplomatic/auto/samplex-nodes-collection-node "samplomatic.samplex.nodes.collection_node.CollectionNode")

Reads from [`Z2Register`](/docs/api/samplomatic/auto/virtual-registers-z-2-register "samplomatic.virtual_registers.Z2Register")s and writes to [`SamplexOutput`](/docs/api/samplomatic/auto/samplex-samplex-output "samplomatic.samplex.SamplexOutput").

**Parameters**

- **register\_name** – The name of the register to read from.
- **subsystem\_idxs** – The subsystems to read from.
- **output\_name** – The name of the output to write to.
- **output\_idxs** – The indices of the output to write to.

**Methods Summary**

|                                                                                                                                                                                             |                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [`collect`](#samplomatic.samplex.nodes.CollectZ2ToOutputNode.collect "samplomatic.samplex.nodes.CollectZ2ToOutputNode.collect")(registers, outputs, rng)                                    | Collect.                                                                         |
| [`get_style`](#samplomatic.samplex.nodes.CollectZ2ToOutputNode.get_style "samplomatic.samplex.nodes.CollectZ2ToOutputNode.get_style")()                                                     | Return the style of this node when plotted.                                      |
| [`outputs_to`](#samplomatic.samplex.nodes.CollectZ2ToOutputNode.outputs_to "samplomatic.samplex.nodes.CollectZ2ToOutputNode.outputs_to")()                                                  | Return the set of names of outputs this node mutates.                            |
| [`reads_from`](#samplomatic.samplex.nodes.CollectZ2ToOutputNode.reads_from "samplomatic.samplex.nodes.CollectZ2ToOutputNode.reads_from")()                                                  | Return a manifest of which virtual register values this node needs to read from. |
| [`validate_and_update`](#samplomatic.samplex.nodes.CollectZ2ToOutputNode.validate_and_update "samplomatic.samplex.nodes.CollectZ2ToOutputNode.validate_and_update")(register\_descriptions) | Validate provided register descriptions are compatible, update with changes.     |

**Methods Documentation**

### collect

`collect(registers, outputs, rng)`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L63-L68)

Collect.

**Parameters**

- **registers** – Registers to collect from.
- **outputs** – Where to output.
- **rng** – A randomness generator.

### get\_style

`get_style()`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L79-L89)

Return the style of this node when plotted.

### outputs\_to

`outputs_to()`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L50-L51)

Return the set of names of outputs this node mutates.

### reads\_from

`reads_from()`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L47-L48)

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

### validate\_and\_update

`validate_and_update(register_descriptions)`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/collect_z2_to_output_node.py#L53-L61)

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.
