[mlpack-git] master, mlpack-1.0.x: Const parameters will cause this to be two billion times faster. (a9e677a)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:47:03 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit a9e677aa9fd0eab9c77275a64ba62d9e2e74419a
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue May 13 19:25:55 2014 +0000
Const parameters will cause this to be two billion times faster.
>---------------------------------------------------------------
a9e677aa9fd0eab9c77275a64ba62d9e2e74419a
src/mlpack/core/kernels/gaussian_kernel.hpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mlpack/core/kernels/gaussian_kernel.hpp b/src/mlpack/core/kernels/gaussian_kernel.hpp
index 606f4cb..859a91d 100644
--- a/src/mlpack/core/kernels/gaussian_kernel.hpp
+++ b/src/mlpack/core/kernels/gaussian_kernel.hpp
@@ -39,7 +39,7 @@ class GaussianKernel
*
* @param bandwidth The bandwidth of the kernel (@f$\mu at f$).
*/
- GaussianKernel(double bandwidth) :
+ GaussianKernel(const double bandwidth) :
bandwidth(bandwidth),
gamma(-0.5 * pow(bandwidth, -2.0))
{ }
@@ -69,7 +69,7 @@ class GaussianKernel
* @return K(t) using the bandwidth (@f$\mu at f$) specified in the
* constructor.
*/
- double Evaluate(double t) const
+ double Evaluate(const double t) const
{
// The precalculation of gamma saves us a little computation time.
return exp(gamma * std::pow(t, 2.0));
@@ -81,7 +81,7 @@ class GaussianKernel
* @param dimension
* @return the normalization constant
*/
- double Normalizer(size_t dimension)
+ double Normalizer(const size_t dimension)
{
return pow(sqrt(2.0 * M_PI) * bandwidth, (double) dimension);
}
More information about the mlpack-git
mailing list