loom.eka.utilities.pauli_format_conversion

Copyright (c) Entropica Labs Pte Ltd 2025.

Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.

loom.eka.utilities.pauli_format_conversion.paulichar_to_xz(p)[source]

Function that turns a Pauli into a pair of x,z bits.

Parameters:

p (str) – The Pauli character.

Returns:

x, z bits

Return type:

tuple[int, int]

Raises:

ValueError – If the Pauli is not I, Z, X or Y.

loom.eka.utilities.pauli_format_conversion.paulichar_to_xz_npfunc(p)[source]

Vectorized version of paulichar_to_xz.

Parameters:

p (np.ndarray) – An array of Pauli characters.

Returns:

Two arrays of x and z bits.

Return type:

tuple[np.ndarray]

loom.eka.utilities.pauli_format_conversion.paulixz_to_char(x, z)[source]

Function that turns a pair of x, z bits into their Pauli as a str.

Parameters:
  • x (int) – The x bit.

  • z (int) – The z bit.

Returns:

The Pauli character as a string.

Return type:

str

Raises:

ValueError – If x or z are not 0 or 1.

loom.eka.utilities.pauli_format_conversion.paulixz_to_char_npfunc(x, z)[source]

Vectorized version of paulixz_to_char.

Parameters:
  • x (np.ndarray) – An array of x bits.

  • z (np.ndarray) – An array of z bits.

Returns:

An array of Pauli characters.

Return type:

np.ndarray