[mlpack-svn] r12378 - mlpack/trunk/src/mlpack/methods/sparse_coding

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Apr 13 18:52:02 EDT 2012


Author: rcurtin
Date: 2012-04-13 18:52:01 -0400 (Fri, 13 Apr 2012)
New Revision: 12378

Modified:
   mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding.cpp
   mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp
Log:
Missed a couple uwords.


Modified: mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding.cpp	2012-04-13 22:50:47 UTC (rev 12377)
+++ mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding.cpp	2012-04-13 22:52:01 UTC (rev 12378)
@@ -127,7 +127,7 @@
   //   matGram = trans(matD) * matD;
   // }
 
-  for (uword i = 0; i < nPoints; ++i)
+  for (size_t i = 0; i < nPoints; ++i)
   {
     // Report progress.
     if ((i % 100) == 0)
@@ -185,7 +185,7 @@
   std::vector<size_t> activeAtoms;
   activeAtoms.reserve(nAtoms);
 
-  for (uword j = 0; j < nAtoms; ++j)
+  for (size_t j = 0; j < nAtoms; ++j)
   {
     if (accu(matZ.row(j) != 0) == 0)
       inactiveAtoms.push_back(j);
@@ -209,7 +209,7 @@
   }
 
   uvec atomReverseLookup = uvec(nAtoms);
-  for (uword i = 0; i < nActiveAtoms; ++i)
+  for (size_t i = 0; i < nActiveAtoms; ++i)
     atomReverseLookup(activeAtoms[i]) = i;
 
   if (nInactiveAtoms > 0)
@@ -235,7 +235,7 @@
 
   //vec dualVars = diagvec(solve(matD, matX * trans(matZ))
   //    - matZ * trans(matZ));
-  //for (uword i = 0; i < dualVars.n_elem; i++)
+  //for (size_t i = 0; i < dualVars.n_elem; i++)
   //  if (dualVars(i) < 0)
   //    dualVars(i) = 0;
 

Modified: mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp	2012-04-13 22:50:47 UTC (rev 12377)
+++ mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp	2012-04-13 22:52:01 UTC (rev 12378)
@@ -53,12 +53,12 @@
   mat matX;
   data::Load(dataFullpath, matX);
 
-  uword nPoints = matX.n_cols;
+  const size_t nPoints = matX.n_cols;
   Log::Info << "Loaded " << nPoints << " points in " << matX.n_rows <<
       " dimensions." << endl;
 
   // Normalize each point since these are images.
-  for (uword i = 0; i < nPoints; ++i)
+  for (size_t i = 0; i < nPoints; ++i)
     matX.col(i) /= norm(matX.col(i), 2);
 
   // Run the sparse coding algorithm.




More information about the mlpack-svn mailing list