src/main.c
// Function to benchmark the application using multiple points-dimensions combinations
Function to benchmark the application using multiple points-dimensions combinations
Function to benchmark the application using multiple points - dimensions combinations
void benchmark(){
    double *input;
    double avg = 0;
    clock_t start, end;
    vptree *tree;
    printf("Points, Dimensions, Average time\n");
    for(int points = 100; points < 10000000; points = points * 10){
        for(int dimensions = 10; dimensions < 1000; dimensions = dimensions * 10){
            if(dimensions * points > 100000000)
                break;
            avg = 0;
            for(int i=0; i < 10; i++){
                input = calloc(points * dimensions, sizeof(double));
                for(int j = 0; j < points * dimensions; j++){
                        input[j] = rand();
                }
                start = clock();
                tree = buildvp(input, points, dimensions);
                end = clock();
                avg += ((double) (end - start)) / CLOCKS_PER_SEC;
                free(tree);
            }
            avg = avg / 10;
            printf("%d, %d, %f\n", points, dimensions, avg);
        }
    }
}
void benchmark ( ) { double * input ; double avg = 0 ; clock_t start , end ; vptree * tree ; printf ( " \n " ) ; for ( int points = 100 ; points < 10000000 ; points = points * 10 ) { for ( int dimensions = 10 ; dimensions < 1000 ; dimensions = dimensions * 10 ) { if ( dimensions * points > 100000000 ) break ; avg = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { input = calloc ( points * dimensions , sizeof ( double ) ) ; for ( int j = 0 ; j < points * dimensions ; j ++ ) { input [ j ] = rand ( ) ; } start = clock ( ) ; tree = buildvp ( input , points , dimensions ) ; end = clock ( ) ; avg += ( ( double ) ( end - start ) ) / CLOCKS_PER_SEC ; free ( tree ) ; } avg = avg / 10 ; printf ( " \n " , points , dimensions , avg ) ; } } }
Function to benchmark the application using multiple points-dimensions combinations
Function to benchmark the application using multiple points - dimensions combinations
// Create a random X array // Stop execution due to memory limitations // Average execution time // Run tests // Create input. Freeing this array is done by the build_vp->build_tree functions // Call and benchmark // Print results