|
@ -24,17 +24,19 @@ void meanshift(double **x, int h, struct parameters *opt){ |
|
|
// initialize iteration counter
|
|
|
// initialize iteration counter
|
|
|
int iter = 0; |
|
|
int iter = 0; |
|
|
|
|
|
|
|
|
// printf("%f \n", opt->epsilom);
|
|
|
// printf("%f \n", opt->epsilon);
|
|
|
|
|
|
|
|
|
|
|
|
double ** W = alloc_2d_double(ROWS, ROWS); |
|
|
|
|
|
double * l = malloc(ROWS * sizeof(double)); |
|
|
|
|
|
|
|
|
/** iterate until convergence **/ |
|
|
/** iterate until convergence **/ |
|
|
// printf("norm : %f \n", norm(m, ROWS, COLUMNS));
|
|
|
// printf("norm : %f \n", norm(m, ROWS, COLUMNS));
|
|
|
|
|
|
|
|
|
while (norm(m, ROWS, COLUMNS) > opt->epsilom) { |
|
|
while (norm(m, ROWS, COLUMNS) > opt->epsilon) { |
|
|
iter = iter +1; |
|
|
iter = iter +1; |
|
|
// find pairwise distance matrix (inside radius)
|
|
|
// find pairwise distance matrix (inside radius)
|
|
|
/** allocate memory for inside iteration arrays **/ |
|
|
/** 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);
|
|
|
// [I, D] = rangesearch(x,y,h);
|
|
|
for (int i=0; i<ROWS; i++){ |
|
|
for (int i=0; i<ROWS; i++){ |
|
|
for (int j=0; j<ROWS; j++){ |
|
|
for (int j=0; j<ROWS; j++){ |
|
@ -154,7 +156,7 @@ double calculateDistance(double *y, double *x){ |
|
|
|
|
|
|
|
|
void multiply(double ** matrix1, double ** matrix2, double ** output){ |
|
|
void multiply(double ** matrix1, double ** matrix2, double ** output){ |
|
|
// W dims are ROWS ROWS and x dims are ROWS COLUMNS
|
|
|
// W dims are ROWS ROWS and x dims are ROWS COLUMNS
|
|
|
|
|
|
|
|
|
int i, j, k; |
|
|
int i, j, k; |
|
|
for (i=0; i<ROWS; i++){ |
|
|
for (i=0; i<ROWS; i++){ |
|
|
for (j=0; j<COLUMNS; j++){ |
|
|
for (j=0; j<COLUMNS; j++){ |
|
|