entangled_entropy_v1

Post Processing - Randomized Measure - Entangled Entropy V1 (qurry.process.randomized_measure.entangled_entropy_v1)

This is a deprecated version of entangled entropy calculation.

Reference:
  • Randomized Measure - Entangled 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](

  • 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](

)

  • Error Mitigation

Note

  • 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](

entangled_entropy

Post Processing - Randomized Measure - Entangled Entropy V1 - Entangled Entropy Deprecated (qurry.process.randomized_measure.entangled_entropy_v1.entangled_entropy)

qurry.process.randomized_measure.entangled_entropy_v1.entangled_entropy.preparing_all_system(shots: int, counts: list[dict[str, int]], measure: tuple[int, int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', workers_num: int | None = None, existed_all_system: ExistingAllSystemSource | None = None) tuple[dict[int, float] | dict[int, float64], tuple[int, int] | list[int], tuple[int, int] | list[int], float, str][source]

Prepare the all system source for entangled entropy calculation.

Parameters:
  • shots (int) – Shots of the counts.

  • counts (list[dict[str, int]]) – Counts from randomized measurement results.

  • measure (Optional[tuple[int, int]], optional) – The range that implemented the measuring gate. If not specified, then use all qubits. This will affect the range of partition when you not implement the measuring gate on all qubit. Defaults to None.

  • backend (PostProcessingBackendLabel, optional) – Backend for the post-processing. 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(). This only works for Python and Cython backend. Defaults to None.

  • existed_all_system (Optional[ExistingAllSystemSource], optional) – Existing all system source. If there is known all system result, then you can put it here to save a lot of time on calculating all system for not matter what partition you are using, their all system result is the same. All system source should contain purityCellsAllSys, bitStringRange, measureActually, source for its name. This can save a lot of time Defaults to None.

Returns:

  • purity_cell_list_allsys: list of purity of all system.

  • bitstring_range_allsys: The range of partition on the bitstring of all system.

  • measure_range_allsys: The range of partition refer to all qubits of all system.

  • taken_allsys: The time taken to calculate all system.

  • source: The source of all system,

    it can be “independent” or the source of existed_all_system.

Return type:

A tuple contains

qurry.process.randomized_measure.entangled_entropy_v1.entangled_entropy.randomized_entangled_entropy_mitigated_v1(shots: int, counts: list[dict[str, int]], degree: int | tuple[int, int] | None, measure: tuple[int, int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', workers_num: int | None = None, existed_all_system: ExistingAllSystemSource | None = None, pbar: tqdm | None = None) RandomizedEntangledEntropyMitigatedComplex[source]

Calculate entangled entropy with depolarizing error mitigation. The entropy we compute is the Second Order Rényi Entropy.

Reference:
  • Randomized Measure - Entangled 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](

  • 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](

)

  • Error Mitigation

Note

  • 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](

Parameters:
  • shots (int) – Shots of the counts.

  • counts (list[dict[str, int]]) – Counts from randomized measurement results.

  • degree (Optional[Union[tuple[int, int], int]]) – The range of partition.

  • measure (Optional[tuple[int, int]], optional) – The range that implemented the measuring gate. If not specified, then use all qubits. This will affect the range of partition when you not implement the measuring gate on all qubit. Defaults to None.

  • backend (PostProcessingBackendLabel, optional) – Backend for the post-processing. 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(). This only works for Python and Cython backend. Defaults to None.

  • existed_all_system (Optional[ExistingAllSystemSource], optional) – Existing all system source. If there is known all system result, then you can put it here to save a lot of time on calculating all system for not matter what partition you are using, their all system result is the same. All system source should contain purityCellsAllSys, bitStringRange, measureActually, source for its name. This can save a lot of time 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:

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:

RandomizedEntangledEntropyMitigatedComplex

qurry.process.randomized_measure.entangled_entropy_v1.entangled_entropy.randomized_entangled_entropy_v1(shots: int, counts: list[dict[str, int]], degree: int | tuple[int, int] | None, measure: tuple[int, int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', workers_num: int | None = None, pbar: tqdm | None = None) RandomizedEntangledEntropyComplex[source]

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

Reference:

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](

  • 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](

)

Parameters:
  • shots (int) – Shots of the counts.

  • counts (list[dict[str, int]]) – Counts from randomized measurement results.

  • degree (Optional[Union[tuple[int, int], int]]) – The range of partition.

  • measure (Optional[tuple[int, int]], optional) – The range that implemented the measuring gate. If not specified, then use all qubits. This will affect the range of partition when you not implement the measuring gate on all qubit. Defaults to None.

  • backend (PostProcessingBackendLabel, optional) – Backend for the post-processing. 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(). This only works for Python and Cython backend. 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:

A dictionary contains purity, entropy, a list of each overlap, puritySD, degree, actual measure range, bitstring range and more.

Return type:

RandomizedEntangledEntropyComplex

entropy_core

Post Processing - Randomized Measure - Entangled Entropy V1 - Core (qurry.process.randomized_measure.entangled_entropy_v1.entropy_core)

qurry.process.randomized_measure.entangled_entropy_v1.entropy_core.entangled_entropy_core(shots: int, counts: list[dict[str, int]], degree: int | tuple[int, int] | None, measure: tuple[int, int] | list[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', multiprocess_pool_size: int | None = None) tuple[dict[int, float] | dict[int, float64], tuple[int, int], tuple[int, int], str, float][source]

The core function of 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.

  • backend (PostProcessingBackendLabel, optional) – Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.

  • multiprocess_pool_size (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.

Raises:
  • ValueError – Get degree neither ‘int’ nor ‘tuple[int, int]’.

  • ValueError – Measure range does not contain subsystem.

Returns:

Purity of each cell, Partition range, Measuring range, Message, Time to calculate.

Return type:

tuple[dict[int, float], tuple[int, int], tuple[int, int], str, float]

qurry.process.randomized_measure.entangled_entropy_v1.entropy_core.entangled_entropy_core_allrust(shots: int, counts: list[dict[str, int]], degree: int | tuple[int, int] | None, measure: tuple[int, int] | None = None) tuple[dict[int, float], tuple[int, int], tuple[int, int], str, float][source]

The core function of entangled entropy by Rust.

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.

Raises:
  • ValueError – Get degree neither ‘int’ nor ‘tuple[int, int]’.

  • ValueError – Measure range does not contain subsystem.

Returns:

Purity of each cell, Partition range, Measuring range, Message, Time to calculate.

Return type:

tuple[dict[int, float], tuple[int, int], tuple[int, int], str, float]

qurry.process.randomized_measure.entangled_entropy_v1.entropy_core.entangled_entropy_core_pycyrust(shots: int, counts: list[dict[str, int]], degree: int | tuple[int, int] | None, measure: tuple[int, int] | None = None, multiprocess_pool_size: int | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') tuple[dict[int, float] | dict[int, float64], tuple[int, int], tuple[int, int], str, float][source]

The core function of entangled entropy by Cython, Python, or Rust for just purity cell part.

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.

  • multiprocess_pool_size (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 by os.cpu_count(). Defaults to None.

  • backend (PostProcessingBackendLabel, optional) – Backend for the process. Defaults to ‘Cython’.

Raises:
  • ValueError – Get degree neither ‘int’ nor ‘tuple[int, int]’.

  • ValueError – Measure range does not contain subsystem.

Returns:

tuple[

Union[dict[int, float], dict[int, np.float64]], tuple[int, int], tuple[int, int], str, float,

]:

Purity of each cell, Partition range, Measuring range, Message, Time to calculate.

purity_cell

Post Processing - Randomized Measure - Entangled Entropy V1 - Purity Cell (qurry.process.randomized_measure.entangled_entropy_v1.purity_cell)

qurry.process.randomized_measure.entangled_entropy_v1.purity_cell.purity_cell(idx: int, single_counts: dict[str, int], bitstring_range: tuple[int, int], subsystem_size: int, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') tuple[int, float | float64][source]

Calculate the purity cell, one of overlap, of a subsystem.

Parameters:
  • idx (int) – Index of the cell (counts).

  • single_counts (dict[str, int]) – Counts measured by the single quantum circuit.

  • bitstring_range (tuple[int, int]) – The range of the subsystem.

  • subsystem_size (int) – Subsystem size included.

  • backend (ExistingProcessBackendLabel, optional) – Backend for the process. Defaults to DEFAULT_PROCESS_BACKEND.

Returns:

Index, one of overlap purity.

Return type:

tuple[int, float]

qurry.process.randomized_measure.entangled_entropy_v1.purity_cell.purity_cell_py(idx: int, single_counts: dict[str, int], bitstring_range: tuple[int, int], subsystem_size: int) tuple[int, float64][source]

Calculate the purity cell, one of overlap, of a subsystem by Python.

Parameters:
  • idx (int) – Index of the cell (counts).

  • single_counts (dict[str, int]) – Counts measured by the single quantum circuit.

  • bitstring_range (tuple[int, int]) – The range of the subsystem.

  • subsystem_size (int) – Subsystem size included.

Returns:

Index, one of overlap purity.

Return type:

tuple[int, float]

qurry.process.randomized_measure.entangled_entropy_v1.purity_cell.purity_cell_rust(idx: int, single_counts: dict[str, int], bitstring_range: tuple[int, int], subsystem_size: int) tuple[int, float][source]

Calculate the purity cell, one of overlap, of a subsystem by Rust.

Parameters:
  • idx (int) – Index of the cell (counts).

  • single_counts (dict[str, int]) – Counts measured by the single quantum circuit.

  • bitstring_range (tuple[int, int]) – The range of the subsystem.

  • subsystem_size (int) – Subsystem size included.

Returns:

Index, one of overlap purity.

Return type:

tuple[int, float]

container

Post Processing - Randomized Measure - Entangled Entropy V1 - Container (qurry.process.randomized_measure.entangled_entropy_v1.container)

class qurry.process.randomized_measure.entangled_entropy_v1.container.ExistingAllSystemSource[source]

Existing all system source.

bitStringRange: tuple[int, int] | list[int]

The range of partition on the bitstring.

measureActually: tuple[int, int] | list[int]

The range of partition refer to all qubits.

purityCellsAllSys: dict[int, float]

The purity of each cell of all system.

source: str

The source of all system.

class qurry.process.randomized_measure.entangled_entropy_v1.container.RandomizedEntangledEntropyComplex[source]

The result of the analysis.

bitStringRange: tuple[int, int] | list[int]

The range of partition on the bitstring.

countsNum: int

The number of counts.

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

The range of partition.

entropy: float64 | float

The entropy of the system.

entropySD: float64 | float

The standard deviation of the entropy.

measureActually: tuple[int, int]

The range of partition refer to all qubits.

purity: float64 | float

The purity of the system.

purityCells: dict[int, float64] | dict[int, float]

The purity of each cell.

puritySD: float64 | float

The standard deviation of the purity.

takingTime: float64 | float

The time of taking during specific partition.

class qurry.process.randomized_measure.entangled_entropy_v1.container.RandomizedEntangledEntropyMitigatedComplex[source]

The result of the analysis.

allSystemSource: str | Literal['independent']

The source of all system.

bitStringRange: tuple[int, int] | list[int]

The range of partition on the bitstring.

bitsStringRangeAllSys: tuple[int, int] | list[int]

The range of partition on the bitstring of all system.

countsNum: int

The number of counts.

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

The range of partition.

entropy: float64 | float

The entropy of the system.

entropyAllSys: float64 | float

The entropy of all system.

entropySD: float64 | float

The standard deviation of the entropy.

entropySDAllSys: float64 | float

The standard deviation of the entropy of all system.

errorRate: float64 | float

The error rate of the measurement from depolarizing error migigation calculated.

measure: tuple[str, list[int] | tuple[int, int]]

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])
measureActually: tuple[int, int] | list[int]

The range of partition refer to all qubits.

measureActuallyAllSys: tuple[int, int] | list[int]

The range of partition refer to all qubits of all system.

mitigatedEntropy: float64 | float

The mitigated entropy.

mitigatedPurity: float64 | float

The mitigated purity.

num_qubits: int

The number of qubits of this system.

purity: float64 | float

The purity of the system.

purityAllSys: float64 | float

The purity of all system.

purityCells: dict[int, float64] | dict[int, float]

The purity of each cell.

purityCellsAllSys: dict[int, float64] | dict[int, float]

The purity of each cell of all system.

puritySD: float64 | float

The standard deviation of the purity.

puritySDAllSys: float64 | float

The standard deviation of the purity of all system.

takingTime: float64 | float

The time of taking during specific partition.

takingTimeAllSys: float64 | float

The taking time of the all system if it is calculated, it will be 0 when use the all system from other analysis.