[mlpack-git] master: older versions of arma do not support unary minus on sparse matrices (a8ecf09)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Feb 4 13:59:57 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/b4c08074ca03feaf38511e62fd0e928330b99d93...5405d315de3db90fb652b13441f68c2c482286f3

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

commit a8ecf093989cbe3d58c36c4e21e772c99d7856e4
Author: Stephen Tu <tu.stephenl at gmail.com>
Date:   Wed Feb 4 10:53:00 2015 -0800

    older versions of arma do not support unary minus on sparse matrices


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

a8ecf093989cbe3d58c36c4e21e772c99d7856e4
 src/mlpack/tests/sdp_primal_dual_test.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/tests/sdp_primal_dual_test.cpp b/src/mlpack/tests/sdp_primal_dual_test.cpp
index 9e6cab5..a84f155 100644
--- a/src/mlpack/tests/sdp_primal_dual_test.cpp
+++ b/src/mlpack/tests/sdp_primal_dual_test.cpp
@@ -157,7 +157,9 @@ ConstructMaxCutSDPFromLaplacian(const std::string& laplacianFilename)
   if (laplacian.n_rows != laplacian.n_cols)
     Log::Fatal << "laplacian not square" << std::endl;
   SDP<arma::sp_mat> sdp(laplacian.n_rows, laplacian.n_rows, 0);
-  sdp.C() = -arma::sp_mat(laplacian);
+  // operator- not supported on older versions of arma
+  sdp.C() = arma::sp_mat(laplacian);
+  sdp.C() *= -1.;
   for (size_t i = 0; i < laplacian.n_rows; i++)
   {
     sdp.SparseA()[i].zeros(laplacian.n_rows, laplacian.n_rows);



More information about the mlpack-git mailing list