Skip to content

Specify behavior of statistical reductions over the empty set #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 15, 2021

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Sep 13, 2021

This PR

  • specifies the behavior of statistical reductions when the number of elements over which to compute a reduction is zero and resolves gh-232.

  • Notably, this PR proposes

    • max: implementation-defined (due to no consistent maximum value across all supported data types).
    • mean: return NaN.
    • min: implementation-defined (due to no consistent minimum value across all supported data types).
    • prod: return 1 (empty product).
    • std: return NaN.
    • sum: return 0 (empty sum).
    • var: return NaN.

@kgryte kgryte added the Maintenance Bug fix, typo fix, or general maintenance. label Sep 13, 2021
@rgommers rgommers merged commit 85d6b31 into main Sep 15, 2021
@rgommers rgommers deleted the stat-reduction-identities branch September 15, 2021 15:00
@data-apis data-apis deleted a comment Sep 15, 2021
@data-apis data-apis deleted a comment Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Bug fix, typo fix, or general maintenance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behavior of reductions on empty arrays should be specified
2 participants