fastdla.SparsePauliSumArray
- class fastdla.SparsePauliSumArray(pauli_sums=None, num_qubits=None, initial_capacity=MEM_ALLOC_UNIT)
A container of SparsePauliSums with concatenated data.
Conceptually,
SparsePauliSumArrayis simply a list ofSparsePauliSum``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(pauli_sum)Append a new SparsePauliSum.
from_csr(matrix)Convert from an array of Pauli vectors in the CSR format.
Return a new array with normalized elements.
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_UNITcapacityCurrent maximum size of the concatenated arrays.
shapeShape of the array as a list of Pauli tensors.
vlenLength of the component Pauli vectors.