loom.eka.utilities.pauli_computation

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_computation.g(x1, z1, x2, z2)[source]

The g function as described in Aaronson’s paper but written with bitwise operations. The result is the exponent of the imaginary unit accompanying the multiplication result of the two paulis P_2 * P_1. Example: X * Y = X * i Z X = -i Z So input (1,1,1,0) gives -1.

Reference: https://arxiv.org/abs/quant-ph/0406196

Return type:

int

loom.eka.utilities.pauli_computation.g_npfunc(x1, z1, x2, z2)[source]

Vectorized g function.

Parameters:
  • x1 (np.ndarray) – The x bits of the first pauli string.

  • z1 (np.ndarray) – The z bits of the first pauli string.

  • x2 (np.ndarray) – The x bits of the second pauli string.

  • z2 (np.ndarray) – The z bits of the second pauli string.

Returns:

The g values.

Return type:

np.ndarray