Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00032 #ifndef NNSEARCH_H
00033 # define NNSEARCH_H
00034 #include "mathadd.h"
00035 #include "distances.h"
00036 #include "definitions.h"
00037 #include "optarg.h"
00038 #include "distances.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044
00045
00046
00048 struct btree{
00049 int c;
00050 double R;
00051 double g;
00052 int start;
00053 int end;
00054 double *cdist;
00055 struct btree *left;
00056 struct btree *right;
00057 };
00058 typedef struct btree TreeNode;
00061 typedef struct {
00062 int *A;
00063 const double **d;
00064 int m, N;
00065 VectorDistanceFunction distfct;
00066 TreeNode *root;
00067 OptArgList *optargs;
00068 } SearchTree;
00069
00071 TreeNode* tnode_init();
00072 bool tnode_isleaf( TreeNode *C );
00073 void build_tree_recursive( TreeNode *C, double **D, int N, int *A, int maxel );
00074 SearchTree* searchtree_init( int n );
00078 SearchTree* nn_prepare( const double **X, int m, int N, OptArgList *optargs );
00079 void nn_search_k( const SearchTree *S, const double *x, int k,
00080 int *nn_idx, double *nn_dist );
00081 void nn_searck_k_slow( const double **X, int N, int m,
00082 const double *x, int k, int *nn_idx,
00083 double *nn_dist, OptArgList *optargs );
00084
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088
00089
00090 #endif