randomized_measure_v1
¶
EntropyMeasureRandomizedV1 - The Second Order Renyi Entropy by Randomized Measurement
(qurry.qurrent.randomized_measure_v1
)
This is a deprecated version of the randomized measure module.
arguments
¶
EntropyMeasureRandomizedV1 - Arguments
(qurry.qurrent.randomized_measure_v1.arguments
)
This is a deprecated version of the randomized measure module.
- class qurry.qurrent.randomized_measure_v1.arguments.EntropyMeasureRandomizedV1AnalyzeArgs[source]¶
The input of the analyze method.
- class qurry.qurrent.randomized_measure_v1.arguments.EntropyMeasureRandomizedV1Arguments(exp_name: str = 'exps', times: int = 100, measure: tuple[int, int] | None = None, unitary_loc: tuple[int, int] | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None, workers_num: int = 16)[source]¶
Arguments for the experiment.
- exp_name: str = 'exps'¶
The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘experiment’.
- random_unitary_seeds: dict[int, dict[int, int]] | None = None¶
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
- class qurry.qurrent.randomized_measure_v1.arguments.EntropyMeasureRandomizedV1MeasureArgs[source]¶
Output arguments for
output()
.- random_unitary_seeds: dict[int, dict[int, int]] | None¶
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
- wave: QuantumCircuit | Hashable | None¶
The key or the circuit to execute.
- class qurry.qurrent.randomized_measure_v1.arguments.EntropyMeasureRandomizedV1OutputArgs[source]¶
Output arguments for
output()
.- random_unitary_seeds: dict[int, dict[int, int]] | None¶
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
analysis
¶
EntropyMeasureRandomizedV1 - Analysis
(qurry.qurrent.randomized_measure_v1.analysis
)
This is a deprecated version of the randomized measure module.
- class qurry.qurrent.randomized_measure_v1.analysis.EMRV1AnalysisContent(purity: float | None = None, entropy: float | None = None, puritySD: float | None = None, entropySD: float | None = None, purityCells: dict[int, float] | None = None, bitStringRange: tuple[int, int] | None = None, allSystemSource: str | Literal['independent'] | None = None, purityAllSys: float | None = None, entropyAllSys: float | None = None, puritySDAllSys: float | None = None, entropySDAllSys: float | None = None, purityCellsAllSys: dict[int, float] | None = None, bitsStringRangeAllSys: tuple[int, int] | None = None, errorRate: float | None = None, mitigatedPurity: float | None = None, mitigatedEntropy: float | None = None, num_qubits: int | None = None, measure: tuple[str, list[int] | tuple[int, int]] | None = None, measureActually: tuple[int, int] | None = None, measureActuallyAllSys: tuple[int, int] | None = None, countsNum: int | None = None, takingTime: float | None = None, takingTimeAllSys: float | None = None, counts_used: Iterable[int] | None = None)[source]¶
The content of the analysis.
- counts_used: Iterable[int] | None¶
The index of the counts used. If not specified, then use all counts.
- errorRate: float | None¶
The error rate of the measurement from depolarizing error migigation calculated.
- measure: tuple[str, list[int] | tuple[int, int]] | None¶
The qubit range of the measurement and text description.
The first element is the text description.
The second element is the qubit range of the measurement.
— - When the measurement is specified, it will be:
>>> ("measure range:", (0, 3))
When the measurement is not specified, it will be:
>>> ("not specified, use all qubits", (0, 3))
When null counts exist, it will be:
>>> ("The following is the index of null counts.", [0, 1, 2, 3])
- class qurry.qurrent.randomized_measure_v1.analysis.EMRV1AnalysisInput(degree: tuple[int, int], shots: int, unitary_loc: tuple[int, int] | None = None)[source]¶
To set the analysis.
- class qurry.qurrent.randomized_measure_v1.analysis.EntropyMeasureRandomizedV1Analysis(*, serial: int, log: dict[str, Any] | None = None, datatime: str | None = None, **other_kwargs)[source]¶
The container for the analysis of :cls:`EntropyRandomizedExperiment`.
- classmethod content_type() Type[EMRV1AnalysisContent] [source]¶
The content instance type.
- classmethod input_type() Type[EMRV1AnalysisInput] [source]¶
The input instance type.
utils
¶
EntropyMeasureRandomizedV1 - Utility
(qurry.qurrent.randomized_measure_v1.utils
)
This is a deprecated version of the randomized measure module.
- qurry.qurrent.randomized_measure_v1.utils.circuit_method_core_v1(idx: int, target_circuit: QuantumCircuit, target_key: Hashable, exp_name: str, unitary_loc: tuple[int, int], unitary_sublist: dict[int, Operator], measure: tuple[int, int]) QuantumCircuit [source]¶
Build the circuit for the experiment.
- Parameters:
- Returns:
The circuit for the experiment.
- Return type:
QuantumCircuit
- qurry.qurrent.randomized_measure_v1.utils.randomized_entangled_entropy_complex_v1(shots: int, counts: list[dict[str, int]], degree: tuple[int, int] | int | None, measure: tuple[int, int] | None = None, all_system_source: EntropyMeasureRandomizedV1Analysis | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', workers_num: int | None = None, pbar: tqdm | None = None) RandomizedEntangledEntropyMitigatedComplex [source]¶
Randomized entangled entropy with complex.
- Parameters:
shots (int) – The number of shots.
counts (list[dict[str, int]]) – The counts of the experiment.
degree (Optional[Union[tuple[int, int], int]]) – The degree of the experiment.
measure (Optional[tuple[int, int]], optional) – The measure range. Defaults to None.
all_system_source (Optional[EntropyRandomizedAnalysis], optional) – The source of all system. Defaults to None.
backend (PostProcessingBackendLabel, optional) – The backend label. Defaults to DEFAULT_PROCESS_BACKEND.
workers_num (Optional[int], optional) – The number of workers. Defaults to None.
pbar (Optional[tqdm.tqdm], optional) – The progress bar. Defaults to None.
- Returns:
The result of the experiment.
- Return type:
experiment
¶
EntropyMeasureRandomizedV1 - Experiment (qurry.qurrent.randomized_measure_v1.experiment
)
This is a deprecated version of the randomized measure module.
- class qurry.qurrent.randomized_measure_v1.experiment.EntropyMeasureRandomizedV1Experiment(arguments: _A | dict[str, Any], commonparams: Commonparams | dict[str, Any], outfields: dict[str, Any], beforewards: Before | None = None, afterwards: After | None = None, reports: AnalysesContainer | None = None)[source]¶
The instance of experiment.
- property analysis_instance: Type[EntropyMeasureRandomizedV1Analysis]¶
The analysis instance for this experiment.
- analyze(degree: tuple[int, int] | int | None = None, counts_used: Iterable[int] | None = None, workers_num: int | None = None, independent_all_system: bool = False, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', pbar: tqdm | None = None) EntropyMeasureRandomizedV1Analysis [source]¶
Calculate entangled entropy with more information combined.
- Parameters:
degree (Union[tuple[int, int], int]) – Degree of the subsystem.
counts_used (Optional[Iterable[int]], optional) – The index of the counts used. If not specified, then use all counts. Defaults to None.
workers_num (Optional[int], optional) – Number of multi-processing workers, if sets to 1, then disable to using multi-processing; if not specified, then use the number of all cpu counts - 2 by cpu_count() - 2. Defaults to None.
independent_all_system (bool, optional) – If True, then calculate the all system independently. Otherwise, use the existed all system source with same count_used.
backend (PostProcessingBackendLabel, optional) – Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.
pbar (Optional[tqdm.tqdm], optional) – Progress bar. Defaults to None.
- Returns:
The analysis of the experiment.
- Return type:
- property arguments_instance: Type[EntropyMeasureRandomizedV1Arguments]¶
The arguments instance for this experiment.
- classmethod method(targets: list[tuple[Hashable, QuantumCircuit]], arguments: EntropyMeasureRandomizedV1Arguments, pbar: tqdm | None = None, multiprocess: bool = True) tuple[list[QuantumCircuit], dict[str, Any]] [source]¶
The method to construct circuit.
- Parameters:
targets (list[tuple[Hashable, QuantumCircuit]]) – The circuits of the experiment.
arguments (EntropyMeasureRandomizedArguments) – The arguments of the experiment.
pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.
multiprocess (bool, optional) – Whether to use multiprocessing. Defaults to True.
- Returns:
The circuits of the experiment and the side products.
- Return type:
- classmethod params_control(targets: list[tuple[Hashable, QuantumCircuit]], exp_name: str = 'exps', times: int = 100, measure: tuple[int, int] | int | None = None, unitary_loc: tuple[int, int] | int | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None, **custom_kwargs: Any) tuple[EntropyMeasureRandomizedV1Arguments, Commonparams, dict[str, Any]] [source]¶
Handling all arguments and initializing a single experiment.
- Parameters:
targets (list[tuple[Hashable, QuantumCircuit]]) – The circuits of the experiment.
exp_name (str, optional) – The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘experiment’.
times (int) – The number of random unitary operator. Defaults to 100. It will denote as N_U in the experiment name.
measure (Optional[Union[tuple[int, int], int]]) – The measure range. Defaults to None.
unitary_loc (Optional[Union[tuple[int, int], int]]) – The range of the unitary operator. Defaults to None.
random_unitary_seeds (Optional[dict[int, dict[int, int]]], optional) –
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
custom_kwargs (Any) – The custom parameters.
- Raises:
ValueError – If the number of targets is not one.
TypeError – If times is not an integer.
ValueError – If the range of measure is not in the range of unitary_loc.
- Returns:
The arguments of the experiment, the common parameters, and the custom parameters.
- Return type:
tuple[EntropyMeasureRandomizedArguments, Commonparams, dict[str, Any]]
- classmethod quantities(shots: int | None = None, counts: list[dict[str, int]] | None = None, degree: tuple[int, int] | int | None = None, measure: tuple[int, int] | None = None, all_system_source: EntropyMeasureRandomizedV1Analysis | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', workers_num: int | None = None, pbar: tqdm | None = None) RandomizedEntangledEntropyMitigatedComplex [source]¶
Calculate entangled entropy.
- Parameters:
shots (int) – Shots of the experiment on quantum machine.
counts (list[dict[str, int]]) – Counts of the experiment on quantum machine.
degree (Optional[Union[tuple[int, int], int]]) – Degree of the subsystem.
measure (Optional[tuple[int, int]], optional) – Measuring range on quantum circuits. Defaults to None.
all_system_source (Optional['EntropyRandomizedAnalysis'], optional) – The source of the all system. Defaults to None.
backend (PostProcessingBackendLabel, optional) – Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.
workers_num (Optional[int], optional) – Number of multi-processing workers, it will be ignored if backend is Rust. if sets to 1, then disable to using multi-processing; if not specified, then use the number of all cpu counts by os.cpu_count(). Defaults to None.
pbar (Optional[tqdm.tqdm], optional) – Progress bar. Defaults to None.
- Returns:
- A dictionary contains
purity, entropy, a list of each overlap, puritySD, purity of all system, entropy of all system, a list of each overlap in all system, puritySD of all system, degree, actual measure range, actual measure range in all system, bitstring range.
- Return type:
qurry
¶
EntropyMeasureRandomizedV1 - Qurrium
(qurry.qurrent.randomized_measure_v1.qurry
)
This is a deprecated version of the randomized measure module.
- class qurry.qurrent.randomized_measure_v1.qurry.EntropyMeasureRandomizedV1[source]¶
Randomized Measure for entangled entropy. The entropy we compute is the Second Order Rényi Entropy.
Note
Probing Rényi entanglement entropy via randomized measurements -
Tiff Brydges, Andreas Elben, Petar Jurcevic, Benoît Vermersch, Christine Maier, Ben P. Lanyon, Peter Zoller, Rainer Blatt ,and Christian F. Roos , [doi:10.1126/science.aau4963](
Simple mitigation of global depolarizing errors in quantum simulations -
Vovrosh, Joseph and Khosla, Kiran E. and Greenaway, Sean and Self, Christopher and Kim, M. S. and Knolle, Johannes, [PhysRevE.104.035309](
@article{doi:10.1126/science.aau4963, author = {Tiff Brydges and Andreas Elben and Petar Jurcevic and Benoît Vermersch and Christine Maier and Ben P. Lanyon and Peter Zoller and Rainer Blatt and Christian F. Roos }, title = {Probing Rényi entanglement entropy via randomized measurements}, journal = {Science}, volume = {364}, number = {6437}, pages = {260-263}, year = {2019}, doi = {10.1126/science.aau4963}, URL = {https://www.science.org/doi/abs/10.1126/science.aau4963}, eprint = {https://www.science.org/doi/pdf/10.1126/science.aau4963}, abstract = {Quantum systems are predicted to be better at information processing than their classical counterparts, and quantum entanglement is key to this superior performance. But how does one gauge the degree of entanglement in a system? Brydges et al. monitored the build-up of the so-called Rényi entropy in a chain of up to 10 trapped calcium ions, each of which encoded a qubit. As the system evolved, interactions caused entanglement between the chain and the rest of the system to grow, which was reflected in the growth of the Rényi entropy. Science, this issue p. 260 The buildup of entropy in an ion chain reflects a growing entanglement between the chain and its complement. Entanglement is a key feature of many-body quantum systems. Measuring the entropy of different partitions of a quantum system provides a way to probe its entanglement structure. Here, we present and experimentally demonstrate a protocol for measuring the second-order Rényi entropy based on statistical correlations between randomized measurements. Our experiments, carried out with a trapped-ion quantum simulator with partition sizes of up to 10 qubits, prove the overall coherent character of the system dynamics and reveal the growth of entanglement between its parts, in both the absence and presence of disorder. Our protocol represents a universal tool for probing and characterizing engineered quantum systems in the laboratory, which is applicable to arbitrary quantum states of up to several tens of qubits.}} @article{PhysRevE.104.035309, title = {Simple mitigation of global depolarizing errors in quantum simulations}, author = {Vovrosh, Joseph and Khosla, Kiran E. and Greenaway, Sean and Self, Christopher and Kim, M. S. and Knolle, Johannes}, journal = {Phys. Rev. E}, volume = {104}, issue = {3}, pages = {035309}, numpages = {8}, year = {2021}, month = {Sep}, publisher = {American Physical Society}, doi = {10.1103/PhysRevE.104.035309}, url = {https://link.aps.org/doi/10.1103/PhysRevE.104.035309} }
- property experiment_instance: Type[EntropyMeasureRandomizedV1Experiment]¶
The container class responding to this QurryV5 class.
- measure(wave: QuantumCircuit | Hashable | None = None, times: int = 100, measure: int | tuple[int, int] | None = None, unitary_loc: int | tuple[int, int] | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) str [source]¶
Execute the experiment.
- Parameters:
wave (Union[QuantumCircuit, Hashable]) – The key or the circuit to execute.
times (int, optional) – The number of random unitary operator. It will denote as N_U in the experiment name. Defaults to 100.
measure (Union[int, tuple[int, int], None], optional) – The measure range. Defaults to None.
unitary_loc (Union[int, tuple[int, int], None], optional) – The range of the unitary operator. Defaults to None.
random_unitary_seeds (Optional[dict[int, dict[int, int]]], optional) –
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
shots (int, optional) – Shots of the job. Defaults to 1024.
backend (Optional[Backend], optional) – The quantum backend. Defaults to None.
exp_name (str, optional) – The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘exps’.
run_args (RunArgsType, optional) – Arguments for
Backend.run()
. Defaults to None.transpile_args (Optional[TranspileArgs], optional) – Arguments of
transpile()
fromqiskit.compiler.transpiler
. Defaults to None.passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) – The passmanager. Defaults to None.
tags (Optional[tuple[str, ...]], optional) – The tags of the experiment. Defaults to None.
qasm_version (Literal["qasm2", "qasm3"], optional) – The version of OpenQASM. Defaults to “qasm3”.
export (bool, optional) – Whether to export the experiment. Defaults to False.
save_location (Optional[Union[Path, str]], optional) – The location to save the experiment. Defaults to None.
pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.
- Returns:
The experiment ID.
- Return type:
- measure_to_output(wave: QuantumCircuit | Hashable | None = None, times: int = 100, measure: int | tuple[int, int] | None = None, unitary_loc: int | tuple[int, int] | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) EntropyMeasureRandomizedV1OutputArgs [source]¶
Trasnform
measure()
arguments form intooutput()
form.- Parameters:
wave (Union[QuantumCircuit, Hashable]) – The key or the circuit to execute.
times (int, optional) – The number of random unitary operator. It will denote as N_U in the experiment name. Defaults to 100.
measure (Union[int, tuple[int, int], None], optional) – The measure range. Defaults to None.
unitary_loc (Union[int, tuple[int, int], None], optional) – The range of the unitary operator. Defaults to None.
random_unitary_seeds (Optional[dict[int, dict[int, int]]], optional) –
The seeds for all random unitary operator. This argument only takes input as type of dict[int, dict[int, int]]. The first key is the index for the random unitary operator. The second key is the index for the qubit.
If you want to generate the seeds for all random unitary operator, you can use the function generate_random_unitary_seeds in qurry.qurrium.utils.random_unitary.
shots (int, optional) – Shots of the job. Defaults to 1024.
backend (Optional[Backend], optional) – The quantum backend. Defaults to None.
exp_name (str, optional) – The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘exps’.
run_args (RunArgsType, optional) – Arguments for
Backend.run()
. Defaults to None.transpile_args (Optional[TranspileArgs], optional) – Arguments of
transpile()
fromqiskit.compiler.transpiler
. Defaults to None.passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) – The passmanager. Defaults to None.
tags (Optional[tuple[str, ...]], optional) – The tags of the experiment. Defaults to None.
qasm_version (Literal["qasm2", "qasm3"], optional) – The version of OpenQASM. Defaults to “qasm3”.
export (bool, optional) – Whether to export the experiment. Defaults to False.
save_location (Optional[Union[Path, str]], optional) – The location to save the experiment. Defaults to None.
pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.
- Returns:
The output arguments.
- Return type:
- multiAnalysis(summoner_id: str, *, analysis_name: str = 'report', no_serialize: bool = False, specific_analysis_args: dict[Hashable, EntropyMeasureRandomizedV1AnalyzeArgs | dict[str, Any] | bool] | None = None, skip_write: bool = False, multiprocess_write: bool = False, degree: tuple[int, int] | int | None = None, counts_used: Iterable[int] | None = None, workers_num: int | None = None, independent_all_system: bool = False, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', **analysis_args) str [source]¶
Run the analysis for multiple experiments.
- Parameters:
summoner_id (str) – The summoner_id of multimanager.
analysis_name (str, optional) – The name of analysis. Defaults to ‘report’.
no_serialize (bool, optional) – Whether to serialize the analysis. Defaults to False.
specific_analysis_args – SpecificAnalsisArgs[EntropyMeasureRandomizedV1AnalyzeArgs], optional
) – The specific arguments for analysis. Defaults to None.
skip_write (bool, optional) – Whether to skip the file writing during the analysis. Defaults to False.
multiprocess_write (bool, optional) – Whether use multiprocess for writing. Defaults to False.
degree (Union[tuple[int, int], int]) – Degree of the subsystem.
counts_used (Optional[Iterable[int]], optional) – The index of the counts used. If not specified, then use all counts. Defaults to None.
workers_num (Optional[int], optional) – Number of multi-processing workers, if sets to 1, then disable to using multi-processing; if not specified, then use the number of all cpu counts - 2 by cpu_count() - 2. Defaults to None.
independent_all_system (bool, optional) – If True, then calculate the all system independently. Otherwise, use the existed all system source with same count_used.
backend (PostProcessingBackendLabel, optional) – Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.
- Returns:
The summoner_id of multimanager.
- Return type:
- short_name = 'qurrent_randomized_v1'¶
The short name of Qurrium.