[mlpack-git] master: don't let the compiler infer matrix result types (018d920)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:10:49 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit 018d920a02c3c4f4a161a9544439d182e474b80c
Author: Stephen Tu <tu.stephenl at gmail.com>
Date:   Tue Jan 6 12:25:32 2015 -0800

    don't let the compiler infer matrix result types
    
    we need to be explicit about types, otherwise we run into
    strange memory issues with optimized code


>---------------------------------------------------------------

018d920a02c3c4f4a161a9544439d182e474b80c
 src/mlpack/tests/lrsdp_test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mlpack/tests/lrsdp_test.cpp b/src/mlpack/tests/lrsdp_test.cpp
index 843a870..4e4b473 100644
--- a/src/mlpack/tests/lrsdp_test.cpp
+++ b/src/mlpack/tests/lrsdp_test.cpp
@@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(GaussianMatrixSensingSDP)
   arma::vec b(p);
   for (size_t i = 0; i < p; ++i)
   {
-    const auto Ai = arma::reshape(A.row(i), n, m);
+    const arma::mat Ai = arma::reshape(A.row(i), n, m);
     b(i) = arma::dot(trans(Ai), Xorig);
   }
 
@@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(GaussianMatrixSensingSDP)
 
   for (size_t i = 0; i < p; ++i)
   {
-    const auto Ai = arma::reshape(A.row(i), n, m);
+    const arma::mat Ai = arma::reshape(A.row(i), n, m);
     sensing.DenseA()[i].zeros(m + n, m + n);
     sensing.DenseA()[i](block_rows, block_cols) = trans(Ai);
     sensing.DenseA()[i](block_cols, block_rows) = Ai;
@@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE(GaussianMatrixSensingSDP)
   const arma::mat rrt = coordinates * trans(coordinates);
   for (size_t i = 0; i < p; ++i)
   {
-    const auto Ai = arma::reshape(A.row(i), n, m);
+    const arma::mat Ai = arma::reshape(A.row(i), n, m);
     const double measurement =
       arma::dot(trans(Ai), rrt(block_rows, block_cols));
     BOOST_REQUIRE_CLOSE(measurement, b(i), 1e-3);



More information about the mlpack-git mailing list