aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_reduction.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-10-20 11:41:22 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-10-20 11:41:22 -0700
commiteaf4b98180d7606abba69133e39e23537ced79e5 (patch)
treea9f9adc1fc6dfa452e3dc1393371096b5c668c6b /unsupported/test/cxx11_tensor_reduction.cpp
parentf5c1587e4e7d9e3e5a57deedff8d27b866a0a47b (diff)
Added support for boolean reductions (ie 'and' & 'or' reductions)
Diffstat (limited to 'unsupported/test/cxx11_tensor_reduction.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_reduction.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_tensor_reduction.cpp b/unsupported/test/cxx11_tensor_reduction.cpp
index b2c85a879..e8180c061 100644
--- a/unsupported/test/cxx11_tensor_reduction.cpp
+++ b/unsupported/test/cxx11_tensor_reduction.cpp
@@ -180,6 +180,23 @@ static void test_simple_reductions() {
VERIFY_IS_APPROX(mean1(0), mean2(0));
}
+
+ {
+ Tensor<int, 1> ints(10);
+ std::iota(ints.data(), ints.data() + ints.dimension(0), 0);
+
+ TensorFixedSize<bool, Sizes<1> > all;
+ all = ints.all();
+ VERIFY(!all(0));
+ all = (ints >= ints.constant(0)).all();
+ VERIFY(all(0));
+
+ TensorFixedSize<bool, Sizes<1> > any;
+ any = (ints > ints.constant(10)).any();
+ VERIFY(!any(0));
+ any = (ints < ints.constant(1)).any();
+ VERIFY(any(0));
+ }
}
template <int DataLayout>