Finish transition of tree to arma::vec and related classes, and remove some methods that were commented out and unnecessary

This commit is contained in:
Ryan Curtin
2010-06-02 21:24:04 +00:00
parent 8e60d79178
commit 99d0cbd6b8
2 changed files with 3 additions and 93 deletions
@@ -59,65 +59,6 @@
* Regular pointer-style trees (as opposed to THOR trees).
*/
namespace tree {
/**
* Creates a KD tree from data, splitting on the midpoint.
*
* @experimental
*
* This requires you to pass in two unitialized ArrayLists (or Vectors) 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)
*
* @param matrix data where each column is a point, WHICH WILL BE RE-ORDERED
* @param split_dimensions ordering of the dimensions that we should split on;
* the first element in this vector will be the first element we split
* on, and so on
* @param leaf_size the maximum points in a leaf
* @param old_from_new pointer to an unitialized arraylist; it will map
* new indices to original
* @param new_from_old pointer to an unitialized arraylist; it will map
* original indexes to new indices
*/
/*
template<typename TKdTree, typename T>
TKdTree *MakeKdTreeMidpointSelective(arma::Mat<T>& matrix,
const arma::Col<T>& split_dimensions,
index_t leaf_size,
ArrayList<index_t>& old_from_new
ArrayList<index_t>& new_from_old) {
TKdTree *node = new TKdTree();
index_t *old_from_new_ptr;
if (old_from_new) {
old_from_new->Init(matrix.n_cols);
for (index_t i = 0; i < matrix.n_cols; i++) {
(*old_from_new)[i] = i;
}
old_from_new_ptr = old_from_new->begin();
} else {
old_from_new_ptr = NULL;
}
node->Init(0, matrix.n_cols);
node->bound().SetSize(split_dimensions.length());
tree_kdtree_private::SelectFindBoundFromMatrix(matrix, split_dimensions,
0, matrix.n_cols, &node->bound());
tree_kdtree_private::SelectSplitKdTreeMidpoint(matrix, split_dimensions,
node, leaf_size, old_from_new_ptr);
if (new_from_old) {
new_from_old->Init(matrix.n_cols);
for (index_t i = 0; i < matrix.n_cols; i++) {
(*new_from_old)[(*old_from_new)[i]] = i;
}
}
return node;
}
*/
/**
* Creates a KD tree from data, splitting on the midpoint.
*
@@ -231,26 +172,6 @@ namespace tree {
return node;
}
/*
template<typename TKdTree, typename T>
TKdTree *MakeKdTreeMidpoint(arma::Mat<T>& matrix,
index_t leaf_size,
ArrayList<index_t> *old_from_new = NULL,
ArrayList<index_t> *new_from_old = NULL) {
// create vector of dimensions that we will split on
// by default we'll just split the first dimension first, and so on
Vector split_dimensions;
split_dimensions.Init(matrix.n_rows);
for(int i = 0; i < matrix.n_rows; i++)
split_dimensions[i] = i;
TKdTree *result;
result = MakeKdTreeMidpointSelective<TKdTree>(matrix, split_dimensions,
leaf_size, old_from_new, new_from_old);
return result;
}
*/
template<typename TKdTree, typename T>
TKdTree *MakeKdTreeMidpoint(arma::Mat<T>& matrix,
index_t leaf_size,
@@ -37,15 +37,6 @@
#include "../base/arma_compat.h"
namespace tree_kdtree_private {
template<typename T>
void MakeBoundVector(const GenVector<T>& point,
const Vector& bound_dimensions,
GenVector<T>* bound_vector) {
int i;
for (i = 0; i < bound_dimensions.length(); i++)
(*bound_vector)[i] = point[(int) bound_dimensions[i]];
}
void MakeBoundVector(const arma::vec& point,
const arma::uvec& bound_dimensions,
arma::vec& bound_vector);
@@ -73,12 +64,10 @@ namespace tree_kdtree_private {
index_t first,
index_t count,
TBound *bounds) {
Vector split_dimensions;
split_dimensions.Init(matrix.n_rows);
int i;
for (i = 0; i < matrix.n_rows; i++){
arma::uvec split_dimensions(matrix.n_rows);
for(int i = 0; i < matrix.n_rows; i++)
split_dimensions[i] = i;
}
SelectFindBoundFromMatrix(matrix, split_dimensions, first, count, bounds);
}