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

Go to the source code of this file.

Functions

void kd_tree_build_tree (TREE_RECORD *tree_record, TREE_PARAMETERS *params)
 
void kd_tree_find_best_split (int depth, int left, int right, TREE_RECORD *tree_record, TREE_PARAMETERS *params, int *axis, int *pivot_idx, FLOAT_TYPE *splitting_value)
 
void kd_tree_build_recursive (TREE_RECORD *tree_record, TREE_PARAMETERS *params, INT_TYPE left, INT_TYPE right, INT_TYPE idx, INT_TYPE depth)
 
void kd_tree_generate_training_patterns_indices (void *XI, FLOAT_TYPE *X, INT_TYPE n, INT_TYPE dim)
 
INT_TYPE kd_tree_split_training_patterns_via_pivot (void *XI, INT_TYPE left, INT_TYPE right, INT_TYPE axis, INT_TYPE dim)
 

Function Documentation

void kd_tree_build_recursive ( TREE_RECORD tree_record,
TREE_PARAMETERS params,
INT_TYPE  left,
INT_TYPE  right,
INT_TYPE  idx,
INT_TYPE  depth 
)

Helper method to build up the kd-tree in a recursive manner.

Parameters
*tree_recordPointer to struct instance storing the model
*paramsPointer to struct instance storing all model parameters
leftThe left bound of values to be tested
rightThe right bound of values to be tested
idxThe current node index
depthThe current tree depth
void kd_tree_build_tree ( TREE_RECORD tree_record,
TREE_PARAMETERS params 
)

Builds the kd-tree (recursive construction)

Parameters
*tree_recordPointer to struct instance storing the model
*paramsPointer to struct instance storing all model parameters
void kd_tree_find_best_split ( int  depth,
int  left,
int  right,
TREE_RECORD tree_record,
TREE_PARAMETERS params,
int *  axis,
int *  pivot_idx,
FLOAT_TYPE splitting_value 
)

Finds the optimal splitting axis.

Parameters
depthThe current depth of the splitting process
leftThe left bound of values to be tested
rightThe right bound of values to be tested
*tree_recordPointer to struct instance storing the model
*paramsPointer to struct instance storing all model parameters
*axisThe current axis
*pivot_idxThe output pivot index
*splitting_valueThe output splitting value
void kd_tree_generate_training_patterns_indices ( void *  XI,
FLOAT_TYPE X,
INT_TYPE  n,
INT_TYPE  dim 
)

Parse patterns and store the original indices (this array of both the FLOAT_TYPEs and the indices) is sorted in-place during the construction of the kd-tree.

Parameters
*XIPointer to array containing patterns and indices
*XPointer to array containing patterns
nNumber of elements in arrays
dimDimensionality of patterns
INT_TYPE kd_tree_split_training_patterns_via_pivot ( void *  XI,
INT_TYPE  left,
INT_TYPE  right,
INT_TYPE  axis,
INT_TYPE  dim 
)

Sorts the training patterns in range left to right (inclusive) with respect to "axis".

Parameters
*XIPointer to array containing patterns and indices
leftThe left bound of points to be tested
rightThe right bound of points to be tested
axisThe current axis
dimDimensionality of patterns