You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
6 years ago
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <sys/time.h>
|
||
|
|
||
|
#include "knnSerialDeclarations.h"
|
||
|
|
||
|
/* Structs */
|
||
|
struct timeval startwtime, endwtime;
|
||
|
double seq_time;
|
||
|
|
||
|
/* Global variable */
|
||
|
int numberOfPoints = 0, numberOfDimensions = 0, numberOfNeighbors = 0, direction = 0, k = 0;
|
||
|
char *pointsFilename, *testFilename;
|
||
|
|
||
|
/* Main */
|
||
|
int main(int argc, char **argv){
|
||
|
double **pointsArray;
|
||
|
neighbor **sortedNeighborsArray;
|
||
|
|
||
|
getArguments(argc, argv);
|
||
|
init(&pointsArray, &sortedNeighborsArray);
|
||
|
|
||
|
gettimeofday(&startwtime, NULL);
|
||
|
|
||
|
calculateDistances(&pointsArray, &pointsArray, &sortedNeighborsArray);
|
||
|
|
||
|
for (int point=0; point<numberOfPoints; ++point){
|
||
|
qsort (sortedNeighborsArray[point], numberOfNeighbors, sizeof(neighbor), compare);
|
||
|
}
|
||
|
|
||
|
gettimeofday(&endwtime, NULL);
|
||
|
seq_time = (double)((endwtime.tv_usec - startwtime.tv_usec)/1.0e6
|
||
|
+ endwtime.tv_sec - startwtime.tv_sec);
|
||
|
printf("Wall clock time = %f\n\n", seq_time);
|
||
|
|
||
|
if (test(&sortedNeighborsArray, testFilename)){
|
||
|
printf("Validity check failed!\n");
|
||
|
} else {
|
||
|
printf("Validity check success!\n");
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Uncomment to print the results
|
||
|
*/
|
||
|
/*for (int x=0; x<numberOfPoints; ++x){
|
||
|
for (int y=0; y<k; ++y){
|
||
|
printf("%d to %d = %f\n", x, sortedNeighborsArray[x][y].neighborId, sortedNeighborsArray[x][y].distance);
|
||
|
}
|
||
|
printf("\n");
|
||
|
}*/
|
||
|
|
||
|
cleanUp(&pointsArray, &sortedNeighborsArray);
|
||
|
}
|