[mlpack-svn] r11199 - mlpack/trunk/src/mlpack/methods/kmeans
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Jan 20 15:07:51 EST 2012
Author: pram
Date: 2012-01-20 15:07:51 -0500 (Fri, 20 Jan 2012)
New Revision: 11199
Modified:
mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
Log:
fixed some stupid typecasting warnings
Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2012-01-20 18:45:42 UTC (rev 11198)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2012-01-20 20:07:51 UTC (rev 11199)
@@ -206,7 +206,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 = (((actualClusters - 1) * cluster)
+ size_t offset = (size_t) (((actualClusters - 1) * cluster)
+ (cluster - pow(cluster, 2)) / 2) - 1;
// See if we need to update the distance from this cluster to the first
@@ -224,7 +224,7 @@
}
// Now the distances where the first cluster is the first cluster.
- size_t offset = (((actualClusters - 1) * first)
+ size_t offset = (size_t) (((actualClusters - 1) * first)
+ (first - pow(first, 2)) / 2) - 1;
for (size_t cluster = first + 1; cluster < actualClusters; cluster++)
{
@@ -242,8 +242,8 @@
// Now max the distances for the second cluster (which no longer has
// anything in it).
- offset = (((actualClusters - 1) * second) + (second - pow(second, 2)) / 2)
- - 1;
+ offset = (size_t) (((actualClusters - 1) * second)
+ + (second - pow(second, 2)) / 2) - 1;
for (size_t cluster = second + 1; cluster < actualClusters; cluster++)
distances(offset + (cluster - second)) = DBL_MAX;
More information about the mlpack-svn
mailing list