10#ifndef EIGEN_ALLANDANY_H
11#define EIGEN_ALLANDANY_H
17template<
typename Derived,
int UnrollCount>
20 typedef typename Derived::ExpressionTraits Traits;
22 col = (UnrollCount-1) / Traits::RowsAtCompileTime,
23 row = (UnrollCount-1) % Traits::RowsAtCompileTime
26 static inline bool run(
const Derived &mat)
28 return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
32template<
typename Derived>
33struct all_unroller<Derived, 0>
35 static inline bool run(
const Derived &) {
return true; }
38template<
typename Derived>
39struct all_unroller<Derived,
Dynamic>
41 static inline bool run(
const Derived &) {
return false; }
44template<
typename Derived,
int UnrollCount>
47 typedef typename Derived::ExpressionTraits Traits;
49 col = (UnrollCount-1) / Traits::RowsAtCompileTime,
50 row = (UnrollCount-1) % Traits::RowsAtCompileTime
53 static inline bool run(
const Derived &mat)
55 return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
59template<
typename Derived>
60struct any_unroller<Derived, 0>
62 static inline bool run(
const Derived & ) {
return false; }
65template<
typename Derived>
66struct any_unroller<Derived,
Dynamic>
68 static inline bool run(
const Derived &) {
return false; }
80template<
typename Derived>
83 typedef internal::evaluator<Derived> Evaluator;
85 unroll = SizeAtCompileTime !=
Dynamic
88 Evaluator evaluator(derived());
90 return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) :
Dynamic>::run(evaluator);
93 for(
Index j = 0; j < cols(); ++j)
94 for(
Index i = 0; i < rows(); ++i)
95 if (!evaluator.coeff(i, j))
return false;
104template<
typename Derived>
107 typedef internal::evaluator<Derived> Evaluator;
109 unroll = SizeAtCompileTime !=
Dynamic
112 Evaluator evaluator(derived());
114 return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) :
Dynamic>::run(evaluator);
117 for(
Index j = 0; j < cols(); ++j)
118 for(
Index i = 0; i < rows(); ++i)
119 if (evaluator.coeff(i, j))
return true;
128template<
typename Derived>
131 return derived().template cast<bool>().template cast<Index>().
sum();
138template<
typename Derived>
141#if EIGEN_COMP_MSVC || (defined __FAST_MATH__)
142 return derived().array().isNaN().
any();
144 return !((derived().array()==derived().array()).all());
152template<
typename Derived>
155#if EIGEN_COMP_MSVC || (defined __FAST_MATH__)
156 return derived().array().isFinite().
all();
158 return !((derived()-derived()).hasNaN());
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:47
bool any() const
Definition: BooleanRedux.h:105
Scalar sum() const
Definition: Redux.h:449
bool all() const
Definition: BooleanRedux.h:81
Namespace containing all symbols from the Eigen library.
Definition: Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
const int Dynamic
Definition: Constants.h:21
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:151