add partial count redux (adapted patch from Ricard Marxer)
diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h
index 6ce7229..96c13ca 100644
--- a/Eigen/src/Array/PartialRedux.h
+++ b/Eigen/src/Array/PartialRedux.h
@@ -114,6 +114,7 @@
 EIGEN_MEMBER_FUNCTOR(maxCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(all, (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(any, (Size-1)*NumTraits<Scalar>::AddCost);
+EIGEN_MEMBER_FUNCTOR(count, (Size-1)*NumTraits<Scalar>::AddCost);
 
 /** \internal */
 template <typename BinaryOp, typename Scalar>
@@ -173,7 +174,7 @@
     };
 
     typedef typename ExpressionType::PlainMatrixType CrossReturnType;
-
+    
     inline PartialRedux(const ExpressionType& matrix) : m_matrix(matrix) {}
 
     /** \internal */
@@ -246,6 +247,16 @@
       * \sa MatrixBase::any() */
     const typename ReturnType<ei_member_any>::Type any() const
     { return _expression(); }
+    
+    /** \returns a row (or column) vector expression representing
+      * the number of \c true coefficients of each respective column (or row).
+      *
+      * Example: \include PartialRedux_count.cpp
+      * Output: \verbinclude PartialRedux_count.out
+      *
+      * \sa MatrixBase::count() */
+    const PartialReduxExpr<ExpressionType, ei_member_count<int>, Direction> count() const
+    { return _expression(); }
 
     /** \returns a 3x3 matrix expression of the cross product
       * of each column or row of the referenced expression with the \a other vector.
diff --git a/doc/TutorialSparse.dox b/doc/TutorialSparse.dox
index d9d5e9e..a8bfe00 100644
--- a/doc/TutorialSparse.dox
+++ b/doc/TutorialSparse.dox
@@ -21,7 +21,6 @@
 
 In many applications (e.g., finite element methods) it is common to deal with very large matrices where only a few coefficients are different than zero. Both in term of memory consumption and performance, it is fundamental to use an adequate representation storing only nonzero coefficients. Such a matrix is called a sparse matrix.
 
-
 \b Declaring \b sparse \b matrices \b and \b vectors \n
 The SparseMatrix class is the main sparse matrix representation of the Eigen's sparse module which offers high performance, low memory usage, and compatibility with most of sparse linear algebra packages. Because of its limited flexibility, we also provide a DynamicSparseMatrix variante taillored for low-level sparse matrix assembly. Both of them can be either row major or column major:
 
diff --git a/doc/snippets/PartialRedux_count.cpp b/doc/snippets/PartialRedux_count.cpp
new file mode 100644
index 0000000..914a5de
--- /dev/null
+++ b/doc/snippets/PartialRedux_count.cpp
@@ -0,0 +1,3 @@
+Matrix3d m = Matrix3d::Random();
+cout << "Here is the matrix m:" << endl << m << endl;
+cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl << (m.cwise() >= 0.5).rowwise().count() << endl;
diff --git a/test/array.cpp b/test/array.cpp
index e104748..ea39738 100644
--- a/test/array.cpp
+++ b/test/array.cpp
@@ -111,6 +111,11 @@
                         .select(m1,0), m3);
   // even shorter version:
   VERIFY_IS_APPROX( (m1.cwise().abs().cwise()<mid).select(0,m1), m3);
+  
+  // count
+  VERIFY(((m1.cwise().abs().cwise()+1).cwise()>0.5).count() == rows*cols);
+  VERIFY_IS_APPROX(((m1.cwise().abs().cwise()+1).cwise()>0.5).colwise().count(), RowVectorXi::Constant(cols,rows));
+  VERIFY_IS_APPROX(((m1.cwise().abs().cwise()+1).cwise()>0.5).rowwise().count(), VectorXi::Constant(rows, cols));
 }
 
 template<typename VectorType> void lpNorm(const VectorType& v)