-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
30 lines (25 loc) · 872 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef UTILS_H
#define UTILS_H
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <float.h>
typedef std::vector<std::pair<double,double>> pointsType;
typedef std::pair<double, int> pi;
typedef std::map<int, std::vector<pi>> KnnType;
struct Task {
Task(int start, int end, int k,std::vector<std::pair<double,double>>*points):
start(start),end(end),k(k),points(points){}
int start;
int end;
int k;
std::vector<std::pair<double,double>>* points;
};
void readFile(pointsType& points,std::string filename);
void writeFile(std::vector<KnnType*>& knns,std::string filename);
void writeFile(std::vector<KnnType>& knns,std::string filename);
KnnType* computeKNN(Task* t);
std::pair<int,double> findMax(std::vector< pi >& vec);
double computeDistance(std::pair<double, double> first, std::pair<double, double> second);
#endif