[Numpy-discussion] counting non-zero entries in an ndarray
Ian Stokes-Rees
ijstokes@hkl.hms.harvard....
Wed Dec 22 08:16:17 CST 2010
What is the most efficient way to do the Matlab equivalent of nnz(M)
(nnz = number-of-non-zeros function)?
I've tried Google, but no luck.
My assumption is that something like
a != 0
will be used, but I'm not sure then how to "count" the number of "True"
entries.
TIA.
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ijstokes.vcf
Type: text/x-vcard
Size: 380 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101222/03855a06/attachment.vcf
More information about the NumPy-Discussion
mailing list