From 9ee7bce966289f1733063e60eac47554c622acfb Mon Sep 17 00:00:00 2001 From: Maarten Arnst Date: Sat, 19 Nov 2022 22:07:39 +0100 Subject: [PATCH] Add fmin and fmax stokhos mp vector specialisations. --- .../src/sacado/kokkos/Stokhos_Sacado_Kokkos_MathFunctions.hpp | 2 ++ .../stokhos/src/sacado/kokkos/vector/Sacado_MP_Vector_ops.hpp | 2 ++ .../stokhos/test/UnitTest/Stokhos_SacadoMPVectorUnitTest.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/packages/stokhos/src/sacado/kokkos/Stokhos_Sacado_Kokkos_MathFunctions.hpp b/packages/stokhos/src/sacado/kokkos/Stokhos_Sacado_Kokkos_MathFunctions.hpp index 3367c792dd76..62b285cafb35 100644 --- a/packages/stokhos/src/sacado/kokkos/Stokhos_Sacado_Kokkos_MathFunctions.hpp +++ b/packages/stokhos/src/sacado/kokkos/Stokhos_Sacado_Kokkos_MathFunctions.hpp @@ -181,6 +181,8 @@ BINARYFUNC_MACRO(atan2, Atan2Op) BINARYFUNC_MACRO(pow, PowerOp) BINARYFUNC_MACRO(max, MaxOp) BINARYFUNC_MACRO(min, MinOp) +BINARYFUNC_MACRO(fmax, FMaxOp) +BINARYFUNC_MACRO(fmin, FMinOp) #undef BINARYFUNC_MACRO #undef BINARYFUNC_MACRO_SFS diff --git a/packages/stokhos/src/sacado/kokkos/vector/Sacado_MP_Vector_ops.hpp b/packages/stokhos/src/sacado/kokkos/vector/Sacado_MP_Vector_ops.hpp index f068644ee0a6..c56f5be291bf 100644 --- a/packages/stokhos/src/sacado/kokkos/vector/Sacado_MP_Vector_ops.hpp +++ b/packages/stokhos/src/sacado/kokkos/vector/Sacado_MP_Vector_ops.hpp @@ -821,6 +821,8 @@ MP_BINARYOP_MACRO(min, MinOp, ::min, using std::min;) MP_BINARYOP_MACRO(max, MaxOp, max, using std::max;) MP_BINARYOP_MACRO(min, MinOp, min, using std::min;) #endif +MP_BINARYOP_MACRO(fmax, FMaxOp, fmax, using std::fmax;) +MP_BINARYOP_MACRO(fmin, FMinOp, fmin, using std::fmin;) #undef MP_BINARYOP_MACRO diff --git a/packages/stokhos/test/UnitTest/Stokhos_SacadoMPVectorUnitTest.cpp b/packages/stokhos/test/UnitTest/Stokhos_SacadoMPVectorUnitTest.cpp index ecfdfe52726e..bf4ccd284d33 100644 --- a/packages/stokhos/test/UnitTest/Stokhos_SacadoMPVectorUnitTest.cpp +++ b/packages/stokhos/test/UnitTest/Stokhos_SacadoMPVectorUnitTest.cpp @@ -565,6 +565,9 @@ struct UnitTestSetup { /* Operators min and max are not supported for complex type. */ \ BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, max , max , using std::max ;, Max) \ BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, min , min , using std::min ;, Min) \ + /* Operators fmin and fmax are not supported for complex type. */ \ + BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, fmax , fmax , using std::fmax ;, FMax) \ + BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, fmin , fmin , using std::fmin ;, FMin) \ /* Ternary test uses 'operator<' that is not defined for complex type. */ \ TERNARY_UNIT_TEST(VEC, SCALAR_T)