/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_VALARRAY_HYPERBOLIC_HPP #define SPROUT_VALARRAY_HYPERBOLIC_HPP #include #include #include #include #include #include #include #include #include #include #include #include namespace sprout_math_detail { using sprout::math::acosh; using sprout::math::asinh; using sprout::math::atanh; using sprout::math::cosh; using sprout::math::sinh; using sprout::math::tanh; template inline SPROUT_CONSTEXPR decltype(acosh(std::declval())) call_acosh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(acosh(std::declval())) { return acosh(SPROUT_FORWARD(T, x)); } template inline SPROUT_CONSTEXPR decltype(asinh(std::declval())) call_asinh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(asinh(std::declval())) { return asinh(SPROUT_FORWARD(T, x)); } template inline SPROUT_CONSTEXPR decltype(atanh(std::declval())) call_atanh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(atanh(std::declval())) { return atanh(SPROUT_FORWARD(T, x)); } template inline SPROUT_CONSTEXPR decltype(cosh(std::declval())) call_cosh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(cosh(std::declval())) { return cosh(SPROUT_FORWARD(T, x)); } template inline SPROUT_CONSTEXPR decltype(sinh(std::declval())) call_sinh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sinh(std::declval())) { return sinh(SPROUT_FORWARD(T, x)); } template inline SPROUT_CONSTEXPR decltype(tanh(std::declval())) call_tanh(T&& x) SPROUT_NOEXCEPT_IF_EXPR(tanh(std::declval())) { return tanh(SPROUT_FORWARD(T, x)); } } // namespace sprout namespace sprout { namespace detail { struct acosh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_acosh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_acosh(std::declval())) { return sprout_math_detail::call_acosh(SPROUT_FORWARD(T, x)); } }; struct asinh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_asinh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_asinh(std::declval())) { return sprout_math_detail::call_asinh(SPROUT_FORWARD(T, x)); } }; struct atanh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_atanh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_atanh(std::declval())) { return sprout_math_detail::call_atanh(SPROUT_FORWARD(T, x)); } }; struct cosh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_cosh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_cosh(std::declval())) { return sprout_math_detail::call_cosh(SPROUT_FORWARD(T, x)); } }; struct sinh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_sinh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_sinh(std::declval())) { return sprout_math_detail::call_sinh(SPROUT_FORWARD(T, x)); } }; struct tanh_f : public sprout::transparent<> { public: template SPROUT_CONSTEXPR decltype(sprout_math_detail::call_tanh(std::declval())) operator()(T&& x) SPROUT_NOEXCEPT_IF_EXPR(sprout_math_detail::call_tanh(std::declval())) { return sprout_math_detail::call_tanh(SPROUT_FORWARD(T, x)); } }; } // namespace detail // // acosh // template inline SPROUT_CONSTEXPR sprout::valarray acosh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::acosh_f()); } // // asinh // template inline SPROUT_CONSTEXPR sprout::valarray asinh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::asinh_f()); } // // atanh // template inline SPROUT_CONSTEXPR sprout::valarray atanh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::atanh_f()); } // // cosh // template inline SPROUT_CONSTEXPR sprout::valarray cosh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::cosh_f()); } // // sinh // template inline SPROUT_CONSTEXPR sprout::valarray sinh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::sinh_f()); } // // tanh // template inline SPROUT_CONSTEXPR sprout::valarray tanh(sprout::valarray const& x) { return sprout::fixed::transform(x.begin(), x.end(), x, sprout::detail::tanh_f()); } } // namespace sprout #endif // #ifndef SPROUT_VALARRAY_HYPERBOLIC_HPP