[mlpack-svn] r11834 - in mlpack/trunk/src/mlpack/methods: kmeans pca radical
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Mar 12 15:26:40 EDT 2012
Author: rcurtin
Date: 2012-03-12 15:26:40 -0400 (Mon, 12 Mar 2012)
New Revision: 11834
Modified:
mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
mlpack/trunk/src/mlpack/methods/pca/pca.cpp
mlpack/trunk/src/mlpack/methods/radical/radical.cpp
Log:
Eliminate ambiguity in a few function calls.
Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2012-03-12 19:24:54 UTC (rev 11833)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2012-03-12 19:26:40 UTC (rev 11834)
@@ -443,7 +443,7 @@
// The offset is sum^n i - sum^(n - m) i, where n is actualClusters and
// m is the cluster we are trying to offset to.
size_t offset = (size_t) (((actualClusters - 1) * cluster)
- + (cluster - pow(cluster, 2)) / 2) - 1;
+ + (cluster - pow(cluster, 2.0)) / 2) - 1;
// See if we need to update the distance from this cluster to the first
// cluster.
@@ -461,7 +461,7 @@
// Now the distances where the first cluster is the first cluster.
size_t offset = (size_t) (((actualClusters - 1) * first)
- + (first - pow(first, 2)) / 2) - 1;
+ + (first - pow(first, 2.0)) / 2) - 1;
for (size_t cluster = first + 1; cluster < actualClusters; cluster++)
{
// Make sure it isn't already DBL_MAX.
@@ -479,7 +479,7 @@
// Now max the distances for the second cluster (which no longer has
// anything in it).
offset = (size_t) (((actualClusters - 1) * second)
- + (second - pow(second, 2)) / 2) - 1;
+ + (second - pow(second, 2.0)) / 2) - 1;
for (size_t cluster = second + 1; cluster < actualClusters; cluster++)
distances(offset + (cluster - second)) = DBL_MAX;
Modified: mlpack/trunk/src/mlpack/methods/pca/pca.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/pca/pca.cpp 2012-03-12 19:24:54 UTC (rev 11833)
+++ mlpack/trunk/src/mlpack/methods/pca/pca.cpp 2012-03-12 19:26:40 UTC (rev 11834)
@@ -49,7 +49,7 @@
arma::eig_sym(eigVal, coeffs, covMat);
int nEigVal = eigVal.n_elem;
- for (int i = 0; i < floor(nEigVal / 2); i++)
+ for (int i = 0; i < floor(nEigVal / 2.0); i++)
eigVal.swap_rows(i, (nEigVal - 1) - i);
coeffs = arma::fliplr(coeffs);
Modified: mlpack/trunk/src/mlpack/methods/radical/radical.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/radical/radical.cpp 2012-03-12 19:24:54 UTC (rev 11833)
+++ mlpack/trunk/src/mlpack/methods/radical/radical.cpp 2012-03-12 19:26:40 UTC (rev 11834)
@@ -112,7 +112,7 @@
// if m was not specified, initialize m as recommended in
// (Learned-Miller and Fisher, 2003)
if (m < 1) {
- m = floor(sqrt(matX.n_rows));
+ m = floor(sqrt((double) matX.n_rows));
}
const size_t nDims = matX.n_cols;
More information about the mlpack-svn
mailing list