fastdla.SparsePauliSumArray

class fastdla.SparsePauliSumArray(pauli_sums=None, num_qubits=None, dtype=np.complex128, initial_capacity=MEM_ALLOC_UNIT)

A container of SparsePauliSums with concatenated data.

Conceptually, SparsePauliSumArray is simply a list of SparsePauliSum``s, and have interfaces that resemble a list (such as ``append, __getitem__, and __len__). Internally, the indices and coeffs are directly concatenated into single arrays.

Parameters:
  • pauli_sums (Optional[list[SparsePauliSum]]) – List of SparsePauliSums.

  • num_qubits (Optional[int]) – Used when initializing a length-0 array. If not given, num_qubits of the first SparsePauliSum to be appended will be used.

  • initial_capacity (int) – Initial maximum size of the concatenated arrays.

Methods

append(arg1[, arg2])

Append a new SparsePauliSum.

from_csr(matrix)

Convert from an array of Pauli vectors in the CSR format.

normalize()

Return a new array with normalized elements.

switch_impl(to)

to_csr()

Convert to an array of Pauli vectors in the CSR format.

to_matrices(*[, sparse, npmod])

Convert to an array of dense matrices.

Attributes

MEM_ALLOC_UNIT

capacity

Current maximum size of the concatenated arrays.

shape

Shape of the array as a list of Pauli tensors.

vlen

Length of the component Pauli vectors.