entangled_entropy

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

This version introduces another way to process subsystems.

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_2

Post Processing - Randomized Measure - Entangled Entropy - Entangled Entropy 2 (qurry.process.randomized_measure.entangled_entropy.entangled_entropy_2)

qurry.process.randomized_measure.entangled_entropy.entangled_entropy_2.preparing_all_system(existed_all_system: ExistedAllSystemInfo | None, shots: int, counts: list[dict[str, int]], backend: Literal['Cython', 'Rust', 'Python'] | str, pbar: tqdm | None = None) ExistedAllSystemInfo[source]

Prepare all system for the entangled entropy calculation.

Parameters:
  • existed_all_system (Optional[ExistedAllSystemInfo]) – 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 no matter what partition you are using, their all system result is the same. This can save a lot of time Defaults to None.

  • shots (int) – Shots of the counts.

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

  • backend (PostProcessingBackendLabel) – Backend for the process.

  • 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 all system information.

Return type:

ExistedAllSystemInfo

qurry.process.randomized_measure.entangled_entropy.entangled_entropy_2.randomized_entangled_entropy(shots: int, counts: list[dict[str, int]], selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', pbar: tqdm | None = None) EntangledEntropyResult[source]

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

@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.}
}
Parameters:
  • shots (int) – Shots of the experiment on quantum machine.

  • 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 dictionary of each purity cell, entropySD, puritySD, num_classical_registers, classical_registers, classical_registers_actually, counts_num, taking_time.

Return type:

EntangledEntropyReturn

qurry.process.randomized_measure.entangled_entropy.entangled_entropy_2.randomized_entangled_entropy_mitigated(shots: int, counts: list[dict[str, int]], selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', existed_all_system: ExistedAllSystemInfo | None = None, pbar: tqdm | None = None) EntangledEntropyResultMitigated[source]

Calculate entangled entropy with depolarizing error mitigation. 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}
}
Parameters:
  • shots (int) – Shots of the counts.

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

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

  • existed_all_system (Optional[ExistedAllSystemInfo], 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 no matter what partition you are using, their all system result is the same. 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 dictionary of each purity cell, entropySD, puritySD, num_classical_registers, classical_registers, classical_registers_actually, counts_num, taking_time, purityAllSys, entropyAllSys, puritySDAllSys, entropySDAllSys, num_classical_registers_all_sys, classical_registers_all_sys, classical_registers_actually_all_sys, errorRate, mitigatedPurity, mitigatedEntropy.

Return type:

EntangledEntropyResultMitigated

entropy_core_2

Post Processing - Randomized Measure - Entangled Entropy - Core 2 (qurry.process.randomized_measure.entangled_entropy.entropy_core_2)

This version introduces another way to process subsystems.

qurry.process.randomized_measure.entangled_entropy.entropy_core_2.entangled_entropy_core_2(shots: int, counts: list[dict[str, int]], selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') tuple[dict[int, float64], list[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.

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

Returns:

Purity of each cell, Selected qubits, Message, Time to calculate.

Return type:

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

qurry.process.randomized_measure.entangled_entropy.entropy_core_2.entangled_entropy_core_2_allrust(shots: int, counts: list[dict[str, int]], selected_classical_registers: Iterable[int] | None = None) tuple[dict[int, float64], list[int], str, float][source]

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

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

Returns:

Purity of each cell, Selected qubits, Message, Time to calculate.

Return type:

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

qurry.process.randomized_measure.entangled_entropy.entropy_core_2.entangled_entropy_core_2_pyrust(shots: int, counts: list[dict[str, int]], selected_classical_registers: Iterable[int] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') tuple[dict[int, float64], list[int], str, float][source]

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

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

Returns:

Purity of each cell, Selected classical registers, Message, Time to calculate.

Return type:

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

error_mitigation

Post Processing - Randomized Measure - Entangled Entropy - Error Mitigation (qurry.process.randomized_measure.entangled_entropy.error_mitigation)

qurry.process.randomized_measure.entangled_entropy.error_mitigation.depolarizing_error_mitgation(meas_system: _InputT, all_system: _InputT, n_a: int, system_size: int) dict[str, _InputT][source]

Depolarizing error mitigation.

Parameters:
  • meas_system (Union[float, np.ndarray]) – Value of the measured subsystem.

  • all_system (Union[float, np.ndarray]) – Value of the whole system.

  • n_a (int) – The size of the subsystem.

  • system_size (int) – The size of the system.

Returns:

Error rate, mitigated purity, mitigated entropy.

Return type:

Union[dict[str, float], dict[str, np.ndarray]]

qurry.process.randomized_measure.entangled_entropy.error_mitigation.mitigation_equation(pser: _InputT, meas_series: _InputT, n_a: int) _InputT[source]

Calculate the mitigation equation.

Parameters:
  • pser (Union[np.ndarray, float]) – Solution of p.

  • meas_series (Union[np.ndarray, float]) – Measured series.

  • n_a (int) – Subsystem size.

Returns:

Mitigated series.

Return type:

Union[np.ndarray, float]

qurry.process.randomized_measure.entangled_entropy.error_mitigation.solve_p(meas_series: _InputT, n_a: int) tuple[_InputT, _InputT][source]

Solve the equation of p from all system size and subsystem size.

Parameters:
  • meas_series (Union[np.ndarray, float]) – Measured series.

  • n_a (int) – Subsystem size.

Returns:

Two solutions of p.

Return type:

Union[tuple[np.ndarray, np.ndarray], tuple[float, float]]

purity_cell_2

Post Processing - Randomized Measure - Entangled Entropy - Purity Cell 2 (qurry.process.randomized_measure.entangled_entropy.purity_cell_2)

This version introduces another way to process subsystems.

qurry.process.randomized_measure.entangled_entropy.purity_cell_2.purity_cell_2(idx: int, single_counts: dict[str, int], selected_classical_registers: list[int], backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') tuple[int, float | float64, list[int]][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 from the single quantum circuit.

  • selected_bitstrings (list[int]) – The list of the index of the selected classical registers.

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

Returns:

Index, one of overlap purity, The list of the index of the selected classical registers.

Return type:

tuple[int, Union[float, np.float64], list[int]]

qurry.process.randomized_measure.entangled_entropy.purity_cell_2.purity_cell_2_py(idx: int, single_counts: dict[str, int], selected_classical_registers: list[int]) tuple[int, float64, list[int]][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 from the single quantum circuit.

  • selected_classical_registers (list[int]) – The list of the index of the selected_classical_registers.

Returns:

Index, one of overlap purity, The list of the index of the selected classical registers.

Return type:

tuple[int, float, list[int]]

qurry.process.randomized_measure.entangled_entropy.purity_cell_2.purity_cell_2_rust(idx: int, single_counts: dict[str, int], selected_classical_registers: list[int]) tuple[int, float64, list[int]][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 from the single quantum circuit.

  • selected_classical_registers (list[int]) – The list of the index of the selected_classical_registers.

Returns:

Index, one of overlap purity, The list of the index of the selected classical registers.

Return type:

tuple[int, float, list[int]]

container

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

class qurry.process.randomized_measure.entangled_entropy.container.EntangledEntropyResult[source]

The return type of the post-processing for entangled entropy.

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

entropy: float64 | float

The entropy of the system.

entropySD: float64 | float

The standard deviation of the entropy.

num_classical_registers: int

The number of classical registers.

purity: float64 | float

The purity of the system.

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

The purity of each single count.

puritySD: float64 | float

The standard deviation of the purity.

taking_time: float64 | float

The calculation time.

class qurry.process.randomized_measure.entangled_entropy.container.EntangledEntropyResultMitigated[source]

The return type of the post-processing for entangled entropy with error mitigation.

all_system_source: str | Literal['independent', 'null_counts']

The name of source of all system.

  • independent: The all system is calculated independently.

  • null_counts: No counts exist.

classical_registers_actually_all_sys: list[int]

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

classical_registers_all_sys: list[int] | None

The list of the index of the selected classical registers.

entropyAllSys: float64 | float

The entropy of the all system.

entropySDAllSys: float64 | float

The standard deviation of the entropy of the all system.

errorRate: float64 | float

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

mitigatedEntropy: float64 | float

The mitigated entropy.

mitigatedPurity: float64 | float

The mitigated purity.

num_classical_registers_all_sys: int

The number of classical registers of all system.

purityAllSys: float64 | float

The purity of the all system.

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

The purity of each single count.

puritySDAllSys: float64 | float

The standard deviation of the purity of the all system.

taking_time_all_sys: float64 | float

The calculation time of the all system.

class qurry.process.randomized_measure.entangled_entropy.container.ExistedAllSystemInfo(source: str, purityAllSys: float64 | float, entropyAllSys: float64 | float, puritySDAllSys: float64 | float, entropySDAllSys: float64 | float, purityCellsAllSys: dict[int, float64] | dict[int, float], num_classical_registers_all_sys: int, classical_registers_all_sys: list[int] | None, classical_registers_actually_all_sys: list[int], taking_time_all_sys: float64 | float)[source]

Existed all system information

classical_registers_actually_all_sys: list[int]

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

classical_registers_all_sys: list[int] | None

The list of the index of the selected classical registers.

entropyAllSys: float64 | float

The entropy of the all system.

entropySDAllSys: float64 | float

The standard deviation of the entropy of the all system.

num_classical_registers_all_sys: int

The number of classical registers of all system.

purityAllSys: float64 | float

The purity of the all system.

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

The purity of each single count.

puritySDAllSys: float64 | float

The standard deviation of the purity of the all system.

source: str

The source of all system.

taking_time_all_sys: float64 | float

The calculation time of the all system.

class qurry.process.randomized_measure.entangled_entropy.container.ExistedAllSystemInfoInput[source]

Existed all system information

classical_registers_actually_all_sys: list[int]

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

classical_registers_all_sys: list[int] | None

The list of the index of the selected classical registers.

entropyAllSys: float64 | float

The entropy of the all system.

entropySDAllSys: float64 | float

The standard deviation of the entropy of the all system.

num_classical_registers_all_sys: int

The number of classical registers of all system.

purityAllSys: float64 | float

The purity of the all system.

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

The purity of each single count.

puritySDAllSys: float64 | float

The standard deviation of the purity of the all system.

source: str

The source of all system.

taking_time_all_sys: float64 | float

The calculation time of the all system.

qurry.process.randomized_measure.entangled_entropy.container.GenericFloatType

The generic float type by numpy or python.

alias of float64 | float