mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added support for boolean reductions (ie 'and' & 'or' reductions)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user