randomized_measureยถ

EchoListenRandomized - Wave Function Overlap by Randomized Measure (qurry.qurrech.randomized_measure)

argumentsยถ

EchoListenRandomized - Arguments (qurry.qurrech.randomized_measure.arguments)

class qurry.qurrech.randomized_measure.arguments.EchoListenRandomizedAnalyzeArgs[source]ยถ

The input of the analyze method.

backend: Literal['Cython', 'Rust', 'Python'] | strยถ

The backend for the process.

counts_used: Iterable[int] | Noneยถ

The index of the counts used.

selected_classical_registers: Iterable[int] | Noneยถ

The list of the index of the selected_classical_registers. Itโ€™s not the qubit index of first or second quantum circuit, but their corresponding classical registers.

class qurry.qurrech.randomized_measure.arguments.EchoListenRandomizedArguments(exp_name: str = 'exps', times: int = 100, qubits_measured_1: list[int] | None = None, qubits_measured_2: list[int] | None = None, registers_mapping_1: dict[int, int] | None = None, registers_mapping_2: dict[int, int] | None = None, actual_num_qubits_1: int = 0, actual_num_qubits_2: int = 0, unitary_located_mapping_1: dict[int, int] | None = None, unitary_located_mapping_2: dict[int, int] | None = None, second_backend: Backend | str | None = None, second_transpile_args: TranspileArgs | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None)[source]ยถ

Arguments for the experiment.

actual_num_qubits_1: int = 0ยถ

The actual number of qubits of the first quantum circuit.

actual_num_qubits_2: int = 0ยถ

The actual number of qubits of the second quantum circuit.

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โ€™.

qubits_measured_1: list[int] | None = Noneยถ

The measure range for the first quantum circuit.

qubits_measured_2: list[int] | None = Noneยถ

The measure range for the second quantum circuit.

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.

registers_mapping_1: dict[int, int] | None = Noneยถ

The mapping of the classical registers with quantum registers. for the first quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the classical register with the numerical order.

registers_mapping_2: dict[int, int] | None = Noneยถ

The mapping of the classical registers with quantum registers. for the second quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the classical register with the numerical order.

second_backend: Backend | str | None = Noneยถ

The extra backend for the second quantum circuit. If None, then use the same backend as the first quantum circuit.

second_transpile_args: TranspileArgs | None = Noneยถ

Arguments of qiskit.compiler.transpile() or :cls:`qiskit.transpiler.passmanager.PassManager` for the second quantum circuit. And it only works when the second backend is given.

times: int = 100ยถ

The number of random unitary operator. It will denote as N_U in the experiment name.

unitary_located_mapping_1: dict[int, int] | None = Noneยถ

The range of the unitary operator for the first quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the unitary operator with the numerical order.

unitary_located_mapping_2: dict[int, int] | None = Noneยถ

The range of the unitary operator for the second quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the unitary operator with the numerical order.

class qurry.qurrech.randomized_measure.arguments.EchoListenRandomizedMeasureArgs[source]ยถ

Output arguments for output().

measure_1: tuple[int, int] | int | list[int] | Noneยถ

The measure range for the first quantum circuit.

measure_2: tuple[int, int] | int | list[int] | Noneยถ

The measure range for the second quantum circuit.

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.

second_backend: Backend | Noneยถ

The extra backend for the second group of quantum circuits. If None, then use the same backend as the first quantum circuit.

second_passmanager: str | PassManager | tuple[str, PassManager] | Noneยถ

The passmanager for the second quantum circuit.

second_transpile_args: TranspileArgs | Noneยถ

The transpile arguments for the second group of quantum circuits.

times: intยถ

The number of random unitary operator. It will denote as N_U in the experiment name.

unitary_loc_1: tuple[int, int] | int | list[int] | Noneยถ

The range of the unitary operator for the first quantum circuit.

unitary_loc_2: tuple[int, int] | int | list[int] | Noneยถ

The range of the unitary operator for the second quantum circuit.

unitary_loc_not_cover_measure: boolยถ

Whether the range of the unitary operator is not cover the measure range.

wave1: QuantumCircuit | Hashable | Noneยถ

The key or the circuit to execute.

wave2: QuantumCircuit | Hashable | Noneยถ

The key or the circuit to execute.

class qurry.qurrech.randomized_measure.arguments.EchoListenRandomizedOutputArgs[source]ยถ

Output arguments for output().

measure_1: tuple[int, int] | int | list[int] | Noneยถ

The measure range for the first quantum circuit.

measure_2: tuple[int, int] | int | list[int] | Noneยถ

The measure range for the second quantum circuit.

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.

second_backend: Backend | Noneยถ

The extra backend for the second quantum circuit. If None, then use the same backend as the first quantum circuit.

second_passmanager_pair: tuple[str, PassManager] | Noneยถ

The passmanager for the second quantum circuit.

second_transpile_args: TranspileArgs | Noneยถ

The transpile arguments for the second group of quantum circuits.

times: intยถ

The number of random unitary operator. It will denote as N_U in the experiment name.

unitary_loc_1: tuple[int, int] | int | list[int] | Noneยถ

The range of the unitary operator for the first quantum circuit.

unitary_loc_2: tuple[int, int] | int | list[int] | Noneยถ

The range of the unitary operator for the second quantum circuit.

unitary_loc_not_cover_measure: boolยถ

Confirm that not all unitary operator are covered by the measure.

analysisยถ

EchoListenRandomized - Analysis (qurry.qurrech.randomized_measure.analysis)

class qurry.qurrech.randomized_measure.analysis.ELRAnalysisContent(echo: float, echoSD: float, echoCells: dict[int, float], num_classical_registers: int, classical_registers: list[int] | None, classical_registers_actually: list[int], counts_num: int, taking_time: float, counts_used: Iterable[int] | None = None)[source]ยถ

The content of the analysis.

classical_registers: list[int] | Noneยถ

The list of the index of the selected classical registers.

classical_registers_actually: list[int]ยถ

The list of the index of the selected classical registers which is actually used.

counts_num: intยถ

The number of first counts and second counts.

counts_used: Iterable[int] | Noneยถ

The index of the counts used. If not specified, then use all counts.

echo: floatยถ

The overlap value.

echoCells: dict[int, float]ยถ

The overlap of each single count.

echoSD: floatยถ

The overlap standard deviation.

num_classical_registers: intยถ

The number of classical registers.

taking_time: floatยถ

The calculation time.

class qurry.qurrech.randomized_measure.analysis.ELRAnalysisInput(registers_mapping_1: dict[int, int], registers_mapping_2: dict[int, int], bitstring_mapping_1: dict[int, int] | None, bitstring_mapping_2: dict[int, int] | None, shots: int, unitary_located_mapping_1: dict[int, int], unitary_located_mapping_2: dict[int, int])[source]ยถ

To set the analysis.

bitstring_mapping_1: dict[int, int] | Noneยถ

The mapping of the bitstring with the classical registers. When there are mulitple classical registers, the bitstring is the concatenation of the classical registers with space on bitstring. For example, there are three registers with the size of 4, 4, and 6, which the first six bits are for the randomized measurement.

So, the mapping will be like this.

{
    0: 10, # The classical register 0 is mapped to the bitstring on the index 0.
    1: 11, # The classical register 0 is mapped to the bitstring on the index 1.
    2: 12, # The classical register 0 is mapped to the bitstring on the index 2.
    3: 13, # The classical register 0 is mapped to the bitstring on the index 3.
    4: 14, # The classical register 0 is mapped to the bitstring on the index 4.
    5: 15, # The classical register 0 is mapped to the bitstring on the index 5.
}

But, if there is only one classical register, the bitstring will map to the classical register directly.

Will be like this.

bitstring_mapping_2: dict[int, int] | Noneยถ

The mapping of the bitstring with the classical registers. When there are mulitple classical registers, the bitstring is the concatenation of the classical registers with space on bitstring. For example, there are three registers with the size of 4, 4, and 6, which the first six bits are for the randomized measurement.

So, the mapping will be like this.

{
    0: 10, # The classical register 0 is mapped to the bitstring on the index 0.
    1: 11, # The classical register 0 is mapped to the bitstring on the index 1.
    2: 12, # The classical register 0 is mapped to the bitstring on the index 2.
    3: 13, # The classical register 0 is mapped to the bitstring on the index 3.
    4: 14, # The classical register 0 is mapped to the bitstring on the index 4.
    5: 15, # The classical register 0 is mapped to the bitstring on the index 5.
}

But, if there is only one classical register, the bitstring will map to the classical register directly.

Will be like this.

registers_mapping_1: dict[int, int]ยถ

The mapping of the classical registers with quantum registers. for the first quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the classical register with the numerical order.

registers_mapping_2: dict[int, int]ยถ

The mapping of the classical registers with quantum registers. for the second quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the classical register with the numerical order.

shots: intยถ

The number of shots.

unitary_located_mapping_1: dict[int, int]ยถ

The range of the unitary operator for the first quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the unitary operator with the numerical order.

unitary_located_mapping_2: dict[int, int]ยถ

The range of the unitary operator for the second quantum circuit.

The key is the index of the quantum register with the numerical order. The value is the index of the unitary operator with the numerical order.

class qurry.qurrech.randomized_measure.analysis.EchoListenRandomizedAnalysis(*, serial: int, log: dict[str, Any] | None = None, datatime: str | None = None, **other_kwargs)[source]ยถ

The analysis of loschmidt echo.

classmethod content_type() Type[ELRAnalysisContent][source]ยถ

The content instance type.

classmethod input_type() Type[ELRAnalysisInput][source]ยถ

The input instance type.

property side_product_fields: Iterable[str]ยถ

The fields that will be stored as side product.

utilsยถ

EchoListenRandomized - Utility (qurry.qurrech.randomized_measure.utils)

qurry.qurrech.randomized_measure.utils.create_config(actual_qubits: int, measure: tuple[int, int] | int | list[int] | None, unitary_loc: tuple[int, int] | int | None, which_circuit: Literal['1', '2'])[source]ยถ

Create the configuration for the randomized measure.

Parameters:
  • actual_qubits (int) โ€“ The number of qubits in the circuit.

  • measure (Optional[Union[list[int], tuple[int, int], int]]) โ€“ The selected qubits for the measurement. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits.

  • unitary_loc (Optional[Union[tuple[int, int], int]]) โ€“ The range of the unitary operator.

  • which_circuit (Literal["1", "2"]) โ€“ Which circuit this configuration belongs to.

Returns:

A tuple containing: - registers_mapping:

The mapping of the index of selected qubits to the index of the classical register.

  • qubits_measured:

    The list of qubits that are measured.

  • unitary_located_mapping:

    The mapping of the index of unitary operator to the index of the classical register.

  • measured_but_not_unitary_located:

    The list of qubits that are measured but not located in the unitary operator.

Return type:

tuple[dict[int, int], list[int], dict[int, int], list[int]]

qurry.qurrech.randomized_measure.utils.overlapping_given_check(actual_qubits_1: int, actual_qubits_2: int, measure_1: tuple[int, int] | int | list[int] | None = None, measure_2: tuple[int, int] | int | list[int] | None = None, unitary_loc_1: tuple[int, int] | int | None = None, unitary_loc_2: tuple[int, int] | int | None = None)[source]ยถ

Check whether the two circuits have overlapping qubits.

Parameters:
  • actual_qubits_1 (int) โ€“ The number of qubits in the first circuit.

  • actual_qubits_2 (int) โ€“

    The number of qubits in the second circuit. measure_1 (Optional[Union[list[int], tuple[int, int], int]], optional):

    The selected qubits for the measurement for the first quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

    measure_2 (Optional[Union[list[int], tuple[int, int], int]], optional):

    The selected qubits for the measurement for the second quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

    unitary_loc_1 (Optional[Union[list[int], tuple[int, int], int]], optional):

    The range of the unitary operator for the first quantum circuit. Defaults to None.

    unitary_loc_2 (Optional[Union[list[int], tuple[int, int], int]], optional):

    The range of the unitary operator for the second quantum circuit. Defaults to None.

Raises:

ValueError โ€“ If the number of qubits in the two circuits is not the same and the measure range or unitary location is not specified.

qurry.qurrech.randomized_measure.utils.overlapping_size_check(qubits_measured_1: list[int], qubits_measured_2: list[int], unitary_located_mapping_1: dict[int, int], unitary_located_mapping_2: dict[int, int])[source]ยถ

Check whether the size of the qubits measured and unitary located mapping are the same.

Parameters:
  • qubits_measured_1 (list[int]) โ€“ The qubits measured in the first circuit.

  • qubits_measured_2 (list[int]) โ€“ The qubits measured in the second circuit.

  • unitary_located_mapping_1 (dict[int, int]) โ€“ The unitary located mapping in the first circuit.

  • unitary_located_mapping_2 (dict[int, int]) โ€“ The unitary located mapping in the second circuit.

Raises:

OverlapComparisonSizeDifferent โ€“ If the size of the qubits measured or unitary located mapping in the two circuits are different.

qurry.qurrech.randomized_measure.utils.unitary_full_cover_check(unitary_loc_not_cover_measure: bool, measured_but_not_unitary_located_1: list[int], measured_but_not_unitary_located_2: list[int], measure_1: tuple[int, int] | int | list[int] | None = None, measure_2: tuple[int, int] | int | list[int] | None = None, unitary_loc_1: tuple[int, int] | int | None = None, unitary_loc_2: tuple[int, int] | int | None = None)[source]ยถ

Check whether the unitary operator covers the measurement.

Parameters:
  • unitary_loc_not_cover_measure (bool) โ€“ If True, the unitary operator does not cover the measurement.

  • measured_but_not_unitary_located_1 (list[int]) โ€“ The qubits that are measured but not located in the first circuit.

  • measured_but_not_unitary_located_2 (list[int]) โ€“ The qubits that are measured but not located in the second circuit.

  • measure_1 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the first quantum circuit. Defaults to None.

  • measure_2 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the second quantum circuit. Defaults to None.

  • unitary_loc_1 (Optional[Union[tuple[int, int], int]], optional) โ€“ The range of the unitary operator for the first quantum circuit. Defaults to None.

  • unitary_loc_2 (Optional[Union[tuple[int, int], int]], optional) โ€“ The range of the unitary operator for the second quantum circuit. Defaults to None.

Raises:

RandomizedMeasureUnitaryOperatorNotFullCovering โ€“ If the unitary operator does not cover the measurement and unitary_loc_not_cover_measure is False.

experimentยถ

EchoListenRandomized - Experiment (qurry.qurrech.randomized_measure.experiment)

class qurry.qurrech.randomized_measure.experiment.EchoListenRandomizedExperiment(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[EchoListenRandomizedAnalysis]ยถ

The analysis instance for this experiment.

analyze(selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', counts_used: Iterable[int] | None = None, pbar: tqdm | None = None) EchoListenRandomizedAnalysis[source]ยถ

Calculate wave function overlap with more information combined.

Parameters:
  • selected_classical_registers (Optional[Iterable[int]], optional) โ€“ The list of the index of the selected_classical_registers. Itโ€™s not the qubit index of first or second quantum circuit, but their corresponding classical registers. Defaults to None.

  • backend (PostProcessingBackendLabel, optional) โ€“ The backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.

  • counts_used (Optional[Iterable[int]], optional) โ€“ The index of the counts used. Defaults to None.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar API, you can use put a :cls:`tqdm` object here. This function will update the progress bar description. Defaults to None.

Returns:

The result of the experiment

Return type:

EchoListenRandomizedAnalysis

property arguments_instance: Type[EchoListenRandomizedArguments]ยถ

The arguments instance for this experiment.

classmethod build(targets: list[tuple[Hashable, QuantumCircuit]], 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_pair: tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, serial: int | None = None, summoner_id: Hashable | None = None, summoner_name: str | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None, multiprocess: bool = True, second_passmanager_pair: tuple[str, PassManager] | None = None, **custom_and_main_kwargs: Any)[source]ยถ

Construct the experiment.

Parameters:
  • targets (list[tuple[Hashable, QuantumCircuit]]) โ€“ The circuits of the experiment.

  • 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 โ€˜experimentโ€™.

  • run_args (RunArgsType, optional) โ€“ Arguments for Backend.run(). Defaults to None.

  • transpile_args (Optional[TranspileArgs], optional) โ€“ Arguments of transpile() from qiskit.compiler.transpiler. Defaults to None.

  • passmanager_pair (Optional[tuple[str, PassManager]], optional) โ€“ The passmanager pair for transpile. Defaults to None.

  • tags (Optional[tuple[str, ...]], optional) โ€“ Given the experiment multiple tags to make a dictionary for recongnizing it. Defaults to None.

  • serial (Optional[int], optional) โ€“ Index of experiment in a multiOutput. !!ATTENTION, this should only be used by `Multimanager`!! Defaults to None.

  • summoner_id (Optional[Hashable], optional) โ€“ ID of experiment of :cls:`MultiManager`. !!ATTENTION, this should only be used by `Multimanager`!! Defaults to None.

  • summoner_name (Optional[str], optional) โ€“ Name of experiment of :cls:`MultiManager`. !!ATTENTION, this should only be used by `Multimanager`!! _description_. Defaults to None.

  • qasm_version (Literal["qasm2", "qasm3"], optional) โ€“ The export 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.

  • multiprocess (bool, optional) โ€“ Whether to use multiprocessing. Defaults to True.

  • second_passmanager_pair (Optional[tuple[str, PassManager]], optional) โ€“ The passmanager pair for transpile of the second circuit. Defaults to None.

  • custom_and_main_kwargs (Any) โ€“ Other custom arguments.

Returns:

The experiment.

Return type:

ExperimentPrototype

classmethod method(targets: list[tuple[Hashable, QuantumCircuit]], arguments: EchoListenRandomizedArguments, 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 (EchoListenRandomizedArguments) โ€“ 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:

tuple[list[QuantumCircuit], dict[str, Any]]

classmethod params_control(targets: list[tuple[Hashable, QuantumCircuit]], exp_name: str = 'exps', times: int = 100, measure_1: tuple[int, int] | int | list[int] | None = None, measure_2: tuple[int, int] | int | list[int] | None = None, unitary_loc_1: tuple[int, int] | int | None = None, unitary_loc_2: tuple[int, int] | int | None = None, unitary_loc_not_cover_measure: bool = False, second_backend: Backend | str | None = None, random_unitary_seeds: dict[int, dict[int, int]] | None = None, **custom_kwargs: Any) tuple[EchoListenRandomizedArguments, 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 โ€˜expsโ€™.

  • times (int) โ€“ The number of random unitary operator. Defaults to 100. It will denote as N_U in the experiment name.

  • measure_1 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the first quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • measure_2 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the second quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • unitary_loc_1 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The range of the unitary operator for the first quantum circuit. Defaults to None.

  • unitary_loc_2 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The range of the unitary operator for the second quantum circuit. Defaults to None.

  • unitary_loc_not_cover_measure (bool, optional) โ€“ Confirm that not all unitary operator are covered by the measure. If True, then close the warning. Defaults to False.

  • second_backend (Optional[Union[Backend, str]], optional) โ€“ The extra backend for the second quantum circuit. If None, then use the same backend as the first quantum circuit. 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 target circuits is not two.

  • TypeError โ€“ If times is not an integer.

  • ValueError โ€“ If the number of qubits in two circuits is not the same.

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, first_counts: list[dict[str, int]] | None = None, second_counts: list[dict[str, int]] | None = None, selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', pbar: tqdm | None = None) WaveFuctionOverlapResult[source]ยถ

Calculate entangled entropy with more information combined.

Parameters:
  • shots (int) โ€“ Shots of the experiment on quantum machine.

  • first_counts (list[dict[str, int]]) โ€“ Counts of the experiment on quantum machine.

  • second_counts (list[dict[str, int]]) โ€“ Counts of the experiment on quantum machine.

  • selected_classical_registers (Optional[Iterable[int]], optional) โ€“ The list of the index of the selected_classical_registers.

  • backend (ExistingProcessBackendLabel, optional) โ€“ Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar API, you can use put a :cls:`tqdm` object here. This function will update the progress bar description. Defaults to None.

Returns:

A dictionary contains purity, entropy,

a list of each overlap, puritySD, degree, actual measure range, bitstring range.

Return type:

WaveFuctionOverlapResult

result(export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) str[source]ยถ

Export the result of the experiment.

Parameters:
  • 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 ID of the experiment.

Return type:

str

run(pbar: tqdm | None = None) str[source]ยถ

Export the result after running the job.

Parameters:

pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar for showing the progress of the experiment. Defaults to None.

Raises:
Returns:

The ID of the experiment.

Return type:

str

qurryยถ

EchoListenRandomized - Qurrium (qurry.qurrech.randomized_measure.qurry)

class qurry.qurrech.randomized_measure.qurry.EchoListenRandomized[source]ยถ

Randomized Measure for wave function overlap. a.k.a. loschmidt echo when processes time evolution system.

Reference:

Note

  • Statistical correlations between locally randomized measurements:

A toolbox for probing entanglement in many-body quantum states - A. Elben, B. Vermersch, C. F. Roos, and P. Zoller, [PhysRevA.99.052323](

)

property experiment_instance: Type[EchoListenRandomizedExperiment]ยถ

The container class responding to this Qurrium class.

measure(wave1: QuantumCircuit | Hashable | None = None, wave2: QuantumCircuit | Hashable | None = None, times: int = 100, measure_1: tuple[int, int] | int | list[int] | None = None, measure_2: tuple[int, int] | int | list[int] | None = None, unitary_loc_1: tuple[int, int] | int | None = None, unitary_loc_2: tuple[int, int] | int | None = None, unitary_loc_not_cover_measure: bool = False, second_backend: Backend | None = None, second_transpile_args: TranspileArgs | None = None, second_passmanager: str | PassManager | tuple[str, PassManager] | 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:
  • wave1 (Union[QuantumCircuit, Hashable]) โ€“ The key or the circuit to execute.

  • wave2 (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_1 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the first quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • measure_2 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the second quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • unitary_loc_1 (Union[int, tuple[int, int], None], optional) โ€“ The range of the unitary operator for the first quantum circuit. Defaults to None.

  • unitary_loc_2 (Union[int, tuple[int, int], None], optional) โ€“ The range of the unitary operator for the second quantum circuit. Defaults to None.

  • unitary_loc_not_cover_measure (bool, optional) โ€“ Whether the range of the unitary operator is not cover the measure range. Defaults to False.

  • second_backend (Optional[Backend], optional) โ€“ The extra backend for the second quantum circuit. If None, then use the same backend as the first quantum circuit. Defaults to None.

  • second_transpile_args (Optional[TranspileArgs], optional) โ€“ Arguments of transpile() from qiskit.compiler.transpiler for the second quantum circuit. Defaults to None.

  • ( (second_passmanager) โ€“ Optional[Union[str, PassManager, tuple[str, PassManager]], optional

  • ) โ€“ The passmanager for the second quantum circuit. 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() from qiskit.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 ID of the experiment.

Return type:

str

measure_to_output(wave1: QuantumCircuit | Hashable | None = None, wave2: QuantumCircuit | Hashable | None = None, times: int = 100, measure_1: tuple[int, int] | int | list[int] | None = None, measure_2: tuple[int, int] | int | list[int] | None = None, unitary_loc_1: tuple[int, int] | int | None = None, unitary_loc_2: tuple[int, int] | int | None = None, unitary_loc_not_cover_measure: bool = False, second_backend: Backend | None = None, second_transpile_args: TranspileArgs | None = None, second_passmanager: str | PassManager | tuple[str, PassManager] | 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) EchoListenRandomizedOutputArgs[source]ยถ

Trasnform measure() arguments form into output() form.

Parameters:
  • wave1 (Union[QuantumCircuit, Hashable]) โ€“ The key or the circuit to execute.

  • wave2 (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_1 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the first quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • measure_2 (Optional[Union[list[int], tuple[int, int], int]], optional) โ€“ The selected qubits for the measurement for the second quantum circuit. If it is None, then it will return the mapping of all qubits. If it is int, then it will return the mapping of the last n qubits. If it is tuple, then it will return the mapping of the qubits in the range. If it is list, then it will return the mapping of the selected qubits. Defaults to None.

  • unitary_loc_1 (Union[int, tuple[int, int], None], optional) โ€“ The range of the unitary operator for the first quantum circuit. Defaults to None.

  • unitary_loc_2 (Union[int, tuple[int, int], None], optional) โ€“ The range of the unitary operator for the second quantum circuit. Defaults to None.

  • unitary_loc_not_cover_measure (bool, optional) โ€“ Whether the range of the unitary operator is not cover the measure range. Defaults to False.

  • second_backend (Optional[Backend], optional) โ€“ The extra backend for the second quantum circuit. If None, then use the same backend as the first quantum circuit. Defaults to None.

  • second_transpile_args (Optional[TranspileArgs], optional) โ€“ Arguments of transpile() from qiskit.compiler.transpiler for the second quantum circuit. Defaults to None.

  • ( (second_passmanager) โ€“ Optional[Union[str, PassManager, tuple[str, PassManager]], optional

  • ) โ€“ The passmanager for the second quantum circuit. 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() from qiskit.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:

EchoListenRandomizedOutputArgs

multiAnalysis(summoner_id: str, *, analysis_name: str = 'report', no_serialize: bool = False, specific_analysis_args: dict[Hashable, EchoListenRandomizedAnalyzeArgs | dict[str, Any] | bool] | None = None, skip_write: bool = False, multiprocess_write: bool = False, selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', counts_used: Iterable[int] | None = None, **analysis_args: dict[str, Any] | None) 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[EchoListenRandomizedAnalyzeArgs], 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.

  • selected_classical_registers (Optional[Iterable[int]], optional) โ€“ The list of the index of the selected_classical_registers. Itโ€™s not the qubit index of first or second quantum circuit, but their corresponding classical registers. Defaults to None.

  • backend (PostProcessingBackendLabel, optional) โ€“ The backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.

  • counts_used (Optional[Iterable[int]], optional) โ€“ The index of the counts used. Defaults to None.

Returns:

The summoner_id of multimanager.

Return type:

str

short_name = 'qurrech_randomized'ยถ

The short name of Qurrium.