Skip to content

Commit 334d591

Browse files
authored
Merge pull request #2452 from andreyfe1/student_sample_fix
[oneMKL] Fixed namespace for math functions in Student's T-test
2 parents e736c01 + 4b84b47 commit 334d591

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Libraries/oneMKL/student_t_test/t_test.cpp

Lines changed: 11 additions & 11 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, sycl::buffer<RealType, 1> &r,
4040
std::int64_t n, 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
// Create buffers to be passed inside oneMKL stats functions
4545
sycl::buffer<RealType, 1> mean_buf(sycl::range{1});
@@ -55,8 +55,8 @@ std::int32_t t_test(sycl::queue &q, sycl::buffer<RealType, 1> &r,
5555
// Create Host accessors and check the condition
5656
sycl::host_accessor mean_acc(mean_buf);
5757
sycl::host_accessor variance_acc(variance_buf);
58-
if ((sycl::abs(mean_acc[0] - expected_mean) * sqrt_n_observations /
59-
sycl::sqrt(variance_acc[0])) < static_cast<RealType>(threshold)) {
58+
if ((std::abs(mean_acc[0] - expected_mean) * sqrt_n_observations /
59+
std::sqrt(variance_acc[0])) < static_cast<RealType>(threshold)) {
6060
res = 1;
6161
} else {
6262
res = 0;
@@ -100,19 +100,19 @@ std::int32_t t_test(sycl::queue &q, sycl::buffer<RealType, 1> &r1,
100100
bool almost_equal = (variance1_acc[0] < 2 * variance2_acc[0]) ||
101101
(variance2_acc[0] < 2 * variance1_acc[0]);
102102
if (almost_equal) {
103-
if ((sycl::abs(mean1_acc[0] - mean2_acc[0]) /
104-
sycl::sqrt((static_cast<RealType>(1.0) / static_cast<RealType>(n1) +
105-
static_cast<RealType>(1.0) / static_cast<RealType>(n2)) *
106-
((n1 - 1) * (n1 - 1) * variance1_acc[0] +
107-
(n2 - 1) * (n2 - 1) * variance2_acc[0]) /
108-
(n1 + n2 - 2))) < static_cast<RealType>(threshold)) {
103+
if ((std::abs(mean1_acc[0] - mean2_acc[0]) /
104+
std::sqrt((static_cast<RealType>(1.0) / static_cast<RealType>(n1) +
105+
static_cast<RealType>(1.0) / static_cast<RealType>(n2)) *
106+
((n1 - 1) * (n1 - 1) * variance1_acc[0] +
107+
(n2 - 1) * (n2 - 1) * variance2_acc[0]) /
108+
(n1 + n2 - 2))) < static_cast<RealType>(threshold)) {
109109
res = 1;
110110
} else {
111111
res = 0;
112112
}
113113
} else {
114-
if ((sycl::abs(mean1_acc[0] - mean2_acc[0]) /
115-
sycl::sqrt((variance1_acc[0] + variance2_acc[0]))) <
114+
if ((std::abs(mean1_acc[0] - mean2_acc[0]) /
115+
std::sqrt((variance1_acc[0] + variance2_acc[0]))) <
116116
static_cast<RealType>(threshold)) {
117117
res = 1;
118118
} else {

0 commit comments

Comments
 (0)