diff --git a/mean-shift.c b/mean-shift.cu similarity index 99% rename from mean-shift.c rename to mean-shift.cu index 010bdb0..a5bb681 100644 --- a/mean-shift.c +++ b/mean-shift.cu @@ -2,6 +2,7 @@ #include #include #include +#include #define X "data/X.bin" #define L "data/L.bin" @@ -113,6 +114,8 @@ void meanshift(double **x, int h, struct parameters *opt){ /** iterate until convergence **/ // printf("norm : %f \n", norm(m, ROWS, COLUMNS)); + + while (norm(m, ROWS, COLUMNS) > opt->epsilon) { iter = iter +1; // find pairwise distance matrix (inside radius) @@ -257,4 +260,6 @@ void print_matrix(double ** array, int rows, int cols){ } printf("\n"); } -} \ No newline at end of file +} + +__global__ void \ No newline at end of file diff --git a/serial.c b/serial.c index cc5177f..2cb5705 100755 --- a/serial.c +++ b/serial.c @@ -17,13 +17,13 @@ int main(int argc, char **argv){ FILE *f; - f = fopen(X, "rb"); - fseek(f, 0L, SEEK_END); - long int pos = ftell(f); - fclose(f); - int elements = pos / sizeof(double); // number of total elements (points*dimension) - int points = elements/COLUMNS; - //printf("points : %d \n", points); +// f = fopen(X, "rb"); +// fseek(f, 0L, SEEK_END); +// long int pos = ftell(f); +// fclose(f); +// int elements = pos / sizeof(double); // number of total elements (points*dimension) +// int points = elements/COLUMNS; +// //printf("points : %d \n", points); f = fopen(X, "rb"); double ** vectors; vectors = alloc_2d_double(ROWS, COLUMNS); @@ -38,7 +38,7 @@ int main(int argc, char **argv){ // NOTE : Labels were classified as // variables of type uint8 are stored as 1-byte (8-bit) unsigned integers fseek(f, 0L, SEEK_END); - pos = ftell(f); + long int pos = ftell(f); rewind(f); //printf("position : %ld \n", pos); int label_elements = pos/ sizeof(char); @@ -50,7 +50,7 @@ int main(int argc, char **argv){ // MEAN SHIFT OPTIONS int h = 1; struct parameters params; - params.epsilom = 0.0001; + params.epsilon = 0.0001; params.verbose = false; params.display = false; struct parameters *opt; diff --git a/serialDeclarations.c b/serialDeclarations.c index a040ad5..296cc86 100644 --- a/serialDeclarations.c +++ b/serialDeclarations.c @@ -24,17 +24,19 @@ void meanshift(double **x, int h, struct parameters *opt){ // initialize iteration counter 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 **/ // 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; // 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