10#ifndef EIGEN_ALLANDANY_H
11#define EIGEN_ALLANDANY_H
13#include "./InternalHeaderCheck.h"
19template<
typename Derived,
int UnrollCount,
int Rows>
23 col = (UnrollCount-1) / Rows,
24 row = (UnrollCount-1) % Rows
27 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &mat)
29 return all_unroller<Derived, UnrollCount-1, Rows>::run(mat) && mat.coeff(row, col);
33template<
typename Derived,
int Rows>
34struct all_unroller<Derived, 0, Rows>
36 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &) {
return true; }
39template<
typename Derived,
int Rows>
40struct all_unroller<Derived,
Dynamic, Rows>
42 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &) {
return false; }
45template<
typename Derived,
int UnrollCount,
int Rows>
49 col = (UnrollCount-1) / Rows,
50 row = (UnrollCount-1) % Rows
53 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived &mat)
55 return any_unroller<Derived, UnrollCount-1, Rows>::run(mat) || mat.coeff(row, col);
59template<
typename Derived,
int Rows>
60struct any_unroller<Derived, 0, Rows>
62 EIGEN_DEVICE_FUNC
static inline bool run(
const Derived & ) {
return false; }
65template<
typename Derived,
int Rows>
66struct any_unroller<Derived,
Dynamic, Rows>
68 EIGEN_DEVICE_FUNC
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, internal::traits<Derived>::RowsAtCompileTime>::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, internal::traits<Derived>::RowsAtCompileTime>::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());
Index count() const
Definition: BooleanRedux.h:129
bool hasNaN() const
Definition: BooleanRedux.h:139
bool any() const
Definition: BooleanRedux.h:105
bool all() const
Definition: BooleanRedux.h:81
bool allFinite() const
Definition: BooleanRedux.h:153
static const Eigen::internal::all_t all
Definition: IndexedViewHelper.h:189
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
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:235