diff options
author | Steve Bronder <stevo15025@gmail.com> | 2021-03-04 18:58:08 +0000 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-03-04 18:58:08 +0000 |
commit | 6cbb3038ac48cb5fe17eba4dfbf26e3e798041f1 (patch) | |
tree | f6b55d8169c36a10b4cfb0c35c2e067a774d252d /Eigen/src/Core/VectorwiseOp.h | |
parent | 5bfc67f9e7efde8c8ffae9b56f63186d682b9d44 (diff) |
Adds EIGEN_CONSTEXPR and EIGEN_NOEXCEPT to rows(), cols(), innerStride(), outerStride(), and size()
Diffstat (limited to 'Eigen/src/Core/VectorwiseOp.h')
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 91a6c0353..870f4f1e4 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -65,10 +65,10 @@ class PartialReduxExpr : public internal::dense_xpr_base< PartialReduxExpr<Matri explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp()) : m_matrix(mat), m_functor(func) {} - EIGEN_DEVICE_FUNC - Index rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); } - EIGEN_DEVICE_FUNC - Index cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return (Direction==Vertical ? 1 : m_matrix.rows()); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return (Direction==Horizontal ? 1 : m_matrix.cols()); } EIGEN_DEVICE_FUNC typename MatrixType::Nested nestedExpression() const { return m_matrix; } @@ -134,7 +134,7 @@ struct member_redux { typedef typename result_of< BinaryOp(const Scalar&,const Scalar&) >::type result_type; - + enum { Vectorizable = functor_traits<BinaryOp>::PacketAccess }; template<int Size> struct Cost { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; }; EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {} @@ -162,17 +162,17 @@ struct member_redux { * where `foo` is any method of `VectorwiseOp`. This expression is equivalent to applying `foo()` to each * column of `A` and then re-assemble the outputs in a matrix expression: * \code [A.col(0).foo(), A.col(1).foo(), ..., A.col(A.cols()-1).foo()] \endcode - * + * * Example: \include MatrixBase_colwise.cpp * Output: \verbinclude MatrixBase_colwise.out * * The begin() and end() methods are obviously exceptions to the previous rule as they * return STL-compatible begin/end iterators to the rows or columns of the nested expression. * Typical use cases include for-range-loop and calls to STL algorithms: - * + * * Example: \include MatrixBase_colwise_iterator_cxx11.cpp * Output: \verbinclude MatrixBase_colwise_iterator_cxx11.out - * + * * For a partial reduction on an empty input, some rules apply. * For the sake of clarity, let's consider a vertical reduction: * - If the number of columns is zero, then a 1x0 row-major vector expression is returned. @@ -180,7 +180,7 @@ struct member_redux { * - a row vector of zeros is returned for sum-like reductions (sum, squaredNorm, norm, etc.) * - a row vector of ones is returned for a product reduction (e.g., <code>MatrixXd(n,0).colwise().prod()</code>) * - an assert is triggered for all other reductions (minCoeff,maxCoeff,redux(bin_op)) - * + * * \sa DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr */ template<typename ExpressionType, int Direction> class VectorwiseOp @@ -216,7 +216,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp }; protected: - + template<typename OtherDerived> struct ExtendedType { typedef Replicate<OtherDerived, isVertical ? 1 : ExpressionType::RowsAtCompileTime, @@ -328,7 +328,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp * * \warning the size along the reduction direction must be strictly positive, * otherwise an assertion is triggered. - * + * * \sa class VectorwiseOp, DenseBase::colwise(), DenseBase::rowwise() */ template<typename BinaryOp> @@ -365,7 +365,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp * * \warning the size along the reduction direction must be strictly positive, * otherwise an assertion is triggered. - * + * * \warning the result is undefined if \c *this contains NaN. * * Example: \include PartialRedux_minCoeff.cpp @@ -384,7 +384,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp * * \warning the size along the reduction direction must be strictly positive, * otherwise an assertion is triggered. - * + * * \warning the result is undefined if \c *this contains NaN. * * Example: \include PartialRedux_maxCoeff.cpp |