10 #ifndef EIGEN_ALLANDANY_H
11 #define EIGEN_ALLANDANY_H
13 #include "./InternalHeaderCheck.h"
19 template<
typename Derived,
int UnrollCount,
int InnerSize>
23 IsRowMajor = (int(Derived::Flags) & int(
RowMajor)),
24 i = (UnrollCount-1) / InnerSize,
25 j = (UnrollCount-1) % InnerSize
28 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &mat)
30 return all_unroller<Derived, UnrollCount-1, InnerSize>::run(mat) && mat.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i);
34 template<
typename Derived,
int InnerSize>
35 struct all_unroller<Derived, 0, InnerSize>
37 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &) {
return true; }
40 template<
typename Derived,
int InnerSize>
41 struct all_unroller<Derived,
Dynamic, InnerSize>
43 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &) {
return false; }
46 template<
typename Derived,
int UnrollCount,
int InnerSize>
50 IsRowMajor = (int(Derived::Flags) & int(
RowMajor)),
51 i = (UnrollCount-1) / InnerSize,
52 j = (UnrollCount-1) % InnerSize
55 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &mat)
57 return any_unroller<Derived, UnrollCount-1, InnerSize>::run(mat) || mat.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i);
61 template<
typename Derived,
int InnerSize>
62 struct any_unroller<Derived, 0, InnerSize>
64 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived & ) {
return false; }
67 template<
typename Derived,
int InnerSize>
68 struct any_unroller<Derived,
Dynamic, InnerSize>
70 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &) {
return false; }
82 template<
typename Derived>
85 typedef internal::evaluator<Derived> Evaluator;
87 unroll = SizeAtCompileTime !=
Dynamic
90 Evaluator evaluator(derived());
92 return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) :
Dynamic, InnerSizeAtCompileTime>::run(evaluator);
95 for(
Index i = 0; i < derived().outerSize(); ++i)
96 for(
Index j = 0; j < derived().innerSize(); ++j)
97 if (!evaluator.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i))
return false;
106 template<
typename Derived>
109 typedef internal::evaluator<Derived> Evaluator;
111 unroll = SizeAtCompileTime !=
Dynamic
114 Evaluator evaluator(derived());
116 return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) :
Dynamic, InnerSizeAtCompileTime>::run(evaluator);
119 for(
Index i = 0; i < derived().outerSize(); ++i)
120 for(
Index j = 0; j < derived().innerSize(); ++j)
121 if (evaluator.coeff(IsRowMajor ? i : j, IsRowMajor ? j : i))
return true;
130 template<
typename Derived>
133 return derived().template cast<bool>().template cast<Index>().sum();
140 template<
typename Derived>
143 #if EIGEN_COMP_MSVC || (defined __FAST_MATH__)
144 return derived().array().isNaN().any();
146 return !((derived().array()==derived().array()).
all());
154 template<
typename Derived>
157 #if EIGEN_COMP_MSVC || (defined __FAST_MATH__)
158 return derived().array().isFinite().all();
160 return !((derived()-derived()).hasNaN());
Index count() const
Definition: BooleanRedux.h:131
bool hasNaN() const
Definition: BooleanRedux.h:141
bool any() const
Definition: BooleanRedux.h:107
bool all() const
Definition: BooleanRedux.h:83
bool allFinite() const
Definition: BooleanRedux.h:155
static const Eigen::internal::all_t all
Definition: IndexedViewHelper.h:189
@ RowMajor
Definition: Constants.h:323
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59
const int Dynamic
Definition: Constants.h:24
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:41
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:231