hadamard_test

EntropyMeasureHadamard - The Second Order Renyi Entropy by Hadamard Test (qurry.qurrent.hadamard_test)

arguments

EntropyMeasureHadamard - Arguments (qurry.qurrent.hadamard_test.arguments)

class qurry.qurrent.hadamard_test.arguments.EntropyMeasureHadamardAnalyzeArgs[source]

The input of the analyze method.

The post-processing of Hadamard test does not need any input.

class qurry.qurrent.hadamard_test.arguments.EntropyMeasureHadamardArguments(exp_name: str = 'exps', degree: tuple[int, int] | None = None)[source]

Arguments for the experiment.

degree: tuple[int, int] | None = None

The degree range.

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’.

class qurry.qurrent.hadamard_test.arguments.EntropyMeasureHadamardMeasureArgs[source]

Output arguments for output().

degree: tuple[int, int] | int | None

The degree range.

wave: QuantumCircuit | Hashable | None

The key or the circuit to execute.

class qurry.qurrent.hadamard_test.arguments.EntropyMeasureHadamardOutputArgs[source]

Output arguments for output().

degree: tuple[int, int] | int | None

The degree range.

analysis

EntropyMeasureHadamard - Analysis (qurry.qurrent.hadamard_test.analysis)

class qurry.qurrent.hadamard_test.analysis.EMHAnalysisContent(purity: float, entropy: float)[source]

The content of the analysis.

entropy: float

The entanglement entropy of the system.

purity: float

The purity of the system.

class qurry.qurrent.hadamard_test.analysis.EMHAnalysisInput[source]

To set the analysis.

class qurry.qurrent.hadamard_test.analysis.EntropyMeasureHadamardAnalysis(*, serial: int, log: dict[str, Any] | None = None, datatime: str | None = None, **other_kwargs)[source]

The instance for the analysis of :cls:`EntropyHadamardExperiment`.

classmethod content_type() Type[EMHAnalysisContent][source]

The content instance type.

classmethod input_type() Type[EMHAnalysisInput][source]

The input instance type.

property side_product_fields: Iterable[str]

The fields that will be stored as side product.

experiment

EntropyMeasureHadamard - Experiment (qurry.qurrent.hadamard_test.experiment)

class qurry.qurrent.hadamard_test.experiment.EntropyMeasureHadamardExperiment(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[EntropyMeasureHadamardAnalysis]

The analysis instance for this experiment.

analyze(pbar: tqdm | None = None) EntropyMeasureHadamardAnalysis[source]

Calculate entangled entropy with more information combined.

Parameters:
  • degree (Union[tuple[int, int], int]) – Degree of the subsystem.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar. Defaults to None.

Returns:

The result of the analysis.

Return type:

EntropyMeasureHadamardAnalysis

property arguments_instance: Type[EntropyMeasureHadamardArguments]

The arguments instance for this experiment.

classmethod method(targets: list[tuple[Hashable, QuantumCircuit]], arguments: EntropyMeasureHadamardArguments, 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 (EntropyMeasureHadamardArguments) – The arguments of the experiment.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar. Defaults to None.

  • multiprocess (bool, optional) – Whether to use multiprocessing. Defaults to True.

Returns:

The circuits of the experiment and the arguments of the experiment.

Return type:

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

classmethod params_control(targets: list[tuple[Hashable, QuantumCircuit]], exp_name: str = 'exps', degree: tuple[int, int] | None = None, **custom_kwargs: Any) tuple[EntropyMeasureHadamardArguments, 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’.

  • degree (Optional[tuple[int, int]], optional) – The degree range. Defaults to None.

  • custom_kwargs (Any) – The custom parameters.

Raises:

ValueError – The number of target circuits should be 1.

Returns:

The arguments of the experiment, the common parameters, and the custom parameters.

Return type:

tuple[EntropyMeasureHadamardArguments, Commonparams, dict[str, Any]]

classmethod quantities(shots: int | None = None, counts: list[dict[str, int]] | None = None) dict[str, float][source]

Calculate entangled entropy with more information combined.

Parameters:
  • shots (int) – Shots of the experiment on quantum machine.

  • counts (list[dict[str, int]]) – Counts of the experiment on quantum machine.

Returns:

A dictionary contains

purity, entropy.

Return type:

dict[str, float]

qurry

EntropyMeasureHadamard - Qurrium (qurry.qurrent.hadamard_test.qurry)

class qurry.qurrent.hadamard_test.qurry.EntropyMeasureHadamard[source]

Hadamard test for entanglement entropy.

  • Which entropy:

    The entropy we compute is the Second Order Rényi Entropy.

property experiment_instance: Type[EntropyMeasureHadamardExperiment]

The container class responding to this Qurrium class.

measure(wave: QuantumCircuit | Hashable | None = None, degree: tuple[int, 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)[source]

Execute the experiment.

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) – The key or the circuit to execute.

  • degree (Optional[Union[int, tuple[int, int]]], optional) – The degree of the experiment. Defaults to None.

  • 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(wave: QuantumCircuit | Hashable | None = None, degree: tuple[int, 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) EntropyMeasureHadamardOutputArgs[source]

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

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) – The key or the circuit to execute.

  • degree (Optional[Union[int, tuple[int, int]]], optional) – The degree of the experiment. Defaults to None.

  • 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:

EntropyMeasureHadamardOutputArgs

short_name = 'qurrent_hadamard'

The short name of Qurrium.