[mlpack-svn] r10826 - mlpack/trunk/src/mlpack/core/kernels

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Dec 15 02:44:03 EST 2011


Author: rcurtin
Date: 2011-12-15 02:44:03 -0500 (Thu, 15 Dec 2011)
New Revision: 10826

Modified:
   mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
Log:
Remove unnecessary 'normalizer' variable and add accessor for gamma.  No mutator
because those two variables are codependent.


Modified: mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp	2011-12-15 07:36:07 UTC (rev 10825)
+++ mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp	2011-12-15 07:44:03 UTC (rev 10826)
@@ -30,7 +30,8 @@
   /**
    * Default constructor; sets bandwidth to 1.0.
    */
-  GaussianKernel() : bandwidth(1.0), normalizer(sqrt(2.0 * M_PI)), gamma(-0.5) { }
+  GaussianKernel() : bandwidth(1.0), gamma(-0.5)
+  { }
 
   /**
    * Construct the Gaussian kernel with a custom bandwidth.
@@ -39,7 +40,6 @@
    */
   GaussianKernel(double bandwidth) :
     bandwidth(bandwidth),
-    normalizer(bandwidth * sqrt(2.0 * M_PI)),
     gamma(-0.5 * pow(bandwidth, -2.0))
   { }
 
@@ -74,16 +74,15 @@
     return exp(gamma * t * t);
   }
 
-  const double& Normalizer() { return normalizer; }
-  const double& Bandwidth() { return bandwidth; }
+  //! Get the bandwidth.
+  const double& Bandwidth() const { return bandwidth; }
+  //! Get the precalculated constant.
+  const double& Gamma() const { return gamma; }
 
  private:
   //! Kernel bandwidth.
   double bandwidth;
 
-  //! Normalizing constant.
-  double normalizer;
-
   //! Precalculated constant depending on the bandwidth;
   //! @f$ \gamma = -\frac{1}{2 \mu^2} @f$.
   double gamma;




More information about the mlpack-svn mailing list