SparsePauliOp.matrix_iter

SparsePauliOp.matrix_iter(sparse=False)[source]

Return a matrix representation iterator.

This is a lazy iterator that converts each term in the SparsePauliOp into a matrix as it is used. To convert to a single matrix use the to_matrix() method.

Parameters

sparse (bool) – optionally return sparse CSR matrices if True, otherwise return Numpy array matrices (Default: False)

Returns

matrix iterator object for the PauliTable.

Return type

MatrixIterator