[mlpack-svn] r16497 - mlpack/trunk/src/mlpack/core/kernels
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue May 13 15:25:56 EDT 2014
Author: rcurtin
Date: Tue May 13 15:25:55 2014
New Revision: 16497
Log:
Const parameters will cause this to be two billion times faster.
Modified:
mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
Modified: mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp (original)
+++ mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp Tue May 13 15:25:55 2014
@@ -39,7 +39,7 @@
*
* @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 @@
* @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 @@
* @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-svn
mailing list