src/vptree_sequential.c
// Returns pointer to an array that contains the distances of all points from point
Returns pointer to an array that contains the distances of all points from point
Returns pointer to an array that contains the distances of all points from point
double * euclidean(double *point, double *points, int n, int d){
    double *distances = (double*)calloc(n, sizeof(double));
    double accumulator = 0;
    for (int i = 0; i < n; i++){
        accumulator = 0;
        for (int j = 0; j < d; j++){
            accumulator += (point[j] - *(points + i * d + j)) * (point[j] - *(points + i * d + j));
        }
        distances[i] = sqrt(accumulator);
    }
    return distances;
}
double * euclidean ( double * point , double * points , int n , int d ) { double * distances = ( double * ) calloc ( n , sizeof ( double ) ) ; double accumulator = 0 ; for ( int i = 0 ; i < n ; i ++ ) { accumulator = 0 ; for ( int j = 0 ; j < d ; j ++ ) { accumulator += ( point [ j ] - * ( points + i * d + j ) ) * ( point [ j ] - * ( points + i * d + j ) ) ; } distances [ i ] = sqrt ( accumulator ) ; } return distances ; }
Returns pointer to an array that contains the distances of all points from point
Returns pointer to an array that contains the distances of all points from point