#include #include #include #include #include #include "serialDeclarations.h" void meanshift(double **originalPoints, int h, parameters *opt){ double **y; y = alloc_2d_double(ROWS, COLUMNS); y = duplicate(originalPoints, y, ROWS, COLUMNS); // mean shift vector double **meanShiftVector; meanShiftVector = alloc_2d_double(ROWS, COLUMNS); // initialize elements of meanShiftVector to inf for (int i=0;iepsilon); double ** kernelMatrix = alloc_2d_double(ROWS, ROWS); double *denominator = malloc(ROWS * sizeof(double)); /** iterate until convergence **/ // printf("norm : %f \n", norm(m, ROWS, COLUMNS)); while (norm(meanShiftVector, ROWS, COLUMNS) > opt->epsilon) { iter = iter +1; // find pairwise distance matrix (inside radius) // [I, D] = rangesearch(x,y,h); for (int i=0; i