RFC: add diff
for computing the n-th forward difference
#784
Labels
Milestone
diff
for computing the n-th forward difference
#784
This RFC proposes the addition of a new API in the array API specification for computing the n-th forward difference along a specified dimension.
Overview
Based on array comparison data, the API is available across all major array libraries in the PyData ecosystem.
diff
was originally discussed in #187 as a potential standardization candidate and has been requested by downstream libraries, such as xarray.Prior art
append
andprepend
defaults to<no_value>
.prepend
andappend
must be tensors.prepend
andappend
kwargs.Proposal
Questions
prepend
andappend
as scalar values and subsequently wraps usingasarray
. Are we okay limiting to only arrays within the specification? Libraries, such as NumPy, would be free to accept scalars; this would just not be considered portable behavior.prepend
andappend
arrays match the shape ofx
except along the specified axis, thus precluding broadcasting. Is there ever a situation in which broadcasting would make sense?x
has a boolean dtype, the output array must also have a boolean dtype. Similarly, unsigned integer input arrays result in unsigned integer output arrays. Are we okay requiring thatdiff
support boolean and unsigned integer dtypes? Or should we limit portable behavior to floating-point (real and complex) and signed integers?The text was updated successfully, but these errors were encountered: