Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends
jafar::sams::Kdtree Class Reference

Detailed Description

Implementation of Kdtree: main class

Definition at line 99 of file kdtree.hpp.

#include <kdtree.hpp>

List of all members.

Public Member Functions

 Kdtree (jblas::mat &data_in, bool sort_out=true, bool rearrange_in=true, int dim_in=-1)
 ~Kdtree ()
 destructor
void n_nearest_brute_force (jblas::vec &qv, int nn, Kdtree_result_vector &result)
void n_nearest (jblas::vec &qv, int nn, Kdtree_result_vector &result)
 search for n nearest to a given query vector 'qv'.
void n_nearest_around_point (int idxin, int correltime, int nn, Kdtree_result_vector &result)
void r_nearest (jblas::vec &qv, double r2, Kdtree_result_vector &result)
void r_nearest_around_point (int idxin, int correltime, double r2, Kdtree_result_vector &result)
int r_count (jblas::vec &qv, double r2)
 count number of neighbors within square distance r2.
int r_count_around_point (int idxin, int correltime, double r2)
 like r_count, c

Public Attributes

const jblas::matthe_data
const int N
 number of data points
int dim
 dimension of the Kdtree
bool sort_results
 USERS set to 'true'.
const bool rearrange
 are we rearranging?

Private Member Functions

void set_data (jblas::mat &din)
void build_tree ()
Kdtree_nodebuild_tree_for_range (int l, int u, Kdtree_node *parent)
void select_on_coordinate (int c, int k, int l, int u)
int select_on_coordinate_value (int c, double alpha, int l, int u)
void spread_in_coordinate (int c, int l, int u, interval &interv)

Private Attributes

Kdtree_noderoot
const jblas::matdata
vector< int > ind
jblas::mat rearranged_data

Static Private Attributes

static const int bucketsize = 12

Friends

class Kdtree_node
class searchrecord

Constructor & Destructor Documentation

jafar::sams::Kdtree::Kdtree ( jblas::mat data_in,
bool  sort_out = true,
bool  rearrange_in = true,
int  dim_in = -1 
)

constructor, passing in a (m,n) data matrix, aka n m-dimensional vectors.

constructor, has optional 'dim_in' feature, to use only first 'dim_in' components for definition of nearest neighbors.


Member Function Documentation

void jafar::sams::Kdtree::n_nearest_around_point ( int  idxin,
int  correltime,
int  nn,
Kdtree_result_vector result 
)

search for 'nn' nearest to point [idxin] of the input data, excluding neighbors within correltime

search for n nearest to a given query vector 'qv' usin exhaustive slow search. For debugging, usually.

void jafar::sams::Kdtree::r_nearest ( jblas::vec qv,
double  r2,
Kdtree_result_vector result 
)

search for all neighbors in ball of size (square Euclidean distance) r2. Return number of neighbors in 'result.size()',

void jafar::sams::Kdtree::r_nearest_around_point ( int  idxin,
int  correltime,
double  r2,
Kdtree_result_vector result 
)

like 'r_nearest', but around existing point, with decorrelation interval.


Member Data Documentation

"the_data" is a reference to the underlying jblas matrix of the data to be included in the tree.

NOTE: this structure does *NOT* own the storage underlying this. Hence, it would be a very bad idea to change the underlying data during use of the search facilities of this tree. Also, the user must deallocate the memory underlying it.

Definition at line 109 of file kdtree.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:47 for Jafar by doxygen 1.7.6.1
LAAS-CNRS