Fix typo in Vectowise::any()

This commit is contained in:
Gael Guennebaud 2015-09-16 22:31:19 +02:00
parent 43ba07d4d7
commit 9d993c709b
2 changed files with 25 additions and 13 deletions

View File

@ -408,7 +408,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* \sa DenseBase::any() */
EIGEN_DEVICE_FUNC
const AnyReturnType any() const
{ return Any(_expression()); }
{ return AnyReturnType(_expression()); }
/** \returns a row (or column) vector expression representing
* the number of \c true coefficients of each respective column (or row).

View File

@ -111,6 +111,18 @@ template<typename ArrayType> void vectorwiseop_array(const ArrayType& m)
m2.rowwise() /= m2.colwise().sum();
VERIFY_IS_APPROX(m2, m1.rowwise() / m1.colwise().sum());
}
// all/any
Array<bool,Dynamic,Dynamic> mb(rows,cols);
mb = (m1.real()<=0.7).colwise().all();
VERIFY( (mb.col(c) == (m1.real().col(c)<=0.7).all()).all() );
mb = (m1.real()<=0.7).rowwise().all();
VERIFY( (mb.row(r) == (m1.real().row(r)<=0.7).all()).all() );
mb = (m1.real()>=0.7).colwise().any();
VERIFY( (mb.col(c) == (m1.real().col(c)>=0.7).any()).all() );
mb = (m1.real()>=0.7).rowwise().any();
VERIFY( (mb.row(r) == (m1.real().row(r)>=0.7).any()).all() );
}
template<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m)