From ef447a28ba782e1f58b32fdff6d5c93f707c7b65 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 14 Sep 2020 02:02:14 -0700 Subject: [PATCH 1/3] Add constants --- spec/API_specification/constants.md | 31 +++++++++++++++++++++++++++++ spec/API_specification/index.rst | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 spec/API_specification/constants.md diff --git a/spec/API_specification/constants.md b/spec/API_specification/constants.md new file mode 100644 index 000000000..acb214ef0 --- /dev/null +++ b/spec/API_specification/constants.md @@ -0,0 +1,31 @@ +# Constants + +> Array API specification for constants. + +A conforming implementation of the array API standard must provide and support the following constants. + + + +### # e + +Euler's constant. + +```text +e = 2.71828182845904523536028747135266249775724709369995... +``` + +### # inf + +IEEE 754 floating point representation of (positive) infinity. + +### # nan + +IEEE 754 floating point representation of Not a Number (`NaN`). + +### # pi + +The mathematical constant `π`. + +```text +pi = 3.1415926535897932384626433... +``` \ No newline at end of file diff --git a/spec/API_specification/index.rst b/spec/API_specification/index.rst index 86873453d..ef27086a7 100644 --- a/spec/API_specification/index.rst +++ b/spec/API_specification/index.rst @@ -16,4 +16,5 @@ API specification elementwise_functions statistical_functions searching_functions - linear_algebra_functions \ No newline at end of file + linear_algebra_functions + constants \ No newline at end of file From 7d50c8372cd35a5457106b1dc4de4b48d4a28716 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 14 Sep 2020 02:21:34 -0700 Subject: [PATCH 2/3] Add element-wise functions --- .../elementwise_functions.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index f925e46c8..8e1c56306 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -440,6 +440,54 @@ Computes the truth value of `x1_i >= x2_i` for each element `x1_i` of the input - an array containing the element-wise results. +### # isfinite(x, /) + +Tests each element `x_i` of the input array `x` to determine if finite (i.e., not `NaN` and not equal to positive or negative infinity). + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - an array, whose underlying data type is `bool`, containing test results. + +### # isinf(x, /) + +Tests each element `x_i` of the input array `x` to determine if equal to positive or negative infinity. + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - an array, whose underlying data type is `bool`, containing test results. + +### # isnan(x, /) + +Tests each element `x_i` of the input array `x` to determine whether the element is `NaN`. + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - an array, whose underlying data type is `bool`, containing test results. + ### # less(x1, x2, /, *, out=None) Computes the truth value of `x1_i < x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`. From feeff6c3b270436d703c04ef83f6d9c096ca1e1d Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 14 Sep 2020 02:25:29 -0700 Subject: [PATCH 3/3] Update copy --- spec/API_specification/elementwise_functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 8e1c56306..fa6284901 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -454,7 +454,7 @@ Tests each element `x_i` of the input array `x` to determine if finite (i.e., no - **out**: _<array>_ - - an array, whose underlying data type is `bool`, containing test results. + - an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is finite and `False` otherwise. ### # isinf(x, /) @@ -470,7 +470,7 @@ Tests each element `x_i` of the input array `x` to determine if equal to positiv - **out**: _<array>_ - - an array, whose underlying data type is `bool`, containing test results. + - an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is either positive or negative infinity and `False` otherwise. ### # isnan(x, /) @@ -486,7 +486,7 @@ Tests each element `x_i` of the input array `x` to determine whether the element - **out**: _<array>_ - - an array, whose underlying data type is `bool`, containing test results. + - an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is `NaN` and `False` otherwise. ### # less(x1, x2, /, *, out=None)