[mlpack-git] [mlpack/mlpack] Vantage point tree and HRectBound improvements (#760)
lozhnikov
notifications at github.com
Sat Aug 13 01:34:15 EDT 2016
> }
>
> // Now take the Power'th root (but make sure our result is squared if it needs
> // to be); then cancel out the constant of 2 (which may have been squared now)
> // that was introduced earlier. The compiler should optimize out the if
> // statement entirely.
> - if (MetricType::TakeRoot)
> - return (ElemType) pow((double) sum, 1.0 / (double) MetricType::Power) / 2.0;
> + if (MetricType::Power == 1)
> + return sum * 0.5;
> + else if (MetricType::Power == 2)
> + {
> + if (MetricType::TakeRoot)
> + return std::sqrt(sum) * 0.5;
I've forgotten to ask about this piece of code:
` pow((double) sum, 1.0 / (double) MetricType::Power)`
Do you use the conversion in order to increase precision or you just take care of integral data types?
Should I replace `std::sqrt(sum)` by `(ElemType) std::sqrt((double) sum)`?
--
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/760/files/8e6223ce9cbc05b5cb68e6f4e7a96d8cb41bf5ff..55e15792e4dc2135c6e3421c5dae1322d07b0dcc#r74682180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160812/2d93ba9c/attachment.html>
More information about the mlpack-git
mailing list