def to_matrix(self):
mat = self.to_spmatrix()<EOL>return mat.toarray()<EOL>
r"""
        Convert Pauli to a matrix representation.

        Order is q_{n-1} .... q_0, i.e., $P_{n-1} \otimes ... P_0$

        Returns:
            numpy.array: a matrix that represents the pauli.