[mlpack-git] master: Attempt to fix compilation error with old Armadillo version. (13611b6)
gitdub at mlpack.org
gitdub at mlpack.org
Tue Sep 13 23:42:18 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/839c25ee4b1baedfd7fab5b57c40e5820d816e28...13611b64d830899e1dddd9490957c988209f302c
>---------------------------------------------------------------
commit 13611b64d830899e1dddd9490957c988209f302c
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Sep 13 23:42:18 2016 -0400
Attempt to fix compilation error with old Armadillo version.
It seems operator&& is not implemented for matrix operations in Armadillo
4.100.2, so this works around the problem by using element-wise multiplication
on booleans (which is the same operation) instead.
>---------------------------------------------------------------
13611b64d830899e1dddd9490957c988209f302c
src/mlpack/tests/lsh_test.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/tests/lsh_test.cpp b/src/mlpack/tests/lsh_test.cpp
index 33485fc..a5fb379 100644
--- a/src/mlpack/tests/lsh_test.cpp
+++ b/src/mlpack/tests/lsh_test.cpp
@@ -594,21 +594,23 @@ BOOST_AUTO_TEST_CASE(MultiprobeDeterministicTest)
BOOST_REQUIRE(arma::all(neighbors.col(0) == N));
// Test that q1 search with 1 additional probe returns some C2 points.
+ // We use the schur product (%) instead of logical and (&&) to handle an early
+ // Armadillo bug.
lshTest.Search(q1, k, neighbors, distances, 0, 1);
BOOST_REQUIRE(arma::all(
- neighbors.col(0) == N ||
- (neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2)));
+ (neighbors.col(0) == N) ||
+ ((neighbors.col(0) >= N / 4) % (neighbors.col(0) < N / 2))));
// Test that q2 simple search returns some C2 points.
lshTest.Search(q2, k, neighbors, distances);
BOOST_REQUIRE(arma::all(
neighbors.col(0) == N ||
- (neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2)));
+ ((neighbors.col(0) >= N / 4) % (neighbors.col(0) < N / 2))));
// Test that q2 with 3 additional probes returns all C2 points.
lshTest.Search(q2, k, neighbors, distances, 0, 3);
BOOST_REQUIRE(arma::all(
- neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2));
+ (neighbors.col(0) >= N / 4) % (neighbors.col(0) < N / 2)));
}
BOOST_AUTO_TEST_CASE(LSHTrainTest)
More information about the mlpack-git
mailing list