SparsePauliOp.to_matrix

SparsePauliOp.to_matrix(sparse=False)[source]

Convert to a dense or sparse matrix.

Parameters

sparse (bool) – if True return a sparse CSR matrix, otherwise return dense Numpy array (Default: False).

Returns

A dense matrix if sparse=False. csr_matrix: A sparse matrix in CSR format if sparse=True.

Return type

array