[mlpack-git] master: use const instead of just normal types (3dca3fb)

gitdub at mlpack.org gitdub at mlpack.org
Sun Aug 7 05:49:47 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/44a2b52f4d9ece563a5b9850db43ab60f71e5ec7...acd81e11579f69e75aa8406b2982328c88cf1fde

>---------------------------------------------------------------

commit 3dca3fbc3f121b11c32c53381dfa3ca3c4f79cab
Author: Keon Kim <kwk236 at gmail.com>
Date:   Sun Aug 7 18:49:47 2016 +0900

    use const instead of just normal types


>---------------------------------------------------------------

3dca3fbc3f121b11c32c53381dfa3ca3c4f79cab
 src/mlpack/methods/preprocess/preprocess_describe_main.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mlpack/methods/preprocess/preprocess_describe_main.cpp b/src/mlpack/methods/preprocess/preprocess_describe_main.cpp
index c4a5f81..32ac9cf 100644
--- a/src/mlpack/methods/preprocess/preprocess_describe_main.cpp
+++ b/src/mlpack/methods/preprocess/preprocess_describe_main.cpp
@@ -114,16 +114,16 @@ double Kurtosis(const arma::rowvec& input,
   if (population)
   {
     // Calculate Population Excess Kurtosis
-    double M2 = SumNthPowerDeviations(input, fMean, 2);
+    const double M2 = SumNthPowerDeviations(input, fMean, 2);
     kurtosis = n * (M4 / pow(M2, 2)) - 3;
   }
   else
   {
     // Calculate Sample Excess Kurtosis
-    double S4 = pow(fStd, 4);
-    double norm3 = (3 * (n - 1) * (n - 1)) / ((n - 2) * (n - 3));
-    double normC = (n * (n + 1)) / ((n - 1) * (n - 2) * (n - 3));
-    double normM = M4 / S4;
+    const double S4 = pow(fStd, 4);
+    const double norm3 = (3 * (n - 1) * (n - 1)) / ((n - 2) * (n - 3));
+    const double normC = (n * (n + 1)) / ((n - 1) * (n - 2) * (n - 3));
+    const double normM = M4 / S4;
     kurtosis = normC * normM - norm3;
   }
   return kurtosis;
@@ -164,6 +164,8 @@ int main(int argc, char** argv)
       to_string(width)+ ".");
   string stringFormat = "";
   string numberFormat = "";
+
+  // We are going to print 11 different categories.
   for (size_t i = 0; i < 11; ++i)
   {
     stringFormat += widthOnly + "s";




More information about the mlpack-git mailing list