10#ifndef EIGEN_ALLANDANY_H
11#define EIGEN_ALLANDANY_H
17template<
typename Derived,
int UnrollCount>
21 col = (UnrollCount-1) / Derived::RowsAtCompileTime,
22 row = (UnrollCount-1) % Derived::RowsAtCompileTime
25 static inline bool run(
const Derived &mat)
27 return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
31template<
typename Derived>
32struct all_unroller<Derived, 1>
34 static inline bool run(
const Derived &mat) {
return mat.coeff(0, 0); }
37template<
typename Derived>
38struct all_unroller<Derived, Dynamic>
40 static inline bool run(
const Derived &) {
return false; }
43template<
typename Derived,
int UnrollCount>
47 col = (UnrollCount-1) / Derived::RowsAtCompileTime,
48 row = (UnrollCount-1) % Derived::RowsAtCompileTime
51 static inline bool run(
const Derived &mat)
53 return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
57template<
typename Derived>
58struct any_unroller<Derived, 1>
60 static inline bool run(
const Derived &mat) {
return mat.coeff(0, 0); }
63template<
typename Derived>
64struct any_unroller<Derived, Dynamic>
66 static inline bool run(
const Derived &) {
return false; }
78template<
typename Derived>
84 && NumTraits<Scalar>::AddCost != Dynamic
88 return internal::all_unroller<Derived,
93 for(
Index j = 0; j < cols(); ++j)
94 for(
Index i = 0; i < rows(); ++i)
95 if (!coeff(i, j))
return false;
104template<
typename Derived>
110 && NumTraits<Scalar>::AddCost != Dynamic
114 return internal::any_unroller<Derived,
119 for(
Index j = 0; j < cols(); ++j)
120 for(
Index i = 0; i < rows(); ++i)
121 if (coeff(i, j))
return true;
130template<
typename Derived>
133 return derived().template cast<bool>().template cast<Index>().sum();
Index count() const
Definition BooleanRedux.h:131
internal::traits< Derived >::Index Index
The type of indices.
Definition DenseBase.h:51
bool all(void) const
Definition BooleanRedux.h:79
@ CoeffReadCost
Definition DenseBase.h:162
@ SizeAtCompileTime
Definition DenseBase.h:105
bool any(void) const
Definition BooleanRedux.h:105