string_operatorΒΆ

Post-processing for string operator.

magsq_coreΒΆ

Post Processing - String Operator - String Operator Core (qurry.process.string_operator.strop_core)

qurry.process.string_operator.strop_core.add_or_reducer(bitstring)ΒΆ

The add or reduce function. If the sum of the bitstring is even, return 1. If the sum of the bitstring is odd, return -1.

Parameters:

bitstring (str) – The bitstring.

Returns:

1 or -1.

Return type:

Literal[1, -1]

qurry.process.string_operator.strop_core.string_operator_core(shots: int, counts: list[dict[str, int]], backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust') float | float64[source]ΒΆ

The core function of magnet square by Python and Rust.

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

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

  • backend (PostProcessingBackendLabel, optional) – Post Processing backend. Defaults to DEFAULT_PROCESS_BACKEND.

Returns:

String operator value.

Return type:

Union[float, np.float64]

string_operatorΒΆ

Post Processing - String Operator - String Operator (qurry.process.string_operator.string_operator)

class qurry.process.string_operator.string_operator.StringOperator[source]ΒΆ

String Operator type.

order: float | float64ΒΆ

The order of the string operator.

qurry.process.string_operator.string_operator.string_operator_order(shots: int, counts: list[dict[str, int]], backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', pbar: tqdm | None = None) StringOperator[source]ΒΆ

Calculate the order of the string operator.

Reference:

Note

  • Crossing a topological phase transition with a quantum computer -

Smith, Adam and Jobst, Bernhard and Green, Andrew G. and Pollmann, Frank, [PhysRevResearch.4.L022020](https://link.aps.org/doi/10.1103/PhysRevResearch.4.L022020)

Parameters:
  • shots (int) – Number of shots.

  • counts (list[dict[str, int]]) – List of counts.

  • backend (Optional[PostProcessingBackendLabel], optional) – Backend to use. Defaults to None.

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

Returns:

String Operator.

Return type:

StringOperator