summaryrefslogtreecommitdiffhomepage
path: root/eigen/Eigen/src/Core/BooleanRedux.h
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/Eigen/src/Core/BooleanRedux.h')
-rw-r--r--eigen/Eigen/src/Core/BooleanRedux.h44
1 files changed, 23 insertions, 21 deletions
diff --git a/eigen/Eigen/src/Core/BooleanRedux.h b/eigen/Eigen/src/Core/BooleanRedux.h
index ccf5190..8409d87 100644
--- a/eigen/Eigen/src/Core/BooleanRedux.h
+++ b/eigen/Eigen/src/Core/BooleanRedux.h
@@ -14,54 +14,56 @@ namespace Eigen {
namespace internal {
-template<typename Derived, int UnrollCount, int Rows>
+template<typename Derived, int UnrollCount>
struct all_unroller
{
+ typedef typename Derived::ExpressionTraits Traits;
enum {
- col = (UnrollCount-1) / Rows,
- row = (UnrollCount-1) % Rows
+ col = (UnrollCount-1) / Traits::RowsAtCompileTime,
+ row = (UnrollCount-1) % Traits::RowsAtCompileTime
};
static inline bool run(const Derived &mat)
{
- return all_unroller<Derived, UnrollCount-1, Rows>::run(mat) && mat.coeff(row, col);
+ return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
}
};
-template<typename Derived, int Rows>
-struct all_unroller<Derived, 0, Rows>
+template<typename Derived>
+struct all_unroller<Derived, 0>
{
static inline bool run(const Derived &/*mat*/) { return true; }
};
-template<typename Derived, int Rows>
-struct all_unroller<Derived, Dynamic, Rows>
+template<typename Derived>
+struct all_unroller<Derived, Dynamic>
{
static inline bool run(const Derived &) { return false; }
};
-template<typename Derived, int UnrollCount, int Rows>
+template<typename Derived, int UnrollCount>
struct any_unroller
{
+ typedef typename Derived::ExpressionTraits Traits;
enum {
- col = (UnrollCount-1) / Rows,
- row = (UnrollCount-1) % Rows
+ col = (UnrollCount-1) / Traits::RowsAtCompileTime,
+ row = (UnrollCount-1) % Traits::RowsAtCompileTime
};
static inline bool run(const Derived &mat)
{
- return any_unroller<Derived, UnrollCount-1, Rows>::run(mat) || mat.coeff(row, col);
+ return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
}
};
-template<typename Derived, int Rows>
-struct any_unroller<Derived, 0, Rows>
+template<typename Derived>
+struct any_unroller<Derived, 0>
{
static inline bool run(const Derived & /*mat*/) { return false; }
};
-template<typename Derived, int Rows>
-struct any_unroller<Derived, Dynamic, Rows>
+template<typename Derived>
+struct any_unroller<Derived, Dynamic>
{
static inline bool run(const Derived &) { return false; }
};
@@ -76,7 +78,7 @@ struct any_unroller<Derived, Dynamic, Rows>
* \sa any(), Cwise::operator<()
*/
template<typename Derived>
-EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::all() const
+inline bool DenseBase<Derived>::all() const
{
typedef internal::evaluator<Derived> Evaluator;
enum {
@@ -85,7 +87,7 @@ EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::all() const
};
Evaluator evaluator(derived());
if(unroll)
- return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic, internal::traits<Derived>::RowsAtCompileTime>::run(evaluator);
+ return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic>::run(evaluator);
else
{
for(Index j = 0; j < cols(); ++j)
@@ -100,7 +102,7 @@ EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::all() const
* \sa all()
*/
template<typename Derived>
-EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::any() const
+inline bool DenseBase<Derived>::any() const
{
typedef internal::evaluator<Derived> Evaluator;
enum {
@@ -109,7 +111,7 @@ EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::any() const
};
Evaluator evaluator(derived());
if(unroll)
- return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic, internal::traits<Derived>::RowsAtCompileTime>::run(evaluator);
+ return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic>::run(evaluator);
else
{
for(Index j = 0; j < cols(); ++j)
@@ -124,7 +126,7 @@ EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::any() const
* \sa all(), any()
*/
template<typename Derived>
-EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase<Derived>::count() const
+inline Eigen::Index DenseBase<Derived>::count() const
{
return derived().template cast<bool>().template cast<Index>().sum();
}