#include #include #include #include #include "serialDeclarations.h" void meanshift(double **x, int h, struct parameters *opt){ double **y; y = alloc_2d_double(ROWS, COLUMNS); y = duplicate(x, y, ROWS, COLUMNS); // mean shift vectors double **m; m = alloc_2d_double(ROWS, COLUMNS); // initialize elements of m to inf for (int i=0;iepsilom); /** iterate until convergence **/ // printf("norm : %f \n", norm(m, ROWS, COLUMNS)); while (norm(m, ROWS, COLUMNS) > opt->epsilom) { iter = iter +1; // find pairwise distance matrix (inside radius) /** allocate memory for inside iteration arrays **/ double ** W = alloc_2d_double(ROWS, ROWS); double * l = malloc(ROWS * sizeof(double)); // [I, D] = rangesearch(x,y,h); for (int i=0; i apply to non-zero elements for (int i=0; i