diff --git a/spec/API_specification/statistical_functions.md b/spec/API_specification/statistical_functions.md index 39ea18280..51f46f399 100644 --- a/spec/API_specification/statistical_functions.md +++ b/spec/API_specification/statistical_functions.md @@ -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>_ @@ -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>_ @@ -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>_ @@ -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>_ @@ -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>_ @@ -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>_ @@ -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>_