[mlpack-svn] r11843 - in mlpack/trunk/src/mlpack: core/kernels methods/kernel_pca methods/mvu tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Mar 12 18:15:24 EDT 2012


Author: rcurtin
Date: 2012-03-12 18:15:24 -0400 (Mon, 12 Mar 2012)
New Revision: 11843

Modified:
   mlpack/trunk/src/mlpack/core/kernels/epanechnikov_kernel.hpp
   mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
   mlpack/trunk/src/mlpack/core/kernels/spherical_kernel.hpp
   mlpack/trunk/src/mlpack/methods/kernel_pca/kernel_pca_impl.hpp
   mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp
   mlpack/trunk/src/mlpack/tests/cli_test.cpp
Log:
Various fixes for Windows compilation.

Modified: mlpack/trunk/src/mlpack/core/kernels/epanechnikov_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/epanechnikov_kernel.hpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/core/kernels/epanechnikov_kernel.hpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -81,8 +81,9 @@
 
   double Normalizer(size_t dimension)
   {
-    return 2.0 * pow(bandwidth, dimension) * pow(M_PI, dimension / 2.0) /
-             (tgamma(dimension / 2.0 + 1.0) * (dimension + 2.0));
+    return 2.0 * pow(bandwidth, (double) dimension) *
+        pow(M_PI, dimension / 2.0) /
+        (boost::math::tgamma(dimension / 2.0 + 1.0) * (dimension + 2.0));
   }
   double Evaluate(double t)
   {

Modified: mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -82,7 +82,7 @@
    */
   double Normalizer(size_t dimension)
   {
-    return pow(sqrt(2.0 * M_PI) * bandwidth, dimension);
+    return pow(sqrt(2.0 * M_PI) * bandwidth, (double) dimension);
   }
   /**
    * Obtain a convolution integral of the Gaussian kernel.

Modified: mlpack/trunk/src/mlpack/core/kernels/spherical_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/spherical_kernel.hpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/core/kernels/spherical_kernel.hpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -72,8 +72,8 @@
   }
   double Normalizer(size_t dimension)
   {
-    return pow(bandwidth, dimension) * pow(M_PI, dimension / 2.0) /
-             tgamma(dimension / 2.0 + 1.0);
+    return pow(bandwidth, (double) dimension) * pow(M_PI, dimension / 2.0) /
+        boost::math::tgamma(dimension / 2.0 + 1.0);
   }
   double Evaluate(double t)
   {

Modified: mlpack/trunk/src/mlpack/methods/kernel_pca/kernel_pca_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kernel_pca/kernel_pca_impl.hpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/methods/kernel_pca/kernel_pca_impl.hpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -60,7 +60,7 @@
   arma::eig_sym(eigVal, coeffs, kernelMat);
 
   int n_eigVal = eigVal.n_elem;
-  for(int i = 0; i < floor(n_eigVal / 2); i++)
+  for(int i = 0; i < floor(n_eigVal / 2.0); i++)
     eigVal.swap_rows(i, (n_eigVal - 1) - i);
 
   coeffs = arma::fliplr(coeffs);

Modified: mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -23,6 +23,7 @@
 
 using namespace mlpack;
 using namespace mlpack::mvu;
+using namespace mlpack::math;
 using namespace arma;
 using namespace std;
 
@@ -31,7 +32,7 @@
   // Read from command line.
   CLI::ParseCommandLine(argc, argv);
 
-  math::RandomSeed(time(NULL));
+  RandomSeed(time(NULL));
 
   // Load input dataset.
   const string inputFile = CLI::GetParam<string>("input_file");

Modified: mlpack/trunk/src/mlpack/tests/cli_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/cli_test.cpp	2012-03-12 22:01:55 UTC (rev 11842)
+++ mlpack/trunk/src/mlpack/tests/cli_test.cpp	2012-03-12 22:15:24 UTC (rev 11843)
@@ -7,7 +7,9 @@
 
 #include <iostream>
 #include <sstream>
-#include <sys/time.h>
+#ifndef _WIN32
+  #include <sys/time.h>
+#endif
 
 #include <mlpack/core.hpp>
 




More information about the mlpack-svn mailing list