[mlpack-git] [mlpack/mlpack] Universal B tree implementation (#746)
lozhnikov
notifications at github.com
Thu Aug 25 16:48:50 EDT 2016
> + // of hyperrectangles is restricted.
> + size_t numCorners = 0;
> + for (size_t pos = numEqualBits + 1; pos < order * tmpHiAddress.n_elem; pos++)
> + {
> + size_t row = pos / order;
> + size_t bit = order - 1 - pos % order;
> +
> + // This hyperrectangle is not contained entirely in the bound.
> + // So, the number of hyperrectangles should be increased.
> + if (tmpHiAddress[row] & ((AddressElemType) 1 << bit))
> + numCorners++;
> +
> + // We ran out of the limit of hyperrectangles. In that case we enlare
> + // the last hyperrectangle.
> + if (numCorners >= maxNumBounds / 2)
> + tmpHiAddress[row] |= ((AddressElemType) 1 << bit);
yeah, I think if `maxNumBounds` is odd then we end up with `maxNumBounds - 1`. I think we can replace
`if (numCorners >= maxNumBounds / 2)`
by
`if (numCorners >= maxNumBounds - numBounds)` in `InitLowerBound()`
In that case we should document that `InitLowerBound()` should be called after
`InitHighBound()`. But in that case the functions are non-symmetric.
Another way is to document that `maxNumBounds` should be even.
And another way is to make an extra pass and calculate `numCorners` for the lower bound and for the high bound. What do you think about these variants?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/746/files/f17843fc8e8ef2b1c4b04d572c521575f20a1f3c#r76321604
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160825/f8d2a2ff/attachment-0001.html>
More information about the mlpack-git
mailing list