[mlpack-svn] r10681 - mlpack/trunk/src/mlpack/methods/gmm

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 9 17:09:07 EST 2011


Author: rcurtin
Date: 2011-12-09 17:09:06 -0500 (Fri, 09 Dec 2011)
New Revision: 10681

Modified:
   mlpack/trunk/src/mlpack/methods/gmm/phi.hpp
Log:
For some reason, this caused a segfault with -O2.  This needs to be looked into.


Modified: mlpack/trunk/src/mlpack/methods/gmm/phi.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/phi.hpp	2011-12-09 19:45:51 UTC (rev 10680)
+++ mlpack/trunk/src/mlpack/methods/gmm/phi.hpp	2011-12-09 22:09:06 UTC (rev 10681)
@@ -116,12 +116,12 @@
   // the right hand part of the equation (instead of the left side) so that
   // later we are referencing columns, not rows -- that is faster.
   arma::mat rhs = -0.5 * inv(cov) * diffs;
-  arma::vec exponents(x.n_cols); // We will now fill this.
-  for (size_t i = 0; i < x.n_cols; i++)
-    exponents(i) = accu(diffs.col(i) % rhs.col(i));
+  arma::vec exponents(diffs.n_cols); // We will now fill this.
+  for (size_t i = 0; i < diffs.n_cols; i++)
+    exponents(i) = exp(accu(diffs.unsafe_col(i) % rhs.unsafe_col(i)));
 
   probabilities = pow(2 * M_PI, (double) mean.n_elem / -2.0) *
-      pow(det(cov), -0.5) * exp(exponents);
+      pow(det(cov), -0.5) * exponents;
 }
 
 }; // namespace gmm




More information about the mlpack-svn mailing list