#NEWLINE# def find( A ) : #NEWLINE# #INDENT# 'Return the indices and values of the nonzero elements of a matrix\n\n    Parameters\n    ----------\n    A : dense or sparse matrix\n        Matrix whose nonzero elements are desired.\n\n    Returns\n    -------\n    (I,J,V) : tuple of arrays\n        I,J, and V contain the row indices, column indices, and values\n        of the nonzero matrix entries.\n\n\n    Examples\n    --------\n    >>> from scipy.sparse import csr_matrix, find\n    >>> A = csr_matrix([[7.0, 8.0, 0],[0, 0, 9.0]])\n    >>> find(A)\n    (array([0, 0, 1], dtype=int32), array([0, 1, 2], dtype=int32), array([ 7.,  8.,  9.]))\n\n    ' #NEWLINE# A = coo_matrix ( nz_mask , copy = True ) #NEWLINE# A . sum_duplicates ( ) #NEWLINE# nz_mask = ( A . data != 0 ) #NEWLINE# return ( A . row [ nz_mask ] , A . col [ nz_mask ] , A . data [ nz_mask ] )