bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
 All Classes Files Functions Variables Typedefs Macros
Functions
util.c File Reference
#include "include/util.h"
#include "include/float.h"
Include dependency graph for util.c:

Functions

void transpose_array_float (float *array, int n, int d, float *array_transposed)
 
void transpose_array_double (double *array, int n, int d, double *array_transposed)
 
void transpose_array_int (int *array, int n, int d, int *array_transposed)
 
int compare_floats (const void *p1, const void *p2)
 
int compare_ints (const void *p1, const void *p2)
 
elem_type kth_smallest (elem_type a[], int n, int k)
 
int kth_smallest_idx (elem_type a[], int n, int k)
 

Function Documentation

int compare_floats ( const void *  p1,
const void *  p2 
)

Compares two float values

Parameters
Pointerto first float
Pointerto second float
int compare_ints ( const void *  p1,
const void *  p2 
)

Compares to integers

Parameters
Pointerto first int
Pointerto second int
elem_type kth_smallest ( elem_type  a[],
int  n,
int  k 
)

Function : kth_smallest() In : array of elements, # of elements in the array, rank k Out : one element Job : find the kth smallest element in the array Notice : use the median() macro defined below to get the median.

Reference:

Author: Wirth, Niklaus Title: Algorithms + data structures = programs Publisher: Englewood Cliffs: Prentice-Hall, 1976 Physical description: 366 p. Series: Prentice-Hall Series in Automatic Computation

int kth_smallest_idx ( elem_type  a[],
int  n,
int  k 
)

Computes the kth smallest index

Parameters
a[]Array of type elem_type
nNumber of rows
Numberof columns
void transpose_array_double ( double *  array,
int  n,
int  d,
double *  array_transposed 
)

Transposes a given double array

Parameters
arrayPointer to double array
nnumber of "rows" in a
dnumber of "columns" in a
array_transposedThe transposed array
void transpose_array_float ( float *  array,
int  n,
int  d,
float *  array_transposed 
)

Transposes a given float array

Parameters
arrayPointer to float array
nnumber of "rows" in a
dnumber of "columns" in a
array_transposedThe transposed array
void transpose_array_int ( int *  array,
int  n,
int  d,
int *  array_transposed 
)

Transposes a given int array

Parameters
arrayPointer to int array
nnumber of "rows" in a
dnumber of "columns" in a
array_transposedThe transposed array