57 if(
x -
hw > point[0])
return false;
58 if(
x +
hw < point[0])
return false;
59 if(
y -
hh > point[1])
return false;
60 if(
y +
hh < point[1])
return false;
108 for(
int n = 0; n < N; n++) {
118 init(NULL, inp_data, mean_Y[0], mean_Y[1], std::max(max_Y[0] - mean_Y[0], mean_Y[0] - min_Y[0]) + 1e-5,
119 std::max(max_Y[1] - mean_Y[1], mean_Y[1] - min_Y[1]) + 1e-5);
121 delete[] mean_Y;
delete[] max_Y;
delete[] min_Y;
129 init(NULL, inp_data, inp_x, inp_y, inp_hw, inp_hh);
137 init(NULL, inp_data, inp_x, inp_y, inp_hw, inp_hh);
146 init(inp_parent, inp_data, inp_x, inp_y, inp_hw, inp_hh);
155 init(inp_parent, inp_data, inp_x, inp_y, inp_hw, inp_hh);
202 bool any_duplicate =
false;
203 for(
int n = 0; n <
size; n++) {
204 bool duplicate =
true;
208 any_duplicate = any_duplicate | duplicate;
210 if(any_duplicate)
return true;
235 for(
int i = 0; i <
size; i++) {
236 bool success =
false;
252 for(
int n = 0; n <
size; n++) {
266 for(
int n = 0; n <
size; n++) {
272 int rem_index =
index[n];
285 if(node->
getParent() == NULL) done =
true;
355 for(
int n = 0; n < N; n++) {
357 for(
int i = row_P[n]; i < row_P[n + 1]; i++) {
365 D = val_P[i] / (1.0 + D);
368 for(
int d = 0; d <
QT_NO_DIMS; d++) pos_f[ind1 + d] += D *
buff[d];
377 printf(
"Empty node\n");
382 printf(
"Leaf node; data = [");
383 for(
int i = 0; i <
size; i++) {
385 for(
int d = 0; d <
QT_NO_DIMS; d++) printf(
"%f, ", point[d]);
386 printf(
" (index = %d)",
index[i]);
387 if(i <
size - 1) printf(
"\n");
392 printf(
"Intersection node with center-of-mass = [");
394 printf(
"]; children are:\n");
428 for(
int i = 0; i < N; i++)
insert(i);
436 for(
int i = 0; i <
size; i++) indices[loc + i] =
index[i];
QuadTree(ScalarType *inp_data, int N)
Namespace containing implementation of t-SNE algorithm.
void getAllIndices(int *indices)
QuadTree(ScalarType *inp_data, int N, ScalarType inp_x, ScalarType inp_y, ScalarType inp_hw, ScalarType inp_hh)
double ScalarType
default scalar value (can be overrided with TAPKEE_CUSTOM_INTERNAL_NUMTYPE define) ...
void computeNonEdgeForces(int point_index, ScalarType theta, ScalarType neg_f[], ScalarType *sum_Q)
ScalarType buff[QT_NO_DIMS]
QuadTree(QuadTree *inp_parent, ScalarType *inp_data, ScalarType inp_x, ScalarType inp_y, ScalarType inp_hw, ScalarType inp_hh)
QuadTree(QuadTree *inp_parent, ScalarType *inp_data, int N, ScalarType inp_x, ScalarType inp_y, ScalarType inp_hw, ScalarType inp_hh)
static const int QT_NODE_CAPACITY
void init(QuadTree *inp_parent, ScalarType *inp_data, ScalarType inp_x, ScalarType inp_y, ScalarType inp_hw, ScalarType inp_hh)
QuadTree(ScalarType *inp_data, ScalarType inp_x, ScalarType inp_y, ScalarType inp_hw, ScalarType inp_hh)
int index[QT_NODE_CAPACITY]
static const int QT_NO_DIMS
void setData(ScalarType *inp_data)
bool insert(int new_index)
int getAllIndices(int *indices, int loc)
void computeEdgeForces(int *row_P, int *col_P, ScalarType *val_P, int N, ScalarType *pos_f)
ScalarType center_of_mass[QT_NO_DIMS]
QuadTree & operator=(const QuadTree &)
bool containsPoint(ScalarType point[])