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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions spec/API_specification/statistical_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ A conforming implementation of the array API standard must provide and support t

Calculates the maximum value of the input array `x`.

```{note}
When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the minimum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `-infinity`).
```

#### Parameters

- **x**: _<array>_
Expand All @@ -45,6 +49,12 @@ Calculates the maximum value of the input array `x`.

Calculates the arithmetic mean of the input array `x`.

#### Special Cases

For a floating-point input array `x`, let `N` equal the number of elements over which to compute the arithmetic mean and

- if `N` is `0`, the arithmetic mean is `NaN`.

#### Parameters

- **x**: _<array>_
Expand All @@ -70,6 +80,10 @@ Calculates the arithmetic mean of the input array `x`.

Calculates the minimum value of the input array `x`.

```{note}
When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the maximum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `+infinity`).
```

#### Parameters

- **x**: _<array>_
Expand All @@ -95,6 +109,12 @@ Calculates the minimum value of the input array `x`.

Calculates the product of input array `x` elements.

#### Special Cases

For an input array `x`, let `N` equal the number of elements over which to compute the product and

- if `N` is `0`, the product is `1` (i.e., the empty product).

#### Parameters

- **x**: _<array>_
Expand All @@ -120,6 +140,12 @@ Calculates the product of input array `x` elements.

Calculates the standard deviation of the input array `x`.

#### Special Cases

For a floating-point input array `x`, let `N` equal the number of elements over which to compute the standard deviation and

- if `N - correction` is less than or equal to `0`, the standard deviation is `NaN`.

#### Parameters

- **x**: _<array>_
Expand Down Expand Up @@ -149,6 +175,12 @@ Calculates the standard deviation of the input array `x`.

Calculates the sum of the input array `x`.

#### Special Cases

For an input array `x`, let `N` equal the number of elements over which to compute the sum and

- if `N` is `0`, the sum is `0` (i.e., the empty sum).

#### Parameters

- **x**: _<array>_
Expand All @@ -174,6 +206,12 @@ Calculates the sum of the input array `x`.

Calculates the variance of the input array `x`.

#### Special Cases

For a floating-point input array `x`, let `N` equal the number of elements over which to compute the variance and

- if `N - correction` is less than or equal to `0`, the variance is `NaN`.

#### Parameters

- **x**: _<array>_
Expand Down