32 #ifndef __NABE_TEST_HELPERS_H
33 #define __NABE_TEST_HELPERS_H
51 ifstream ifs(fileName);
54 cerr <<
"Cannot open file "<< fileName << endl;
65 ifs.getline(line,
sizeof(line));
66 line[
sizeof(line)-1] = 0;
68 char *token = strtok(line,
" \t,;");
73 data.push_back(atof(token));
74 token = strtok(NULL,
" \t,;");
79 return Matrix::Map(&data[0], dim, data.size() / dim);
88 VectorT
q = d.col(i % d.cols());
90 for (
int j = 0; j <
q.size(); ++j)
92 absBound /= (-method);
95 q.array() += absBound;
97 q.array() -= absBound;
100 q.cwise() += absBound;
102 q.cwise() -= absBound;
109 for (
int j = 0; j <
q.size(); ++j)
121 MatrixT
q(d.rows(), itCount);
122 for (
int i = 0; i < itCount; ++i)
123 q.col(i) = createQuery<T>(d, *
nns, i, method);
130 using Clock = std::chrono::high_resolution_clock;
131 using Time = Clock::time_point;
137 using namespace std::chrono;
138 return duration_cast<duration<double>>(curTime() - _start_time).count();
148 #endif // __NABE_TEST_HELPERS_H