Regular pointer-style trees (as opposed to THOR trees). More...
Functions | |
| template<typename TKdTree , typename T > | |
| success_t | LoadKdTree (datanode *module, GenMatrix< T > *matrix, TKdTree **tree_pp, ArrayList< index_t > *old_from_new) | 
| Loads a KD tree from a command-line parameter, creating a KD tree if necessary.   | |
| template<typename TKdTree , typename T > | |
| TKdTree * | MakeKdTreeMidpoint (GenMatrix< T > &matrix, index_t leaf_size, GenVector< index_t > *old_from_new=NULL, GenVector< index_t > *new_from_old=NULL) | 
| template<typename TKdTree , typename T > | |
| TKdTree * | MakeKdTreeMidpoint (GenMatrix< T > &matrix, index_t leaf_size, ArrayList< index_t > *old_from_new=NULL, ArrayList< index_t > *new_from_old=NULL) | 
| template<typename TKdTree , typename T > | |
| TKdTree * | MakeKdTreeMidpointSelective (GenMatrix< T > &matrix, const Vector &split_dimensions, index_t leaf_size, GenVector< index_t > *old_from_new=NULL, GenVector< index_t > *new_from_old=NULL) | 
| template<typename TKdTree , typename T > | |
| TKdTree * | MakeKdTreeMidpointSelective (GenMatrix< T > &matrix, const Vector &split_dimensions, index_t leaf_size, ArrayList< index_t > *old_from_new=NULL, ArrayList< index_t > *new_from_old=NULL) | 
| Creates a KD tree from data, splitting on the midpoint.   | |
Regular pointer-style trees (as opposed to THOR trees).
| success_t tree::LoadKdTree | ( | datanode * | module, | |
| GenMatrix< T > * | matrix, | |||
| TKdTree ** | tree_pp, | |||
| ArrayList< index_t > * | old_from_new | |||
| ) |  [inline] | 
        
Loads a KD tree from a command-line parameter, creating a KD tree if necessary.
This optionally allows the end user to write out the created KD tree to a file, as a convenience.
Requires a sub-module, with the root parameter of the submodule being the filename, and optional parameters leaflen, type, and save (see example below).
Example:
MyKdTree *q_tree; Matrix q_matrix; ArrayList<index_t> q_permutation; LoadKdTree(fx_submodule(NULL, "q", "q"), &q_matrix, &q_tree, &q_permutation);
Command-line use:
./main --q=foo.txt # load from csv format ./main --q=foo.txt --q/leaflen=20 # leaf length
| module | the module to get parameters from | |
| matrix | the matrix to initialize, undefined on failure | |
| tree_pp | an unitialized pointer that will be set to the root of the tree, must still be freed on failure | |
| old_from_new | stores the permutation to get from the indices in the matrix returned to the original data point indices | 
Definition at line 231 of file kdtree.h.
References fx_param_int(), fx_param_str(), fx_timer_start(), fx_timer_stop(), and data::Load().
| TKdTree * tree::MakeKdTreeMidpointSelective | ( | GenMatrix< T > & | matrix, | |
| const Vector & | split_dimensions, | |||
| index_t | leaf_size, | |||
| ArrayList< index_t > * |  old_from_new = NULL,  | 
        |||
| ArrayList< index_t > * |  new_from_old = NULL | |||
| ) |  [inline] | 
        
Creates a KD tree from data, splitting on the midpoint.
This requires you to pass in two unitialized ArrayLists which will contain index mappings so you can account for the re-ordering of the matrix. (By unitialized I mean don't call Init on it)
| matrix | data where each column is a point, WHICH WILL BE RE-ORDERED | |
| leaf_size | the maximum points in a leaf | |
| old_from_new | pointer to an unitialized arraylist; it will map new indices to original | |
| new_from_old | pointer to an unitialized arraylist; it will map original indexes to new indices | 
Definition at line 82 of file kdtree.h.
References GenVector< T >::length(), and GenMatrix< T >::n_cols().
 1.6.3