#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <omp.h>
#include "global.h"
#include "util.h"
#include "kdtree.h"
Go to the source code of this file.
|
| 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) |
| |
Builds a k-d-tree
- Parameters
-
| *Xtrain | Pointer to array of type "FLOAT_TYPE" (either "float" or "double") |
| nXtrain | Number of rows in *X (i.e., points/patterns) |
| dXtrain | Number of columns in *X (one column per point/pattern) |
| *kdtree_record | Pointer to struct instance storing the model |
| *params | Pointer to struct instance storing all model parameters |
| void free_resources_extern |
( |
void |
| ) |
|
| 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_neighbors | The number of nearest neighbors to be found |
| tree_depth | The tree depth of the tree to be built |
| num_threads | The number of threads that should be used |
| splitting_type | The splitting type that can be used during the construction of the tree |
| verbosity_level | The verbosity level (0==no output, 1==more output, 2==...) |
| *params | Pointer 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
-
| *Xtest | Pointer to the set of query/test points (stored as FLOAT_TYPE) |
| nXtest | The number of query points |
| dXtest | The dimension of each query point |
| *distances | The distances array (FLOAT_TYPE) used to store the computed distances |
| ndistances | The number of query points |
| ddistances | The number of distance values for each query point |
| *indices | Pointer to arrray storing the indices of the k nearest neighbors for each query point |
| nindices | The number of query points |
| dindices | The number of indices comptued for each query point |
| *kdtree_record | Pointer to struct storing all relevant information for model |
| *params | Pointer to struct containing all relevant parameters |