From 700ff78bc3ad39dbe6e97082a41515f3f21bda46 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Tue, 17 Jan 2023 00:08:05 +0100 Subject: [PATCH 1/5] kokkos#120: API/core/numerics/mathematical-functions transition from .md to .rst init --- .../core/numerics/mathematical-functions.md | 153 ------------ .../core/numerics/mathematical-functions.rst | 217 ++++++++++++++++++ 2 files changed, 217 insertions(+), 153 deletions(-) delete mode 100644 docs/source/API/core/numerics/mathematical-functions.md create mode 100644 docs/source/API/core/numerics/mathematical-functions.rst diff --git a/docs/source/API/core/numerics/mathematical-functions.md b/docs/source/API/core/numerics/mathematical-functions.md deleted file mode 100644 index dd44d2199..000000000 --- a/docs/source/API/core/numerics/mathematical-functions.md +++ /dev/null @@ -1,153 +0,0 @@ -# Common math functions - -Motivating example (borrowed from https://llvm.org/docs/CompileCudaWithLLVM.html#standard-library-support) -```C++ -// clang is OK with everything in this function. -__device__ void test() { - std::sin(0.); // nvcc - ok - std::sin(0); // nvcc - error, because no std::sin(int) override is available. - sin(0); // nvcc - same as above. - - sinf(0.); // nvcc - ok - std::sinf(0.); // nvcc - no such function -} -``` -Kokkos' goal is to provide a consistent overload set that is available on host -and device and that follows practice from the C++ numerics library. - ---- - -Defined in -header [``](https://github.com/kokkos/kokkos/blob/develop/core/src/Kokkos_MathematicalFunctions.hpp) -which is included from `` - -Provides most of the [standard C mathematical functions from ``](https://en.cppreference.com/w/cpp/numeric/math), such as `fabs`, `sqrt`, and `sin`. - -Math functions are available in the `Kokkos::` namespace since version 3.7, in `Kokkos::Experimental` in previous versions. - -Below is the synopsis for `sqrt` as an example of unary math function. -```C++ -namespace Kokkos { // (since 3.7) -KOKKOS_FUNCTION float sqrt ( float x ); -KOKKOS_FUNCTION float sqrtf( float x ); -KOKKOS_FUNCTION double sqrt ( double x ); - long double sqrt ( long double x ); - long double sqrtl( long double x ); -KOKKOS_FUNCTION double sqrt ( IntegralType x ); -} -``` -The function is overloaded for any argument of arithmetic type. Additional -functions with `f` and `l` suffixes that work on `float` and `long double` -respectively are also available. Please note, that `long double` overloads are -not available on the device. - -See below the list of common mathematical functions supported. We refer the -reader to cppreference.com for the synopsis of each individual function. - ---- - -_`func`_ denotes functions that are currently not provided by Kokkos -_`func*`_ see notes below - -**Basic operations** -[`abs`](https://en.cppreference.com/w/cpp/numeric/math/fabs) -[`fabs`](https://en.cppreference.com/w/cpp/numeric/math/fabs) -[`fmod`](https://en.cppreference.com/w/cpp/numeric/math/fmod) -[`remainder`](https://en.cppreference.com/w/cpp/numeric/math/remainder) -[`remquo`](https://en.cppreference.com/w/cpp/numeric/math/remquo) -[`fma*`](https://en.cppreference.com/w/cpp/numeric/math/fma) -[`fmax`](https://en.cppreference.com/w/cpp/numeric/math/fmax) -[`fmin`](https://en.cppreference.com/w/cpp/numeric/math/fmin) -[`fdim`](https://en.cppreference.com/w/cpp/numeric/math/fdim) -[`nan`](https://en.cppreference.com/w/cpp/numeric/math/nan) - -**Exponential functions** -[`exp`](https://en.cppreference.com/w/cpp/numeric/math/exp) -[`exp2`](https://en.cppreference.com/w/cpp/numeric/math/exp2) -[`expm1`](https://en.cppreference.com/w/cpp/numeric/math/expm1) -[`log`](https://en.cppreference.com/w/cpp/numeric/math/log) -[`log10`](https://en.cppreference.com/w/cpp/numeric/math/log10) -[`log2`](https://en.cppreference.com/w/cpp/numeric/math/log2) -[`log1p`](https://en.cppreference.com/w/cpp/numeric/math/log1p) - -**Power functions** -[`pow`](https://en.cppreference.com/w/cpp/numeric/math/pow) -[`sqrt`](https://en.cppreference.com/w/cpp/numeric/math/sqrt) -[`cbrt`](https://en.cppreference.com/w/cpp/numeric/math/cbrt) -[`hypot*`](https://en.cppreference.com/w/cpp/numeric/math/hypot) - -**Trigonometric functions** -[`sin`](https://en.cppreference.com/w/cpp/numeric/math/sin) -[`cos`](https://en.cppreference.com/w/cpp/numeric/math/cos) -[`tan`](https://en.cppreference.com/w/cpp/numeric/math/tan) -[`asin`](https://en.cppreference.com/w/cpp/numeric/math/asin) -[`acos`](https://en.cppreference.com/w/cpp/numeric/math/acos) -[`atan`](https://en.cppreference.com/w/cpp/numeric/math/atan) -[`atan2`](https://en.cppreference.com/w/cpp/numeric/math/atan2) - -**Hyperbolic functions** -[`sinh`](https://en.cppreference.com/w/cpp/numeric/math/sinh) -[`cosh`](https://en.cppreference.com/w/cpp/numeric/math/cosh) -[`tanh`](https://en.cppreference.com/w/cpp/numeric/math/tanh) -[`asinh`](https://en.cppreference.com/w/cpp/numeric/math/asinh) -[`acosh`](https://en.cppreference.com/w/cpp/numeric/math/acosh) -[`atanh`](https://en.cppreference.com/w/cpp/numeric/math/atanh) - -**Error and gamma functions** -[`erf`](https://en.cppreference.com/w/cpp/numeric/math/erf) -[`erfc`](https://en.cppreference.com/w/cpp/numeric/math/erfc) -[`tgamma`](https://en.cppreference.com/w/cpp/numeric/math/tgamma) -[`lgamma`](https://en.cppreference.com/w/cpp/numeric/math/lgamma) - -**Nearest integer floating point operations** -[`ceil`](https://en.cppreference.com/w/cpp/numeric/math/ceil) -[`floor`](https://en.cppreference.com/w/cpp/numeric/math/floor) -[`trunc`](https://en.cppreference.com/w/cpp/numeric/math/trunc) -[`round*`](https://en.cppreference.com/w/cpp/numeric/math/round) -[`lround`](https://en.cppreference.com/w/cpp/numeric/math/round) -[`llround`](https://en.cppreference.com/w/cpp/numeric/math/round) -[`nearbyint*`](https://en.cppreference.com/w/cpp/numeric/math/nearbyint) -[`rint`](https://en.cppreference.com/w/cpp/numeric/math/rint) -[`lrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) -[`llrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) - -**Floating point manipulation functions** -[`frexp`](https://en.cppreference.com/w/cpp/numeric/math/frexp) -[`ldexp`](https://en.cppreference.com/w/cpp/numeric/math/ldexp) -[`modf`](https://en.cppreference.com/w/cpp/numeric/math/modf) -[`scalbn`](https://en.cppreference.com/w/cpp/numeric/math/scalbn) -[`scalbln`](https://en.cppreference.com/w/cpp/numeric/math/scalbln) -[`ilog`](https://en.cppreference.com/w/cpp/numeric/math/ilog) -[`logb*`](https://en.cppreference.com/w/cpp/numeric/math/logb) -[`nextafter*`](https://en.cppreference.com/w/cpp/numeric/math/nextafter) -[`nexttoward`](https://en.cppreference.com/w/cpp/numeric/math/nexttoward) -[`copysign*`](https://en.cppreference.com/w/cpp/numeric/math/copysign) - -**Classification and comparison** -[`fpclassify`](https://en.cppreference.com/w/cpp/numeric/math/fpclassify) -[`isfinite`](https://en.cppreference.com/w/cpp/numeric/math/isfinite) -[`isinf`](https://en.cppreference.com/w/cpp/numeric/math/isinf) -[`isnan`](https://en.cppreference.com/w/cpp/numeric/math/isnan) -[`isnormal`](https://en.cppreference.com/w/cpp/numeric/math/isnormal) -[`signbit*`](https://en.cppreference.com/w/cpp/numeric/math/signbit) -[`isgreater`](https://en.cppreference.com/w/cpp/numeric/math/isgreater) -[`isgreaterequal`](https://en.cppreference.com/w/cpp/numeric/math/isgreaterequal) -[`isless`](https://en.cppreference.com/w/cpp/numeric/math/isless) -[`islessequal`](https://en.cppreference.com/w/cpp/numeric/math/islessequal) -[`islessgreater`](https://en.cppreference.com/w/cpp/numeric/math/islessgreater) -[`isunordered`](https://en.cppreference.com/w/cpp/numeric/math/isunordered) - ---- - -## Notes -* **Feel free to [open an issue](https://github.com/kokkos/kokkos/issues/new) if you need one of the functions that is currently not implemented. [Issue #4767](https://github.com/kokkos/kokkos/issues/4767) is keeping track of these and has notes about implementability.** -* `nearbyint` is not available with the SYCL backend -* `round`, `logb`, `nextafter`, `copysign`, and `signbit` are available since version 3.7 -* three-argument version of `hypot` is available since 4.0 -* `fma` is available since 4.0 - ---- - -## See also -[Mathematical constants](mathematical-constants) -[Numeric traits](numeric-traits) diff --git a/docs/source/API/core/numerics/mathematical-functions.rst b/docs/source/API/core/numerics/mathematical-functions.rst new file mode 100644 index 000000000..5f02ea89a --- /dev/null +++ b/docs/source/API/core/numerics/mathematical-functions.rst @@ -0,0 +1,217 @@ +Common math functions +===================== + +.. role::cpp(code) + :language: cpp + +.. role:: strike + :class: strike + +Motivating example (borrowed from https://llvm.org/docs/CompileCudaWithLLVM.html#standard-library-support) + +.. code-block:: cpp + + // clang is OK with everything in this function. + __device__ void test() { + std::sin(0.); // nvcc - ok + std::sin(0); // nvcc - error, because no std::sin(int) override is available. + sin(0); // nvcc - same as above. + + sinf(0.); // nvcc - ok + std::sinf(0.); // nvcc - no such function + } + +Kokkos' goal is to provide a consistent overload set that is available on host +and device and that follows practice from the C++ numerics library. + +------------ + +.. _text: https://github.com/kokkos/kokkos/blob/develop/core/src/Kokkos_MathematicalFunctions.hpp + +.. |text| replace:: ```` + +Defined in header |text|_ which is included from ```` + +.. _text2: https://en.cppreference.com/w/cpp/numeric/math + +.. |text2| replace:: standard C mathematical functions from ```` + +Provides most of the |text2|_, such as ``fabs``, ``sqrt``, and ``sin``. + +Math functions are available in the ``Kokkos::`` namespace since version 3.7, in ``Kokkos::Experimental`` in previous versions. + +Below is the synopsis for ``sqrt`` as an example of unary math function. + +.. code-block:: cpp + + namespace Kokkos { // (since 3.7) + KOKKOS_FUNCTION float sqrt ( float x ); + KOKKOS_FUNCTION float sqrtf( float x ); + KOKKOS_FUNCTION double sqrt ( double x ); + long double sqrt ( long double x ); + long double sqrtl( long double x ); + KOKKOS_FUNCTION double sqrt ( IntegralType x ); + } + +The function is overloaded for any argument of arithmetic type. Additional functions with ``f`` and ``l`` suffixes that work on ``float`` and ``long double`` respectively are also available. Please note, that ``long double`` overloads are not available on the device. + +See below the list of common mathematical functions supported. We refer the reader to cppreference.com for the synopsis of each individual function. + +------------ + +:strike:`func` denotes functions that are currently not provided by Kokkos + +``func*`` see notes below + +**Basic operations** + +.. _abs: https://en.cppreference.com/w/cpp/numeric/math/fabs + +.. |abs| replace:: ``abs`` + +.. _fabs: https://en.cppreference.com/w/cpp/numeric/math/fabs + +.. |fabs| replace:: ``fabs`` + +.. _fmod: https://en.cppreference.com/w/cpp/numeric/math/fmod + +.. |fmod| replace:: ``fmod`` + +.. _remainder: https://en.cppreference.com/w/cpp/numeric/math/remainder + +.. |remainder| replace:: ``remainder`` + +.. _remquo: https://en.cppreference.com/w/cpp/numeric/math/remquo + +.. |remquo| replace:: ``remquo`` + +.. _fma*: https://en.cppreference.com/w/cpp/numeric/math/fma + +.. |fma*| replace:: ``fma*`` + +.. _fmax: https://en.cppreference.com/w/cpp/numeric/math/fmax + +.. |fmax| replace:: ``fmax`` + +.. _fmin: https://en.cppreference.com/w/cpp/numeric/math/fmin + +.. |fmin| replace:: ``fmin`` + +.. _fdim: https://en.cppreference.com/w/cpp/numeric/math/fdim + +.. |fdim| replace:: ``fdim`` + +.. _nan: https://en.cppreference.com/w/cpp/numeric/math/nan + +.. |nan| replace:: ``nan`` + +|abs|_ |fabs|_ |fmod|_ |remainder|_ |remquo|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ + +**Exponential functions** + +.. compo: + + .. _: + .. || replace:: + ||_ + + [`exp`](https://en.cppreference.com/w/cpp/numeric/math/exp) + [`exp2`](https://en.cppreference.com/w/cpp/numeric/math/exp2) + [`expm1`](https://en.cppreference.com/w/cpp/numeric/math/expm1) + [`log`](https://en.cppreference.com/w/cpp/numeric/math/log) + [`log10`](https://en.cppreference.com/w/cpp/numeric/math/log10) + [`log2`](https://en.cppreference.com/w/cpp/numeric/math/log2) + [`log1p`](https://en.cppreference.com/w/cpp/numeric/math/log1p) + + **Power functions** + [`pow`](https://en.cppreference.com/w/cpp/numeric/math/pow) + [`sqrt`](https://en.cppreference.com/w/cpp/numeric/math/sqrt) + [`cbrt`](https://en.cppreference.com/w/cpp/numeric/math/cbrt) + [`hypot*`](https://en.cppreference.com/w/cpp/numeric/math/hypot) + + **Trigonometric functions** + [`sin`](https://en.cppreference.com/w/cpp/numeric/math/sin) + [`cos`](https://en.cppreference.com/w/cpp/numeric/math/cos) + [`tan`](https://en.cppreference.com/w/cpp/numeric/math/tan) + [`asin`](https://en.cppreference.com/w/cpp/numeric/math/asin) + [`acos`](https://en.cppreference.com/w/cpp/numeric/math/acos) + [`atan`](https://en.cppreference.com/w/cpp/numeric/math/atan) + [`atan2`](https://en.cppreference.com/w/cpp/numeric/math/atan2) + + **Hyperbolic functions** + [`sinh`](https://en.cppreference.com/w/cpp/numeric/math/sinh) + [`cosh`](https://en.cppreference.com/w/cpp/numeric/math/cosh) + [`tanh`](https://en.cppreference.com/w/cpp/numeric/math/tanh) + [`asinh`](https://en.cppreference.com/w/cpp/numeric/math/asinh) + [`acosh`](https://en.cppreference.com/w/cpp/numeric/math/acosh) + [`atanh`](https://en.cppreference.com/w/cpp/numeric/math/atanh) + + **Error and gamma functions** + [`erf`](https://en.cppreference.com/w/cpp/numeric/math/erf) + [`erfc`](https://en.cppreference.com/w/cpp/numeric/math/erfc) + [`tgamma`](https://en.cppreference.com/w/cpp/numeric/math/tgamma) + [`lgamma`](https://en.cppreference.com/w/cpp/numeric/math/lgamma) + + **Nearest integer floating point operations** + [`ceil`](https://en.cppreference.com/w/cpp/numeric/math/ceil) + [`floor`](https://en.cppreference.com/w/cpp/numeric/math/floor) + [`trunc`](https://en.cppreference.com/w/cpp/numeric/math/trunc) + [`round*`](https://en.cppreference.com/w/cpp/numeric/math/round) + [`lround`](https://en.cppreference.com/w/cpp/numeric/math/round) + [`llround`](https://en.cppreference.com/w/cpp/numeric/math/round) + [`nearbyint*`](https://en.cppreference.com/w/cpp/numeric/math/nearbyint) + [`rint`](https://en.cppreference.com/w/cpp/numeric/math/rint) + [`lrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) + [`llrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) + + **Floating point manipulation functions** + [`frexp`](https://en.cppreference.com/w/cpp/numeric/math/frexp) + [`ldexp`](https://en.cppreference.com/w/cpp/numeric/math/ldexp) + [`modf`](https://en.cppreference.com/w/cpp/numeric/math/modf) + [`scalbn`](https://en.cppreference.com/w/cpp/numeric/math/scalbn) + [`scalbln`](https://en.cppreference.com/w/cpp/numeric/math/scalbln) + [`ilog`](https://en.cppreference.com/w/cpp/numeric/math/ilog) + [`logb*`](https://en.cppreference.com/w/cpp/numeric/math/logb) + [`nextafter*`](https://en.cppreference.com/w/cpp/numeric/math/nextafter) + [`nexttoward`](https://en.cppreference.com/w/cpp/numeric/math/nexttoward) + [`copysign*`](https://en.cppreference.com/w/cpp/numeric/math/copysign) + + **Classification and comparison** + [`fpclassify`](https://en.cppreference.com/w/cpp/numeric/math/fpclassify) + [`isfinite`](https://en.cppreference.com/w/cpp/numeric/math/isfinite) + [`isinf`](https://en.cppreference.com/w/cpp/numeric/math/isinf) + [`isnan`](https://en.cppreference.com/w/cpp/numeric/math/isnan) + [`isnormal`](https://en.cppreference.com/w/cpp/numeric/math/isnormal) + [`signbit*`](https://en.cppreference.com/w/cpp/numeric/math/signbit) + [`isgreater`](https://en.cppreference.com/w/cpp/numeric/math/isgreater) + [`isgreaterequal`](https://en.cppreference.com/w/cpp/numeric/math/isgreaterequal) + [`isless`](https://en.cppreference.com/w/cpp/numeric/math/isless) + [`islessequal`](https://en.cppreference.com/w/cpp/numeric/math/islessequal) + [`islessgreater`](https://en.cppreference.com/w/cpp/numeric/math/islessgreater) + [`isunordered`](https://en.cppreference.com/w/cpp/numeric/math/isunordered) + +------------ + +Notes +----- + +.. _openIssue: https://github.com/kokkos/kokkos/issues/new +.. |openIssue| replace:: open an issue + +.. _issue4767: https://github.com/kokkos/kokkos/issues/4767 +.. |issue4767| replace:: Issue #4767 + +* **Feel free to |openIssue|_ if you need one of the functions that is currently not implemented. |issue4767|_ is keeping track of these and has notes about implementability.** +* ``nearbyint`` is not available with the SYCL backend +* ``round``, ``logb``, ``nextafter``, ``copysign``, and ``signbit`` are available since version 3.7 +* three-argument version of ``hypot`` is available since 4.0 +* ``fma`` is available since 4.0 + +------------ + +See also +-------- + +`Mathematical constant `_ + +`Numeric traits `_ \ No newline at end of file From e76991caa0d78cf4f25785baa97a5ca04d6157f0 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Tue, 17 Jan 2023 00:18:32 +0100 Subject: [PATCH 2/5] kokkos#120: API/core/numerics/mathematical-functions fix bold link --- .../API/core/numerics/mathematical-functions.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/source/API/core/numerics/mathematical-functions.rst b/docs/source/API/core/numerics/mathematical-functions.rst index 5f02ea89a..18786b786 100644 --- a/docs/source/API/core/numerics/mathematical-functions.rst +++ b/docs/source/API/core/numerics/mathematical-functions.rst @@ -63,8 +63,6 @@ See below the list of common mathematical functions supported. We refer the read ``func*`` see notes below -**Basic operations** - .. _abs: https://en.cppreference.com/w/cpp/numeric/math/fabs .. |abs| replace:: ``abs`` @@ -105,7 +103,7 @@ See below the list of common mathematical functions supported. We refer the read .. |nan| replace:: ``nan`` -|abs|_ |fabs|_ |fmod|_ |remainder|_ |remquo|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ +**Basic operations** |abs|_ |fabs|_ |fmod|_ |remainder|_ |remquo|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ **Exponential functions** @@ -196,12 +194,12 @@ Notes ----- .. _openIssue: https://github.com/kokkos/kokkos/issues/new -.. |openIssue| replace:: open an issue +.. |openIssue| replace:: **open an issue** .. _issue4767: https://github.com/kokkos/kokkos/issues/4767 -.. |issue4767| replace:: Issue #4767 +.. |issue4767| replace:: **Issue #4767** -* **Feel free to |openIssue|_ if you need one of the functions that is currently not implemented. |issue4767|_ is keeping track of these and has notes about implementability.** +* **Feel free to** |openIssue|_ **if you need one of the functions that is currently not implemented.** |issue4767|_ **is keeping track of these and has notes about implementability.** * ``nearbyint`` is not available with the SYCL backend * ``round``, ``logb``, ``nextafter``, ``copysign``, and ``signbit`` are available since version 3.7 * three-argument version of ``hypot`` is available since 4.0 From 04149177a7e489e2ca2387e6a4a7bc04d0af2ef4 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Thu, 19 Jan 2023 12:07:28 +0100 Subject: [PATCH 3/5] kokkos#120: API/core/numerics/mathematical-functions finish translation --- .../core/numerics/mathematical-functions.rst | 339 +++++++++++++----- 1 file changed, 257 insertions(+), 82 deletions(-) diff --git a/docs/source/API/core/numerics/mathematical-functions.rst b/docs/source/API/core/numerics/mathematical-functions.rst index 18786b786..9794846d9 100644 --- a/docs/source/API/core/numerics/mathematical-functions.rst +++ b/docs/source/API/core/numerics/mathematical-functions.rst @@ -105,88 +105,261 @@ See below the list of common mathematical functions supported. We refer the read **Basic operations** |abs|_ |fabs|_ |fmod|_ |remainder|_ |remquo|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ -**Exponential functions** - -.. compo: - - .. _: - .. || replace:: - ||_ - - [`exp`](https://en.cppreference.com/w/cpp/numeric/math/exp) - [`exp2`](https://en.cppreference.com/w/cpp/numeric/math/exp2) - [`expm1`](https://en.cppreference.com/w/cpp/numeric/math/expm1) - [`log`](https://en.cppreference.com/w/cpp/numeric/math/log) - [`log10`](https://en.cppreference.com/w/cpp/numeric/math/log10) - [`log2`](https://en.cppreference.com/w/cpp/numeric/math/log2) - [`log1p`](https://en.cppreference.com/w/cpp/numeric/math/log1p) - - **Power functions** - [`pow`](https://en.cppreference.com/w/cpp/numeric/math/pow) - [`sqrt`](https://en.cppreference.com/w/cpp/numeric/math/sqrt) - [`cbrt`](https://en.cppreference.com/w/cpp/numeric/math/cbrt) - [`hypot*`](https://en.cppreference.com/w/cpp/numeric/math/hypot) - - **Trigonometric functions** - [`sin`](https://en.cppreference.com/w/cpp/numeric/math/sin) - [`cos`](https://en.cppreference.com/w/cpp/numeric/math/cos) - [`tan`](https://en.cppreference.com/w/cpp/numeric/math/tan) - [`asin`](https://en.cppreference.com/w/cpp/numeric/math/asin) - [`acos`](https://en.cppreference.com/w/cpp/numeric/math/acos) - [`atan`](https://en.cppreference.com/w/cpp/numeric/math/atan) - [`atan2`](https://en.cppreference.com/w/cpp/numeric/math/atan2) - - **Hyperbolic functions** - [`sinh`](https://en.cppreference.com/w/cpp/numeric/math/sinh) - [`cosh`](https://en.cppreference.com/w/cpp/numeric/math/cosh) - [`tanh`](https://en.cppreference.com/w/cpp/numeric/math/tanh) - [`asinh`](https://en.cppreference.com/w/cpp/numeric/math/asinh) - [`acosh`](https://en.cppreference.com/w/cpp/numeric/math/acosh) - [`atanh`](https://en.cppreference.com/w/cpp/numeric/math/atanh) - - **Error and gamma functions** - [`erf`](https://en.cppreference.com/w/cpp/numeric/math/erf) - [`erfc`](https://en.cppreference.com/w/cpp/numeric/math/erfc) - [`tgamma`](https://en.cppreference.com/w/cpp/numeric/math/tgamma) - [`lgamma`](https://en.cppreference.com/w/cpp/numeric/math/lgamma) - - **Nearest integer floating point operations** - [`ceil`](https://en.cppreference.com/w/cpp/numeric/math/ceil) - [`floor`](https://en.cppreference.com/w/cpp/numeric/math/floor) - [`trunc`](https://en.cppreference.com/w/cpp/numeric/math/trunc) - [`round*`](https://en.cppreference.com/w/cpp/numeric/math/round) - [`lround`](https://en.cppreference.com/w/cpp/numeric/math/round) - [`llround`](https://en.cppreference.com/w/cpp/numeric/math/round) - [`nearbyint*`](https://en.cppreference.com/w/cpp/numeric/math/nearbyint) - [`rint`](https://en.cppreference.com/w/cpp/numeric/math/rint) - [`lrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) - [`llrint`](https://en.cppreference.com/w/cpp/numeric/math/rint) - - **Floating point manipulation functions** - [`frexp`](https://en.cppreference.com/w/cpp/numeric/math/frexp) - [`ldexp`](https://en.cppreference.com/w/cpp/numeric/math/ldexp) - [`modf`](https://en.cppreference.com/w/cpp/numeric/math/modf) - [`scalbn`](https://en.cppreference.com/w/cpp/numeric/math/scalbn) - [`scalbln`](https://en.cppreference.com/w/cpp/numeric/math/scalbln) - [`ilog`](https://en.cppreference.com/w/cpp/numeric/math/ilog) - [`logb*`](https://en.cppreference.com/w/cpp/numeric/math/logb) - [`nextafter*`](https://en.cppreference.com/w/cpp/numeric/math/nextafter) - [`nexttoward`](https://en.cppreference.com/w/cpp/numeric/math/nexttoward) - [`copysign*`](https://en.cppreference.com/w/cpp/numeric/math/copysign) - - **Classification and comparison** - [`fpclassify`](https://en.cppreference.com/w/cpp/numeric/math/fpclassify) - [`isfinite`](https://en.cppreference.com/w/cpp/numeric/math/isfinite) - [`isinf`](https://en.cppreference.com/w/cpp/numeric/math/isinf) - [`isnan`](https://en.cppreference.com/w/cpp/numeric/math/isnan) - [`isnormal`](https://en.cppreference.com/w/cpp/numeric/math/isnormal) - [`signbit*`](https://en.cppreference.com/w/cpp/numeric/math/signbit) - [`isgreater`](https://en.cppreference.com/w/cpp/numeric/math/isgreater) - [`isgreaterequal`](https://en.cppreference.com/w/cpp/numeric/math/isgreaterequal) - [`isless`](https://en.cppreference.com/w/cpp/numeric/math/isless) - [`islessequal`](https://en.cppreference.com/w/cpp/numeric/math/islessequal) - [`islessgreater`](https://en.cppreference.com/w/cpp/numeric/math/islessgreater) - [`isunordered`](https://en.cppreference.com/w/cpp/numeric/math/isunordered) +.. _exp: https://en.cppreference.com/w/cpp/numeric/math/exp + +.. |exp| replace:: ``exp`` + +.. _exp2: https://en.cppreference.com/w/cpp/numeric/math/exp2 + +.. |exp2| replace:: ``exp2`` + +.. _expm1: https://en.cppreference.com/w/cpp/numeric/math/expm1 + +.. |expm1| replace:: ``expm1`` + +.. _log: https://en.cppreference.com/w/cpp/numeric/math/log + +.. |log| replace:: ``log`` + +.. _log10: https://en.cppreference.com/w/cpp/numeric/math/log10 + +.. |log10| replace:: ``log10`` + +.. _log2: https://en.cppreference.com/w/cpp/numeric/math/log2 + +.. |log2| replace:: ``log2`` + +.. _log1p: https://en.cppreference.com/w/cpp/numeric/math/log1p + +.. |log1p| replace:: ``log1p`` + +**Exponential functions** |exp|_ |exp2|_ |expm1|_ |log|_ |log10|_ |log2|_ |log1p|_ + +.. _pow: https://en.cppreference.com/w/cpp/numeric/math/pow + +.. |pow| replace:: ``pow`` + +.. _sqrt: https://en.cppreference.com/w/cpp/numeric/math/sqrt + +.. |sqrt| replace:: ``sqrt`` + +.. _cbrt: https://en.cppreference.com/w/cpp/numeric/math/cbrt + +.. |cbrt| replace:: ``cbrt`` + +.. _hypot*: https://en.cppreference.com/w/cpp/numeric/math/hypot + +.. |hypot*| replace:: ``hypot*`` + +**Power functions** |pow|_ |sqrt|_ |cbrt|_ |hypot*|_ + +.. _sin: https://en.cppreference.com/w/cpp/numeric/math/sin + +.. |sin| replace:: ``sin`` + +.. _cos: https://en.cppreference.com/w/cpp/numeric/math/cos + +.. |cos| replace:: ``cos`` + +.. _tan: https://en.cppreference.com/w/cpp/numeric/math/tan + +.. |tan| replace:: ``tan`` + +.. _asin: https://en.cppreference.com/w/cpp/numeric/math/asin + +.. |asin| replace:: ``asin`` + +.. _acos: https://en.cppreference.com/w/cpp/numeric/math/acos + +.. |acos| replace:: ``acos`` + +.. _atan: https://en.cppreference.com/w/cpp/numeric/math/atan + +.. |atan| replace:: ``atan`` + +.. _atan2: https://en.cppreference.com/w/cpp/numeric/math/atan2 + +.. |atan2| replace:: ``atan2`` + +**Trigonometric functions** |sin|_ |cos|_ |tan|_ |asin|_ |acos|_ |atan|_ |atan2|_ + +.. _sinh: https://en.cppreference.com/w/cpp/numeric/math/sinh + +.. |sinh| replace:: ``sinh`` + +.. _cosh: https://en.cppreference.com/w/cpp/numeric/math/cosh + +.. |cosh| replace:: ``cosh`` + +.. _tanh: https://en.cppreference.com/w/cpp/numeric/math/tanh + +.. |tanh| replace:: ``tanh`` + +.. _asinh: https://en.cppreference.com/w/cpp/numeric/math/asinh + +.. |asinh| replace:: ``asinh`` + +.. _acosh: https://en.cppreference.com/w/cpp/numeric/math/acosh + +.. |acosh| replace:: ``acosh`` + +.. _atanh: https://en.cppreference.com/w/cpp/numeric/math/atanh + +.. |atanh| replace:: ``atanh`` + +**Hyperbolic functions** |sinh|_ |cosh|_ |tanh|_ |asinh|_ |acosh|_ |atanh|_ + +.. _erf: https://en.cppreference.com/w/cpp/numeric/math/erf + +.. |erf| replace:: ``erf`` + +.. _erfc: https://en.cppreference.com/w/cpp/numeric/math/erfc + +.. |erfc| replace:: ``erfc`` + +.. _tgamma: https://en.cppreference.com/w/cpp/numeric/math/tgamma + +.. |tgamma| replace:: ``tgamma`` + +.. _lgamma: https://en.cppreference.com/w/cpp/numeric/math/lgamma + +.. |lgamma| replace:: ``lgamma`` + +**Error and gamma functions** |erf|_ |erfc|_ |tgamma|_ |lgamma|_ + +.. _ceil: https://en.cppreference.com/w/cpp/numeric/math/ceil + +.. |ceil| replace:: ``ceil`` + +.. _floor: https://en.cppreference.com/w/cpp/numeric/math/floor + +.. |floor| replace:: ``floor`` + +.. _trunc: https://en.cppreference.com/w/cpp/numeric/math/trunc + +.. |trunc| replace:: ``trunc`` + +.. _round*: https://en.cppreference.com/w/cpp/numeric/math/round + +.. |round*| replace:: ``round*`` + +.. _lround: https://en.cppreference.com/w/cpp/numeric/math/round + +.. |lround| replace:: ``lround`` + +.. _llround: https://en.cppreference.com/w/cpp/numeric/math/round + +.. |llround| replace:: ``llround`` + +.. _nearbyint*: https://en.cppreference.com/w/cpp/numeric/math/nearbyint + +.. |nearbyint*| replace:: ``nearbyint*`` + +.. _rint: https://en.cppreference.com/w/cpp/numeric/math/rint + +.. |rint| replace:: ``rint`` + +.. _lrint: https://en.cppreference.com/w/cpp/numeric/math/rint + +.. |lrint| replace:: ``lrint`` + +.. _llrint: https://en.cppreference.com/w/cpp/numeric/math/rint + +.. |llrint| replace:: ``llrint`` + +**Nearest integer floating point operations** |ceil|_ |floor|_ |trunc|_ |round*|_ |lround|_ |llround|_ |nearbyint*|_ |rint|_ |lrint|_ |llrint|_ + +.. _frexp: https://en.cppreference.com/w/cpp/numeric/math/frexp + +.. |frexp| replace:: ``frexp`` + +.. _ldexp: https://en.cppreference.com/w/cpp/numeric/math/ldexp + +.. |ldexp| replace:: ``ldexp`` + +.. _modf: https://en.cppreference.com/w/cpp/numeric/math/modf + +.. |modf| replace:: ``modf`` + +.. _scalbn: https://en.cppreference.com/w/cpp/numeric/math/scalbn + +.. |scalbn| replace:: ``scalbn`` + +.. _scalbln: https://en.cppreference.com/w/cpp/numeric/math/scalbln + +.. |scalbln| replace:: ``scalbln`` + +.. _ilog: https://en.cppreference.com/w/cpp/numeric/math/ilog + +.. |ilog| replace:: ``ilog`` + +.. _logb*: https://en.cppreference.com/w/cpp/numeric/math/logb + +.. |logb*| replace:: ``logb*`` + +.. _nextafter*: https://en.cppreference.com/w/cpp/numeric/math/nextafter + +.. |nextafter*| replace:: ``nextafter*`` + +.. _nexttoward: https://en.cppreference.com/w/cpp/numeric/math/nexttoward + +.. |nexttoward| replace:: ``nexttoward`` + +.. _copysign*: https://en.cppreference.com/w/cpp/numeric/math/copysign + +.. |copysign*| replace:: ``copysign*`` + +**Floating point manipulation functions** |frexp|_ |ldexp|_ |modf|_ |scalbn|_ |scalbln|_ |ilog|_ |logb*|_ |nextafter*|_ |nexttoward|_ |copysign*|_ + +.. _fpclassify: https://en.cppreference.com/w/cpp/numeric/math/fpclassify + +.. |fpclassify| replace:: ``fpclassify`` + +.. _isfinite: https://en.cppreference.com/w/cpp/numeric/math/isfinite + +.. |isfinite| replace:: ``isfinite`` + +.. _isinf: https://en.cppreference.com/w/cpp/numeric/math/isinf + +.. |isinf| replace:: ``isinf`` + +.. _isnan: https://en.cppreference.com/w/cpp/numeric/math/isnan + +.. |isnan| replace:: ``isnan`` + +.. _isnormal: https://en.cppreference.com/w/cpp/numeric/math/isnormal + +.. |isnormal| replace:: ``isnormal`` + +.. _signbit*: https://en.cppreference.com/w/cpp/numeric/math/signbit + +.. |signbit*| replace:: ``signbit*`` + +.. _isgreater: https://en.cppreference.com/w/cpp/numeric/math/isgreater + +.. |isgreater| replace:: ``isgreater`` + +.. _isgreaterequal: https://en.cppreference.com/w/cpp/numeric/math/isgreaterequal + +.. |isgreaterequal| replace:: ``isgreaterequal`` + +.. _isless: https://en.cppreference.com/w/cpp/numeric/math/isless + +.. |isless| replace:: ``isless`` + +.. _islessequal: https://en.cppreference.com/w/cpp/numeric/math/islessequal + +.. |islessequal| replace:: ``islessequal`` + +.. _islessgreater: https://en.cppreference.com/w/cpp/numeric/math/islessgreater + +.. |islessgreater| replace:: ``islessgreater`` + +.. _isunordered: https://en.cppreference.com/w/cpp/numeric/math/isunordered + +.. |isunordered| replace:: ``isunordered`` + +**Classification and comparison** |fpclassify|_ |isfinite|_ |isinf|_ |isnan|_ |isnormal|_ |signbit*|_ |isgreater|_ |isgreaterequal|_ |isless|_ |islessequal|_ |islessgreater|_ |isunordered|_ ------------ @@ -194,9 +367,11 @@ Notes ----- .. _openIssue: https://github.com/kokkos/kokkos/issues/new + .. |openIssue| replace:: **open an issue** .. _issue4767: https://github.com/kokkos/kokkos/issues/4767 + .. |issue4767| replace:: **Issue #4767** * **Feel free to** |openIssue|_ **if you need one of the functions that is currently not implemented.** |issue4767|_ **is keeping track of these and has notes about implementability.** From fd81b27b247388d2ca8e2df9315fb7f7ae3e21a5 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Sat, 21 Jan 2023 16:12:10 +0100 Subject: [PATCH 4/5] kokkos#120: API/core/numerics/mathematical-functions rework not provided function display --- .../core/numerics/mathematical-functions.rst | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/docs/source/API/core/numerics/mathematical-functions.rst b/docs/source/API/core/numerics/mathematical-functions.rst index 9794846d9..f7135ab84 100644 --- a/docs/source/API/core/numerics/mathematical-functions.rst +++ b/docs/source/API/core/numerics/mathematical-functions.rst @@ -59,8 +59,6 @@ See below the list of common mathematical functions supported. We refer the read ------------ -:strike:`func` denotes functions that are currently not provided by Kokkos - ``func*`` see notes below .. _abs: https://en.cppreference.com/w/cpp/numeric/math/fabs @@ -81,7 +79,7 @@ See below the list of common mathematical functions supported. We refer the read .. _remquo: https://en.cppreference.com/w/cpp/numeric/math/remquo -.. |remquo| replace:: ``remquo`` +.. |remquo| replace:: ``remquo`` .. _fma*: https://en.cppreference.com/w/cpp/numeric/math/fma @@ -103,7 +101,7 @@ See below the list of common mathematical functions supported. We refer the read .. |nan| replace:: ``nan`` -**Basic operations** |abs|_ |fabs|_ |fmod|_ |remainder|_ |remquo|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ +**Basic operations** |abs|_ |fabs|_ |fmod|_ |remainder|_ |fma*|_ |fmax|_ |fmin|_ |fdim|_ |nan|_ (currently not provided by Kokkos: |remquo|_) .. _exp: https://en.cppreference.com/w/cpp/numeric/math/exp @@ -245,11 +243,11 @@ See below the list of common mathematical functions supported. We refer the read .. _lround: https://en.cppreference.com/w/cpp/numeric/math/round -.. |lround| replace:: ``lround`` +.. |lround| replace:: ``lround`` .. _llround: https://en.cppreference.com/w/cpp/numeric/math/round -.. |llround| replace:: ``llround`` +.. |llround| replace:: ``llround`` .. _nearbyint*: https://en.cppreference.com/w/cpp/numeric/math/nearbyint @@ -257,41 +255,41 @@ See below the list of common mathematical functions supported. We refer the read .. _rint: https://en.cppreference.com/w/cpp/numeric/math/rint -.. |rint| replace:: ``rint`` +.. |rint| replace:: ``rint`` .. _lrint: https://en.cppreference.com/w/cpp/numeric/math/rint -.. |lrint| replace:: ``lrint`` +.. |lrint| replace:: ``lrint`` .. _llrint: https://en.cppreference.com/w/cpp/numeric/math/rint -.. |llrint| replace:: ``llrint`` +.. |llrint| replace:: ``llrint`` -**Nearest integer floating point operations** |ceil|_ |floor|_ |trunc|_ |round*|_ |lround|_ |llround|_ |nearbyint*|_ |rint|_ |lrint|_ |llrint|_ +**Nearest integer floating point operations** |ceil|_ |floor|_ |trunc|_ |round*|_ |nearbyint*|_ (currently not provided by Kokkos: |lround|_ |llround|_ |rint|_ |lrint|_ |llrint|_) .. _frexp: https://en.cppreference.com/w/cpp/numeric/math/frexp -.. |frexp| replace:: ``frexp`` +.. |frexp| replace:: ``frexp`` .. _ldexp: https://en.cppreference.com/w/cpp/numeric/math/ldexp -.. |ldexp| replace:: ``ldexp`` +.. |ldexp| replace:: ``ldexp`` .. _modf: https://en.cppreference.com/w/cpp/numeric/math/modf -.. |modf| replace:: ``modf`` +.. |modf| replace:: ``modf`` .. _scalbn: https://en.cppreference.com/w/cpp/numeric/math/scalbn -.. |scalbn| replace:: ``scalbn`` +.. |scalbn| replace:: ``scalbn`` .. _scalbln: https://en.cppreference.com/w/cpp/numeric/math/scalbln -.. |scalbln| replace:: ``scalbln`` +.. |scalbln| replace:: ``scalbln`` .. _ilog: https://en.cppreference.com/w/cpp/numeric/math/ilog -.. |ilog| replace:: ``ilog`` +.. |ilog| replace:: ``ilog`` .. _logb*: https://en.cppreference.com/w/cpp/numeric/math/logb @@ -303,17 +301,17 @@ See below the list of common mathematical functions supported. We refer the read .. _nexttoward: https://en.cppreference.com/w/cpp/numeric/math/nexttoward -.. |nexttoward| replace:: ``nexttoward`` +.. |nexttoward| replace:: ``nexttoward`` .. _copysign*: https://en.cppreference.com/w/cpp/numeric/math/copysign .. |copysign*| replace:: ``copysign*`` -**Floating point manipulation functions** |frexp|_ |ldexp|_ |modf|_ |scalbn|_ |scalbln|_ |ilog|_ |logb*|_ |nextafter*|_ |nexttoward|_ |copysign*|_ +**Floating point manipulation functions** |logb*|_ |nextafter*|_ |copysign*|_ (currently not provided by Kokkos: |frexp|_ |ldexp|_ |modf|_ |scalbn|_ |scalbln|_ |ilog|_ |nexttoward|_) .. _fpclassify: https://en.cppreference.com/w/cpp/numeric/math/fpclassify -.. |fpclassify| replace:: ``fpclassify`` +.. |fpclassify| replace:: ``fpclassify`` .. _isfinite: https://en.cppreference.com/w/cpp/numeric/math/isfinite @@ -329,7 +327,7 @@ See below the list of common mathematical functions supported. We refer the read .. _isnormal: https://en.cppreference.com/w/cpp/numeric/math/isnormal -.. |isnormal| replace:: ``isnormal`` +.. |isnormal| replace:: ``isnormal`` .. _signbit*: https://en.cppreference.com/w/cpp/numeric/math/signbit @@ -337,29 +335,29 @@ See below the list of common mathematical functions supported. We refer the read .. _isgreater: https://en.cppreference.com/w/cpp/numeric/math/isgreater -.. |isgreater| replace:: ``isgreater`` +.. |isgreater| replace:: ``isgreater`` .. _isgreaterequal: https://en.cppreference.com/w/cpp/numeric/math/isgreaterequal -.. |isgreaterequal| replace:: ``isgreaterequal`` +.. |isgreaterequal| replace:: ``isgreaterequal`` .. _isless: https://en.cppreference.com/w/cpp/numeric/math/isless -.. |isless| replace:: ``isless`` +.. |isless| replace:: ``isless`` .. _islessequal: https://en.cppreference.com/w/cpp/numeric/math/islessequal -.. |islessequal| replace:: ``islessequal`` +.. |islessequal| replace:: ``islessequal`` .. _islessgreater: https://en.cppreference.com/w/cpp/numeric/math/islessgreater -.. |islessgreater| replace:: ``islessgreater`` +.. |islessgreater| replace:: ``islessgreater`` .. _isunordered: https://en.cppreference.com/w/cpp/numeric/math/isunordered -.. |isunordered| replace:: ``isunordered`` +.. |isunordered| replace:: ``isunordered`` -**Classification and comparison** |fpclassify|_ |isfinite|_ |isinf|_ |isnan|_ |isnormal|_ |signbit*|_ |isgreater|_ |isgreaterequal|_ |isless|_ |islessequal|_ |islessgreater|_ |isunordered|_ +**Classification and comparison** |isfinite|_ |isinf|_ |isnan|_ |signbit*|_ (currently not provided by Kokkos: |fpclassify|_ |isnormal|_ |isgreater|_ |isgreaterequal|_ |isless|_ |islessequal|_ |islessgreater|_ |isunordered|_) ------------ From 144246eb85ace7ca6991c06269c1b462174b11af Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Wed, 1 Feb 2023 11:22:48 +0100 Subject: [PATCH 5/5] kokkos#120: API/core/numerics/mathematical-functions use cppkokkos --- docs/source/API/core/numerics/mathematical-functions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/API/core/numerics/mathematical-functions.rst b/docs/source/API/core/numerics/mathematical-functions.rst index f7135ab84..3a1b19277 100644 --- a/docs/source/API/core/numerics/mathematical-functions.rst +++ b/docs/source/API/core/numerics/mathematical-functions.rst @@ -1,8 +1,8 @@ Common math functions ===================== -.. role::cpp(code) - :language: cpp +.. role:: cppkokkos(code) + :language: cppkokkos .. role:: strike :class: strike