Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add NVRTC support to erf_inv and erfc_inv
  • Loading branch information
mborland committed Aug 14, 2024
commit 6a4487453d95c1fbf5ecf3da18f2c020a89fd612
61 changes: 61 additions & 0 deletions include/boost/math/special_functions/detail/erf_inv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#endif

#include <boost/math/tools/config.hpp>

#ifndef BOOST_MATH_HAS_NVRTC

#include <type_traits>

namespace boost{ namespace math{
Expand Down Expand Up @@ -490,6 +493,64 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args<T>::type erf_inv(T z)
} // namespace math
} // namespace boost

#else // Special handling for NVRTC

namespace boost {
namespace math {

template <typename T>
BOOST_MATH_GPU_ENABLED auto erf_inv(T x)
{
return ::erfinv(x);
}

template <>
BOOST_MATH_GPU_ENABLED auto erf_inv(float x)
{
return ::erfinvf(x);
}

template <typename T, typename Policy>
BOOST_MATH_GPU_ENABLED auto erf_inv(T x, const Policy&)
{
return ::erfinv(x);
}

template <typename Policy>
BOOST_MATH_GPU_ENABLED auto erf_inv(float x, const Policy&)
{
return ::erfinvf(x);
}

template <typename T>
BOOST_MATH_GPU_ENABLED auto erfc_inv(T x)
{
return ::erfcinv(x);
}

template <>
BOOST_MATH_GPU_ENABLED auto erfc_inv(float x)
{
return ::erfcinvf(x);
}

template <typename T, typename Policy>
BOOST_MATH_GPU_ENABLED auto erfc_inv(T x, const Policy&)
{
return ::erfcinv(x);
}

template <typename Policy>
BOOST_MATH_GPU_ENABLED auto erfc_inv(float x, const Policy&)
{
return ::erfcinvf(x);
}

} // namespace math
} // namespace boost

#endif // BOOST_MATH_HAS_NVRTV

#ifdef _MSC_VER
#pragma warning(pop)
#endif
Expand Down