loom.eka.utilities.pauli_format_conversion

Copyright 2024 Entropica Labs Pte Ltd

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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