Skip to content

Commit b4deef7

Browse files
authored
Merge pull request #2459 from andreyfe1/student_t_test_usm_std
[oneMKL] Fixed namespace for math functions in Student's T-test. USM version
2 parents 16986e3 + 92eeaa5 commit b4deef7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Libraries/oneMKL/student_t_test/t_test_usm.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ template <typename RealType>
3939
std::int32_t t_test(sycl::queue& q, RealType* r, std::int64_t n,
4040
RealType expected_mean) {
4141
std::int32_t res = -1;
42-
RealType sqrt_n_observations = sycl::sqrt(static_cast<RealType>(n));
42+
RealType sqrt_n_observations = std::sqrt(static_cast<RealType>(n));
4343

4444
// Allocate memory to be passed inside oneMKL stats functions
4545
RealType* mean = sycl::malloc_shared<RealType>(1, q);
@@ -53,8 +53,8 @@ std::int32_t t_test(sycl::queue& q, RealType* r, std::int64_t n,
5353
oneapi::mkl::stats::central_moment(q, mean, dataset, variance);
5454
q.wait_and_throw();
5555
// Check the condition
56-
if ((sycl::abs(mean[0] - expected_mean) * sqrt_n_observations /
57-
sycl::sqrt(variance[0])) < static_cast<RealType>(threshold)) {
56+
if ((std::abs(mean[0] - expected_mean) * sqrt_n_observations /
57+
std::sqrt(variance[0])) < static_cast<RealType>(threshold)) {
5858
res = 1;
5959
} else {
6060
res = 0;
@@ -95,8 +95,8 @@ std::int32_t t_test(sycl::queue& q, RealType* r1, std::int64_t n1,
9595
bool almost_equal =
9696
(variance1[0] < 2 * variance2[0]) || (variance2[0] < 2 * variance1[0]);
9797
if (almost_equal) {
98-
if ((sycl::abs(mean1[0] - mean2[0]) /
99-
sycl::sqrt((static_cast<RealType>(1.0) / static_cast<RealType>(n1) +
98+
if ((std::abs(mean1[0] - mean2[0]) /
99+
std::sqrt((static_cast<RealType>(1.0) / static_cast<RealType>(n1) +
100100
static_cast<RealType>(1.0) / static_cast<RealType>(n2)) *
101101
((n1 - 1) * (n1 - 1) * variance1[0] +
102102
(n2 - 1) * (n2 - 1) * variance2[0]) /
@@ -106,8 +106,8 @@ std::int32_t t_test(sycl::queue& q, RealType* r1, std::int64_t n1,
106106
res = 0;
107107
}
108108
} else {
109-
if ((sycl::abs(mean1[0] - mean2[0]) /
110-
sycl::sqrt((variance1[0] + variance2[0]))) <
109+
if ((std::abs(mean1[0] - mean2[0]) /
110+
std::sqrt((variance1[0] + variance2[0]))) <
111111
static_cast<RealType>(threshold)) {
112112
res = 1;
113113
} else {
@@ -201,4 +201,4 @@ int main(int argc, char** argv) {
201201
std::cout << "T-test result with two input arrays: " << res1 << "\n\n";
202202

203203
return 0;
204-
}
204+
}

0 commit comments

Comments
 (0)