bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
 All Classes Files Functions Variables Typedefs Macros
Functions
base.h File Reference
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <omp.h>
#include "global.h"
#include "util.h"
#include "kdtree.h"
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_extern (int n_neighbors, int tree_depth, int num_threads, int splitting_type, int verbosity_level, KD_TREE_PARAMETERS *params)
 
void fit_extern (FLOAT_TYPE *Xtrain, int nXtrain, int dXtrain, KD_TREE_RECORD *kdtree_record, KD_TREE_PARAMETERS *params)
 
void neighbors_extern (FLOAT_TYPE *Xtest, int nXtest, int dXtest, FLOAT_TYPE *distances, int ndistances, int ddistances, int *indices, int nindices, int dindices, KD_TREE_RECORD *kdtree_record, KD_TREE_PARAMETERS *params)
 
void free_resources_extern (void)
 

Function Documentation

void fit_extern ( FLOAT_TYPE Xtrain,
int  nXtrain,
int  dXtrain,
KD_TREE_RECORD kdtree_record,
KD_TREE_PARAMETERS params 
)

Builds a k-d-tree

Parameters
*XtrainPointer to array of type "FLOAT_TYPE" (either "float" or "double")
nXtrainNumber of rows in *X (i.e., points/patterns)
dXtrainNumber of columns in *X (one column per point/pattern)
*kdtree_recordPointer to struct instance storing the model
*paramsPointer to struct instance storing all model parameters
void free_resources_extern ( void  )

Frees resources

void init_extern ( int  n_neighbors,
int  tree_depth,
int  num_threads,
int  splitting_type,
int  verbosity_level,
KD_TREE_PARAMETERS params 
)

Initializes the *params struct with the parameters provided.

Parameters
n_neighborsThe number of nearest neighbors to be found
tree_depthThe tree depth of the tree to be built
num_threadsThe number of threads that should be used
splitting_typeThe splitting type that can be used during the construction of the tree
verbosity_levelThe verbosity level (0==no output, 1==more output, 2==...)
*paramsPointer to struct that is used to store all parameters
void neighbors_extern ( FLOAT_TYPE Xtest,
int  nXtest,
int  dXtest,
FLOAT_TYPE distances,
int  ndistances,
int  ddistances,
int *  indices,
int  nindices,
int  dindices,
KD_TREE_RECORD kdtree_record,
KD_TREE_PARAMETERS params 
)

Interface (extern): Computes the k nearest neighbors for a given set of test points stored in *Xtest and stores the results in two arrays *distances and *indices.

Parameters
*XtestPointer to the set of query/test points (stored as FLOAT_TYPE)
nXtestThe number of query points
dXtestThe dimension of each query point
*distancesThe distances array (FLOAT_TYPE) used to store the computed distances
ndistancesThe number of query points
ddistancesThe number of distance values for each query point
*indicesPointer to arrray storing the indices of the k nearest neighbors for each query point
nindicesThe number of query points
dindicesThe number of indices comptued for each query point
*kdtree_recordPointer to struct storing all relevant information for model
*paramsPointer to struct containing all relevant parameters