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

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


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

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

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

commit 4b4d22bdeef5ae7daf0d7aafb1261dbe4b824fd3
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


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

4b4d22bdeef5ae7daf0d7aafb1261dbe4b824fd3
 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