pygsti.tools.symplectic.bitstring_to_int

pygsti.tools.symplectic.bitstring_to_int#

bitstring_to_int(b, n)#

Converts an n-bit string b to an integer between 0 and 2^`n` - 1.

Code from “How to efficiently select an arbitrary Clifford group element” by Robert Koenig and John A. Smolin.

Parameters:
  • b (list, tuple, or array) – Sequence of bits (a bitstring).

  • n (int) – Number of bits.

Return type:

int