rho_m_core
¶
Post Processing - Classical Shadow - Rho M Core
(qurry.process.classical_shadow.rho_m_core
)
- qurry.process.classical_shadow.rho_m_core.RhoMCoreMethod¶
Type for rho_m_core method. It can be either ânumpyâ, ânumpy_precomputedâ or ânumpy_flattenâ. - ânumpyâ: Use Numpy to calculate the rho_m. - ânumpy_precomputedâ: Use Numpy to calculate the rho_m with precomputed values. - ânumpy_flattenâ: Use Numpy to calculate the rho_m with a flattening workflow. Currently, ânumpy_precomputedâ is the best option for performance.
alias of
Literal
[ânumpyâ, ânumpy_precomputedâ] |str
|Literal
[ânumpy_flattenâ, âjax_flattenâ]
- qurry.process.classical_shadow.rho_m_core.rho_m_core(shots: int, counts: list[dict[str, int]], random_unitary_um: dict[int, dict[int, Literal[0, 1, 2] | int]], selected_classical_registers: list[int], rho_method: Literal['numpy', 'numpy_precomputed'] | str | Literal['numpy_flatten', 'jax_flatten'] = 'numpy_precomputed') tuple[list[ndarray[tuple[int, int], dtype[complex128]]], list[int], float] [source]¶
Rho M Cell Core calculation.
- Parameters:
shots (int) â The number of shots.
random_unitary_um (dict[int, dict[int, Union[Literal[0, 1, 2], int]]]) â The shadow direction of the unitary operators.
selected_classical_registers (list[int]) â The list of the index of the selected_classical_registers.
rho_method (RhoMCoreMethod, optional) â
The method to use for the calculation. Defaults to ânumpy_precomputedâ. It can be either ânumpyâ, ânumpy_precomputedâ, âjax_flattenâ, or ânumpy_flattenâ. - ânumpyâ:
Use Numpy to calculate the rho_m.
- ânumpy_precomputedâ:
Use Numpy to calculate the rho_m with precomputed values.
- ânumpy_flattenâ:
Use Numpy to calculate the rho_m with a flattening workflow.
Currently, ânumpy_precomputedâ is the best option for performance.
- Returns:
- tuple[
list[np.ndarray[tuple[int, int], np.dtype[np.complex128]]], list[int], float
- ]:
The dictionary of rho_m, the sorted list of the selected qubits, and calculation time.
- qurry.process.classical_shadow.rho_m_core.rho_m_core_py(shots: int, counts: list[dict[str, int]], random_unitary_um: dict[int, dict[int, Literal[0, 1, 2] | int]], selected_classical_registers: list[int], rho_method: Literal['numpy', 'numpy_precomputed'] | str = 'numpy_precomputed') tuple[list[ndarray[tuple[int, int], dtype[complex128]]], list[int], float] [source]¶
Rho M Cell Core calculation.
- Parameters:
shots (int) â The number of shots.
random_unitary_um (dict[int, dict[int, Union[Literal[0, 1, 2], int]]]) â The shadow direction of the unitary operators.
selected_classical_registers (list[int]) â The list of the index of the selected_classical_registers.
rho_method (RhoMKCellMethod, optional) â The method to use for the calculation. Defaults to âPython_precomputedâ. - ânumpyâ: Use Numpy to calculate the rho_m. - ânumpy_precomputedâ: Use Numpy to calculate the rho_m with precomputed values.
- Returns:
- tuple[
list[np.ndarray[tuple[int, int], np.dtype[np.complex128]]], list[int], float
- ]:
The dictionary of rho_m, the sorted list of the selected qubits, and calculation time.