Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
MarginalizeCounts¶
- class MarginalizeCounts(qubits_to_keep, validate=True)[source]¶
A data action to marginalize count dictionaries.
This data action takes a count dictionary and returns a new count dictionary that is marginalized over a set of specified qubits. For example, given the count dictionary
{"010": 1, "110": 10, "100": 100}
this node will return the count dictionary{"10": 11, "00": 100}
when marginalized over qubit 2.Note
This data action can be used to discard one or more qubits in the counts dictionary. This is, for example, useful when processing two-qubit restless experiments but can be used in a more general context. In composite experiments the counts marginalization is already done in the data container.
Initialize a counts marginalization node.
- Parameters:
qubits_to_keep (
Set
[int
]) – A set of qubits to retain during the marginalization process.validate (
bool
) – If set to False the DataAction will not validate its input.
Methods
Call the data action of this node on the data.
Call the data action of this node on the data.