Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib64
/
python3.5
/
site-packages
/
scipy
/
sparse
/
__pycache__
/
File Content:
extract.cpython-35.pyc
DB�Wg � @ s� d Z d d l m Z m Z m Z d Z d d d g Z d d l m Z d d � Z d d d d � Z d d d d � Z d d � Z d S)z.Functions to extract parts of sparse matrices � )�division�print_function�absolute_importzrestructuredtext en�find�tril�triu� )� coo_matrixc C sM t | d d �} | j � | j d k } | j | | j | | j | f S)aJ Return the indices and values of the nonzero elements of a matrix Parameters ---------- A : dense or sparse matrix Matrix whose nonzero elements are desired. Returns ------- (I,J,V) : tuple of arrays I,J, and V contain the row indices, column indices, and values of the nonzero matrix entries. Examples -------- >>> from scipy.sparse import csr_matrix, find >>> A = csr_matrix([[7.0, 8.0, 0],[0, 0, 9.0]]) >>> find(A) (array([0, 0, 1], dtype=int32), array([0, 1, 2], dtype=int32), array([ 7., 8., 9.])) �copyTr )r Zsum_duplicates�data�row�col)�AZnz_mask� r �/extract.pyr s Nc C s>