Skip to content

Commit 163bd3c

Browse files
Replaced remaining uses of std::cos, std::exp, etc.
1 parent 69ce776 commit 163bd3c

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

dpctl/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ template <typename fnT, typename T> struct CoshContigFactory
213213

214214
template <typename fnT, typename T> struct CoshTypeMapFactory
215215
{
216-
/*! @brief get typeid for output type of std::cosh(T x) */
216+
/*! @brief get typeid for output type of sycl::cosh(T x) */
217217
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
218218
{
219219
using rT = typename CoshOutputType<T>::value_type;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ template <typename argT, typename resT> struct ExpFunctor
104104
}
105105
else { /* x is -inf */
106106
if (std::isfinite(y)) {
107-
realT exp_x = std::exp(x);
107+
realT exp_x = sycl::exp(x);
108108
return resT{exp_x * sycl::cos(y), exp_x * sycl::sin(y)};
109109
}
110110
else {
@@ -182,7 +182,7 @@ template <typename fnT, typename T> struct ExpContigFactory
182182

183183
template <typename fnT, typename T> struct ExpTypeMapFactory
184184
{
185-
/*! @brief get typeid for output type of std::exp(T x) */
185+
/*! @brief get typeid for output type of sycl::exp(T x) */
186186
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
187187
{
188188
using rT = typename ExpOutputType<T>::value_type;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ template <typename argT, typename resT> struct Exp2Functor
106106
}
107107
else { /* x is -inf */
108108
if (std::isfinite(y)) {
109-
realT exp_x = std::exp(x);
109+
realT exp_x = sycl::exp(x);
110110
return resT{exp_x * sycl::cos(y), exp_x * sycl::sin(y)};
111111
}
112112
else {
@@ -184,7 +184,7 @@ template <typename fnT, typename T> struct Exp2ContigFactory
184184

185185
template <typename fnT, typename T> struct Exp2TypeMapFactory
186186
{
187-
/*! @brief get typeid for output type of std::exp2(T x) */
187+
/*! @brief get typeid for output type of sycl::exp2(T x) */
188188
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
189189
{
190190
using rT = typename Exp2OutputType<T>::value_type;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ template <typename argT, typename resT> struct Expm1Functor
8484
return in;
8585
}
8686
else {
87-
return (resT{sycl::copysign(x, std::cos(y)),
88-
sycl::copysign(x, std::sin(y))});
87+
return (resT{sycl::copysign(x, sycl::cos(y)),
88+
sycl::copysign(x, sycl::sin(y))});
8989
}
9090
}
9191
else {
@@ -97,7 +97,7 @@ template <typename argT, typename resT> struct Expm1Functor
9797
}
9898
else {
9999
return resT{realT(-1),
100-
sycl::copysign(realT(0), std::sin(y))};
100+
sycl::copysign(realT(0), sycl::sin(y))};
101101
}
102102
}
103103
}
@@ -113,13 +113,13 @@ template <typename argT, typename resT> struct Expm1Functor
113113
}
114114

115115
// x, y finite numbers
116-
const realT cosY_val = std::cos(y);
117-
const realT sinY_val = (y == 0) ? y : std::sin(y);
118-
const realT sinhalfY_val = (y == 0) ? y : std::sin(y / 2);
116+
const realT cosY_val = sycl::cos(y);
117+
const realT sinY_val = (y == 0) ? y : sycl::sin(y);
118+
const realT sinhalfY_val = (y == 0) ? y : sycl::sin(y / 2);
119119

120120
const realT res_re =
121-
std::expm1(x) * cosY_val - 2 * sinhalfY_val * sinhalfY_val;
122-
realT res_im = std::exp(x) * sinY_val;
121+
sycl::expm1(x) * cosY_val - 2 * sinhalfY_val * sinhalfY_val;
122+
realT res_im = sycl::exp(x) * sinY_val;
123123
return resT{res_re, res_im};
124124
}
125125
else {
@@ -129,7 +129,7 @@ template <typename argT, typename resT> struct Expm1Functor
129129
if (in == 0) {
130130
return in;
131131
}
132-
return std::expm1(in);
132+
return sycl::expm1(in);
133133
}
134134
}
135135
};
@@ -197,7 +197,7 @@ template <typename fnT, typename T> struct Expm1ContigFactory
197197

198198
template <typename fnT, typename T> struct Expm1TypeMapFactory
199199
{
200-
/*! @brief get typeid for output type of std::expm1(T x) */
200+
/*! @brief get typeid for output type of sycl::expm1(T x) */
201201
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
202202
{
203203
using rT = typename Expm1OutputType<T>::value_type;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ template <typename argT1, typename argT2, typename resT> struct LogAddExpFunctor
9191
private:
9292
template <typename T> T impl_finite(T const &in) const
9393
{
94-
return (in > 0) ? (in + std::log1p(std::exp(-in)))
95-
: std::log1p(std::exp(in));
94+
return (in > 0) ? (in + sycl::log1p(sycl::exp(-in)))
95+
: sycl::log1p(sycl::exp(in));
9696
}
9797
};
9898

dpctl/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ template <typename argT, typename resT> struct SinFunctor
158158
}
159159
const realT sinh_re = x * sycl::cos(y);
160160
const realT sinh_im =
161-
std::numeric_limits<realT>::infinity() * std::sin(y);
161+
std::numeric_limits<realT>::infinity() * sycl::sin(y);
162162
return resT{sinh_im, -sinh_re};
163163
}
164164

@@ -246,7 +246,7 @@ template <typename fnT, typename T> struct SinContigFactory
246246

247247
template <typename fnT, typename T> struct SinTypeMapFactory
248248
{
249-
/*! @brief get typeid for output type of std::sin(T x) */
249+
/*! @brief get typeid for output type of sycl::sin(T x) */
250250
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
251251
{
252252
using rT = typename SinOutputType<T>::value_type;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ template <typename fnT, typename T> struct SinhContigFactory
215215

216216
template <typename fnT, typename T> struct SinhTypeMapFactory
217217
{
218-
/*! @brief get typeid for output type of std::sinh(T x) */
218+
/*! @brief get typeid for output type of sycl::sinh(T x) */
219219
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
220220
{
221221
using rT = typename SinhOutputType<T>::value_type;

dpctl/tensor/libtensor/include/utils/math_utils.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,16 @@ template <typename T> T min_complex(const T &x1, const T &x2)
118118
template <typename T> T logaddexp(T x, T y)
119119
{
120120
if (x == y) { // handle signed infinities
121-
const T log2 = std::log(T(2));
121+
const T log2 = sycl::log(T(2));
122122
return x + log2;
123123
}
124124
else {
125125
const T tmp = x - y;
126126
if (tmp > 0) {
127-
return x + std::log1p(std::exp(-tmp));
127+
return x + sycl::log1p(sycl::exp(-tmp));
128128
}
129129
else if (tmp <= 0) {
130-
return y + std::log1p(std::exp(tmp));
130+
return y + sycl::log1p(sycl::exp(tmp));
131131
}
132132
else {
133133
return std::numeric_limits<T>::quiet_NaN();

0 commit comments

Comments
 (0)