#include #include #include #include #include #include "serialDeclarations.h" void get_args(int argc, char **argv, int *h){ if (argc != 6) { printf("Usage: %s h N D Pd Pl\nwhere:\n", argv[0]); printf("\th is the variance\n"); printf("\tN is the the number of points\n"); printf("\tD is the number of dimensions of each point\n"); printf("\tPd is the path of the dataset file\n"); printf("\tPl is the path of the labels file\n"); exit(1); } *h = atoi(argv[1]); NUMBER_OF_POINTS = atoi(argv[2]); DIMENSIONS = atoi(argv[3]); POINTS_FILENAME = argv[4]; LABELS_FILENAME = argv[5]; } int meanshift(double **originalPoints, double ***shiftedPoints, int h , parameters *opt, int iteration){ // allocates space and copies original points on first iteration if (iteration == 1){ (*shiftedPoints) = alloc_2d_double(NUMBER_OF_POINTS, DIMENSIONS); (*shiftedPoints) = duplicate(originalPoints, (*shiftedPoints) , NUMBER_OF_POINTS, DIMENSIONS); } // mean shift vector double **meanShiftVector; meanShiftVector = alloc_2d_double(NUMBER_OF_POINTS, DIMENSIONS); // initialize elements of meanShiftVector to inf for (int i=0;i opt->epsilon) { return meanshift(originalPoints, shiftedPoints, h, opt, ++iteration); } return iteration; } // TODO check why there's is a difference in the norm calculate in matlab double norm(double **matrix, int rows, int cols){ double sum=0, tempMul=0; for (int i=0; i