### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Sparse matrices (`scipy.sparse`) »
- scipy.sparse.dok_matrix »

# scipy.sparse.dok_matrix.nonzero

`dok_matrix.``nonzero`()

  nonzero indices

  Returns a tuple of arrays (row,col) containing the indices of the non-zero elements of the matrix.

  Examples

      >>> from scipy.sparse import csr_matrix
      >>> A = csr_matrix([[1,2,0],[0,0,3],[4,0,5]])
      >>> A.nonzero()
      (array([0, 0, 1, 2, 2]), array([0, 1, 2, 0, 2]))

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Sparse matrices (`scipy.sparse`) »
- scipy.sparse.dok_matrix »