This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / sparse / _extract / find

function

scipy.sparse._extract:find

source: build-install/usr/lib/python3.14/site-packages/scipy/sparse/_extract.py:16

Signature

def find(A)

Summary

Return the indices and values of the nonzero elements of a matrix.

Parameters

A : dense or sparse array or 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 entries.

Examples

from scipy.sparse import csr_array, find
A = csr_array([[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.]))

Aliases

  • scipy.sparse.find