[mlpack-svn] r13165 - mlpack/trunk/src/mlpack/core/math
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jul 5 14:28:06 EDT 2012
Author: rcurtin
Date: 2012-07-05 14:28:05 -0400 (Thu, 05 Jul 2012)
New Revision: 13165
Modified:
mlpack/trunk/src/mlpack/core/math/lin_alg.cpp
Log:
Cleaner calls to .rows() as opposed to .submat() with all those arma::span
objects.
Modified: mlpack/trunk/src/mlpack/core/math/lin_alg.cpp
===================================================================
--- mlpack/trunk/src/mlpack/core/math/lin_alg.cpp 2012-07-05 18:27:35 UTC (rev 13164)
+++ mlpack/trunk/src/mlpack/core/math/lin_alg.cpp 2012-07-05 18:28:05 UTC (rev 13165)
@@ -181,23 +181,22 @@
if (rowsToRemove[0] > 0)
{
// Note that this implies that n_rows > 1.
- size_t height = rowsToRemove[0];
- output(arma::span(curRow, curRow + height - 1), arma::span::all) =
- input(arma::span(0, rowsToRemove[0] - 1), arma::span::all);
- curRow += height;
+ output.rows(0, rowsToRemove[0] - 1) = input.rows(0, rowsToRemove[0] - 1);
+ curRow += rowsToRemove[0];
}
// Now, check i'th row to remove to (i + 1)'th row to remove, until i is the
// penultimate row.
while (removeInd < nRemove - 1)
{
- size_t height = rowsToRemove[removeInd + 1] - rowsToRemove[removeInd] - 1;
+ const size_t height = rowsToRemove[removeInd + 1] -
+ rowsToRemove[removeInd] - 1;
if (height > 0)
{
- output(arma::span(curRow, curRow + height - 1), arma::span::all) =
- input(arma::span(rowsToRemove[removeInd] + 1,
- rowsToRemove[removeInd + 1] - 1), arma::span::all);
+ output.rows(curRow, curRow + height - 1) =
+ input.rows(rowsToRemove[removeInd] + 1,
+ rowsToRemove[removeInd + 1] - 1);
curRow += height;
}
@@ -208,9 +207,8 @@
// row.
if (rowsToRemove[removeInd] < input.n_rows - 1)
{
- output(arma::span(curRow, nKeep - 1), arma::span::all) =
- input(arma::span(rowsToRemove[removeInd] + 1, input.n_rows - 1),
- arma::span::all);
+ output.rows(curRow, nKeep - 1) = input.rows(rowsToRemove[removeInd] + 1,
+ input.n_rows - 1);
}
}
}
More information about the mlpack-svn
mailing list