diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2013-08-06 09:49:44 +0100 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2013-08-06 09:49:44 +0100 |
commit | 616f9cc593fb47e39e0a47b6a749f15d66a5c734 (patch) | |
tree | 367421e08f670cf632fd5e2fce5e27651d992f10 | |
parent | 2f0faf117ead5f92424bd3c67c434eb3ecaa9661 (diff) |
doc: Explain type of result for VectorwiseOp member functions.
Prompted by a question on the forum.
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 11 | ||||
-rw-r--r-- | doc/snippets/PartialRedux_count.cpp | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 511564875..328b6179b 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -301,6 +301,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression of the squared norm * of each column (or row) of the referenced expression. + * This is a vector with real entries, even if the original matrix has complex entries. * * Example: \include PartialRedux_squaredNorm.cpp * Output: \verbinclude PartialRedux_squaredNorm.out @@ -311,6 +312,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression. + * This is a vector with real entries, even if the original matrix has complex entries. * * Example: \include PartialRedux_norm.cpp * Output: \verbinclude PartialRedux_norm.out @@ -322,7 +324,8 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression, using - * blue's algorithm. + * Blue's algorithm. + * This is a vector with real entries, even if the original matrix has complex entries. * * \sa DenseBase::blueNorm() */ const typename ReturnType<internal::member_blueNorm,RealScalar>::Type blueNorm() const @@ -332,6 +335,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression, avoiding * underflow and overflow. + * This is a vector with real entries, even if the original matrix has complex entries. * * \sa DenseBase::stableNorm() */ const typename ReturnType<internal::member_stableNorm,RealScalar>::Type stableNorm() const @@ -341,6 +345,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression, avoiding * underflow and overflow using a concatenation of hypot() calls. + * This is a vector with real entries, even if the original matrix has complex entries. * * \sa DenseBase::hypotNorm() */ const typename ReturnType<internal::member_hypotNorm,RealScalar>::Type hypotNorm() const @@ -365,6 +370,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression representing * whether \b all coefficients of each respective column (or row) are \c true. + * This expression can be assigned to a vector with entries of type \c bool. * * \sa DenseBase::all() */ const typename ReturnType<internal::member_all>::Type all() const @@ -372,6 +378,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression representing * whether \b at \b least one coefficient of each respective column (or row) is \c true. + * This expression can be assigned to a vector with entries of type \c bool. * * \sa DenseBase::any() */ const typename ReturnType<internal::member_any>::Type any() const @@ -379,6 +386,8 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** \returns a row (or column) vector expression representing * the number of \c true coefficients of each respective column (or row). + * This expression can be assigned to a vector whose entries have the same type as is used to + * index entries of the original matrix; for dense matrices, this is \c std::ptrdiff_t . * * Example: \include PartialRedux_count.cpp * Output: \verbinclude PartialRedux_count.out diff --git a/doc/snippets/PartialRedux_count.cpp b/doc/snippets/PartialRedux_count.cpp index c7b3097e4..1c3b3a28f 100644 --- a/doc/snippets/PartialRedux_count.cpp +++ b/doc/snippets/PartialRedux_count.cpp @@ -1,3 +1,5 @@ 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.array() >= 0.5).rowwise().count() << endl; +Matrix<ptrdiff_t, 3, 1> res = (m.array() >= 0.5).rowwise().count(); +cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl; +cout << res << endl; |