[mlpack-git] [mlpack/mlpack] Universal B tree implementation (#746)
lozhnikov
notifications at github.com
Mon Aug 22 19:26:05 EDT 2016
> + // The compiler should optimize out this if statement entirely.
> + if (MetricType::Power == 1)
> + {
> + loSum += vLo; // vLo is non-negative.
> + hiSum += vHi; // vHi is non-negative.
> + }
> + else if (MetricType::Power == 2)
> + {
> + loSum += vLo * vLo;
> + hiSum += vHi * vHi;
> + }
> + else
> + {
> + loSum += std::pow(vLo, (ElemType) MetricType::Power);
> + hiSum += std::pow(vHi, (ElemType) MetricType::Power);
> + }
I thought about that. I can reduce the computation of `loSum`. But I have to look through all combinations in order to calculate `hiSum`. That means that I do only two floating-point operations per iteration. I am not sure that will be efficient. But maybe I am mistaken and it is worth to try.
--
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/2c5eb5780226c30b8fb088ee928487f0970dc802#r75778181
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160822/eafdb6e5/attachment.html>
More information about the mlpack-git
mailing list