array-api icon indicating copy to clipboard operation
array-api copied to clipboard

feat: add `count_nonzero` to specification

Open kgryte opened this issue 1 year ago • 0 comments

This PR

  • resolves https://github.com/data-apis/array-api/issues/794 by adding support for counting the number of non-zero values to the specification.
  • is consistent with statistical functions (such as max, mean, sum, etc) in supporting one or more axes over which to perform the reduction and in supporting keepdims to ensure the returned result is broadcast compatible.
  • follows nonzeros (ref: https://github.com/data-apis/array-api/pull/23#issuecomment-680784657) in disallowing zero-dimensional input arrays. Note, however, that the statistical function APIs do not contain any explicit guidance regarding minimum rank.
  • updates nonzeros by moving the notes to a dedicated notes section (i.e., below the "fold").

kgryte avatar May 02 '24 06:05 kgryte