40 lines
2.5 KiB
Plaintext
40 lines
2.5 KiB
Plaintext
---
|
||
title: marginal_memory
|
||
description: API reference for qiskit.result.marginal_memory
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.result.marginal_memory
|
||
---
|
||
|
||
<span id="qiskit-result-marginal-memory" />
|
||
|
||
# qiskit.result.marginal\_memory
|
||
|
||
<Function id="qiskit.result.marginal_memory" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.24/qiskit/result/utils.py" signature="marginal_memory(memory, indices=None, int_return=False, hex_return=False, avg_data=False, parallel_threshold=1000)">
|
||
Marginalize shot memory
|
||
|
||
This function is multithreaded and will launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
|
||
|
||
**Parameters**
|
||
|
||
* **memory** (*List\[str] |* [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v1.25)")) – The input memory list, this is either a list of hexadecimal strings to be marginalized representing measure level 2 memory or a numpy array representing level 0 measurement memory (single or avg) or level 1 measurement memory (single or avg).
|
||
* **indices** (*List\[int] | None*) – The bit positions of interest to marginalize over. If `None` (default), do not marginalize at all.
|
||
* **int\_return** (*bool*) – If set to `True` the output will be a list of integers. By default the return type is a bit string. This and `hex_return` are mutually exclusive and can not be specified at the same time. This option only has an effect with memory level 2.
|
||
* **hex\_return** (*bool*) – If set to `True` the output will be a list of hexadecimal strings. By default the return type is a bit string. This and `int_return` are mutually exclusive and can not be specified at the same time. This option only has an effect with memory level 2.
|
||
* **avg\_data** (*bool*) – If a 2 dimensional numpy array is passed in for `memory` this can be set to `True` to indicate it’s a avg level 0 data instead of level 1 single data.
|
||
* **parallel\_threshold** (*int*) – The number of elements in `memory` to start running in multiple threads. If `len(memory)` is >= this value, the function will run in multiple threads. By default this is set to 1000.
|
||
|
||
**Returns**
|
||
|
||
The list of marginalized memory
|
||
|
||
**Return type**
|
||
|
||
marginal\_memory
|
||
|
||
**Raises**
|
||
|
||
**ValueError** – if both `int_return` and `hex_return` are set to `True`
|
||
</Function>
|
||
|