bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
 All Classes Files Functions Variables Typedefs Macros
Macros | Typedefs | Functions
util.h File Reference
#include "float.h"
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ELEM_SWAP(a, b)   { register elem_type t=(a);(a)=(b);(b)=t; }
 
#define median(a, n)   kth_smallest(a,n,((n)/2))
 

Typedefs

typedef FLOAT_TYPE elem_type
 

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)
 

Macro Definition Documentation

#define ELEM_SWAP (   a,
 
)    { register elem_type t=(a);(a)=(b);(b)=t; }
#define median (   a,
 
)    kth_smallest(a,n,((n)/2))

Typedef Documentation

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