25 #ifndef EIGEN_ALLANDANY_H
26 #define EIGEN_ALLANDANY_H
32 template<
typename Derived,
int UnrollCount>
36 col = (UnrollCount-1) / Derived::RowsAtCompileTime,
37 row = (UnrollCount-1) % Derived::RowsAtCompileTime
40 static inline bool run(
const Derived &mat)
42 return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(
row,
col);
46 template<
typename Derived>
47 struct all_unroller<Derived, 1>
49 static inline bool run(
const Derived &mat) {
return mat.coeff(0, 0); }
52 template<
typename Derived>
53 struct all_unroller<Derived,
Dynamic>
55 static inline bool run(
const Derived &) {
return false; }
58 template<
typename Derived,
int UnrollCount>
62 col = (UnrollCount-1) / Derived::RowsAtCompileTime,
63 row = (UnrollCount-1) % Derived::RowsAtCompileTime
66 static inline bool run(
const Derived &mat)
68 return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(
row,
col);
72 template<
typename Derived>
73 struct any_unroller<Derived, 1>
75 static inline bool run(
const Derived &mat) {
return mat.coeff(0, 0); }
78 template<
typename Derived>
79 struct any_unroller<Derived,
Dynamic>
81 static inline bool run(
const Derived &) {
return false; }
93 template<
typename Derived>
97 unroll = SizeAtCompileTime !=
Dynamic
103 return internal::all_unroller<Derived,
108 for(
Index j = 0; j < cols(); ++j)
109 for(
Index i = 0; i < rows(); ++i)
110 if (!coeff(i, j))
return false;
119 template<
typename Derived>
123 unroll = SizeAtCompileTime !=
Dynamic
129 return internal::any_unroller<Derived,
134 for(
Index j = 0; j < cols(); ++j)
135 for(
Index i = 0; i < rows(); ++i)
136 if (coeff(i, j))
return true;
145 template<
typename Derived>
148 return derived().template cast<bool>().
template cast<Index>().sum();
153 #endif // EIGEN_ALLANDANY_H