PauliFrame#

class cuquantum.stabilizer.PauliFrame(
x_bits: ndarray | cp.ndarray,
z_bits: ndarray | cp.ndarray,
num_qubits: int | None = None,
bit_packed: bool = False,
)[source]#

A weight-less Pauli string.

This class is primarily used for visualizing the simulation output and is not intended to be constructed in batch quantities. When provided with a device array, the bits are automatically transferred to the CPU and unpacked if needed.

If the intention is to calculate a property derived from many Pauli strings, the best performance is achieved by directly manipulating the GPU-based Pauli table.

Methods

__init__(
x_bits: ndarray | cp.ndarray,
z_bits: ndarray | cp.ndarray,
num_qubits: int | None = None,
bit_packed: bool = False,
)[source]#

Initialize a PauliFrame.

x_bits and z_bits can both be either a CPU array or a GPU array. If bit_packed=False: array with num_qubits elements of dtype uint8 or bool If bit_packed=True: array with ceil(num_qubits/8) elements of dtype uint32

Parameters:
  • x_bits – X bits for each qubit.

  • z_bits – Z bits for each qubit (same format as x_bits).

  • num_qubits – Number of qubits. Must be specified if bit_packed=True

  • bit_packed – Whether the input bits are in packed format (default: False)

to_string() str[source]#

Convert to string representation.

Returns: a string of characters 'IXZY'

Attributes

num_qubits: int#