void ANNkd_tree::getStats( // get tree statistics ANNkdStats &st) // stats (modified) { st.reset(dim, n_pts, bkt_size); // reset stats // create bounding box ANNorthRect bnd_box(dim, bnd_box_lo, bnd_box_hi); if (root != NULL) { // if nonempty tree root->getStats(dim, st, bnd_box); // get statistics st.avg_ar = st.sum_ar / st.n_lf; // average leaf asp ratio } }
void ANNkd_leaf::getStats( // get subtree statistics int dim, // dimension of space ANNkdStats &st, // stats (modified) ANNorthRect &bnd_box) // bounding box { st.reset(); if (this == KD_TRIVIAL) st.n_tl = 1; // trivial leaf? else st.n_lf = 1; // else increment leaf count double ar = annAspectRatio(dim, bnd_box); // aspect ratio of leaf st.sum_ar += (ar < 100 ? ar : 100); // increment (set outlier=100) }
void ANNkd_leaf::getStats( // get subtree statistics int dim, // dimension of space ANNkdStats &st, // stats (modified) ANNorthRect &bnd_box) // bounding box { st.reset(); st.n_lf = 1; // count this leaf if (this == KD_TRIVIAL) st.n_tl = 1; // count trivial leaf double ar = annAspectRatio(dim, bnd_box); // aspect ratio of leaf // incr sum (ignore outliers) st.sum_ar += float(ar < ANN_AR_TOOBIG ? ar : ANN_AR_TOOBIG); }