* QR: add a rank() method and improve the accuracy of the rank

* computation
* Array: add a count() method and rename AllAndAny.h file to
  BooleanRedux.h
This commit is contained in:
Gael Guennebaud
2009-01-20 16:37:52 +00:00
parent 81cb887baf
commit 8973d12cda
5 changed files with 39 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ struct ei_any_unroller<Derived, Dynamic>
* \sa MatrixBase::any(), Cwise::operator<()
*/
template<typename Derived>
inline bool MatrixBase<Derived>::all(void) const
inline bool MatrixBase<Derived>::all() const
{
const bool unroll = SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost)
<= EIGEN_UNROLLING_LIMIT;
@@ -113,7 +113,7 @@ inline bool MatrixBase<Derived>::all(void) const
* \sa MatrixBase::all()
*/
template<typename Derived>
inline bool MatrixBase<Derived>::any(void) const
inline bool MatrixBase<Derived>::any() const
{
const bool unroll = SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost)
<= EIGEN_UNROLLING_LIMIT;
@@ -130,4 +130,16 @@ inline bool MatrixBase<Derived>::any(void) const
}
}
/** \array_module
*
* \returns the number of coefficients which evaluate to true
*
* \sa MatrixBase::all(), MatrixBase::any()
*/
template<typename Derived>
inline int MatrixBase<Derived>::count() const
{
return this->cast<bool>().cast<int>().sum();
}
#endif // EIGEN_ALLANDANY_H

View File

@@ -200,7 +200,6 @@ template<typename Scalar>
struct ei_functor_traits<ei_scalar_cube_op<Scalar> >
{ enum { Cost = 2*NumTraits<Scalar>::MulCost, PacketAccess = int(ei_packet_traits<Scalar>::size)>1 }; };
// default ei_functor_traits for STL functors:
template<typename T>