diff options
Diffstat (limited to 'Eigen/src/Core/DenseBase.h')
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 62c73f1a9..12780354b 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -172,6 +172,7 @@ template<typename Derived> class DenseBase /** \returns the number of nonzero coefficients which is in practice the number * of stored coefficients. */ + EIGEN_DEVICE_FUNC inline Index nonZeros() const { return size(); } /** \returns true if either the number of rows or the number of columns is equal to 1. * In other words, this function returns @@ -183,6 +184,7 @@ template<typename Derived> class DenseBase * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a * column-major matrix, and the number of rows for a row-major matrix. */ + EIGEN_DEVICE_FUNC Index outerSize() const { return IsVectorAtCompileTime ? 1 @@ -194,6 +196,7 @@ template<typename Derived> class DenseBase * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a * column-major matrix, and the number of columns for a row-major matrix. */ + EIGEN_DEVICE_FUNC Index innerSize() const { return IsVectorAtCompileTime ? this->size() @@ -204,6 +207,7 @@ template<typename Derived> class DenseBase * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ + EIGEN_DEVICE_FUNC void resize(Index newSize) { EIGEN_ONLY_USED_FOR_DEBUG(newSize); @@ -214,6 +218,7 @@ template<typename Derived> class DenseBase * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ + EIGEN_DEVICE_FUNC void resize(Index nbRows, Index nbCols) { EIGEN_ONLY_USED_FOR_DEBUG(nbRows); @@ -237,42 +242,54 @@ template<typename Derived> class DenseBase /** Copies \a other into *this. \returns a reference to *this. */ template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator=(const DenseBase<OtherDerived>& other); /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC Derived& operator=(const DenseBase& other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase<OtherDerived> &other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator+=(const EigenBase<OtherDerived> &other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator-=(const EigenBase<OtherDerived> &other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue<OtherDerived>& func); #ifndef EIGEN_PARSED_BY_DOXYGEN /** Copies \a other into *this without evaluating other. \returns a reference to *this. */ template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& lazyAssign(const DenseBase<OtherDerived>& other); #endif // not EIGEN_PARSED_BY_DOXYGEN + EIGEN_DEVICE_FUNC CommaInitializer<Derived> operator<< (const Scalar& s); template<unsigned int Added,unsigned int Removed> const Flagged<Derived, Added, Removed> flagged() const; template<typename OtherDerived> + EIGEN_DEVICE_FUNC CommaInitializer<Derived> operator<< (const DenseBase<OtherDerived>& other); + EIGEN_DEVICE_FUNC Eigen::Transpose<Derived> transpose(); typedef const Transpose<const Derived> ConstTransposeReturnType; + EIGEN_DEVICE_FUNC ConstTransposeReturnType transpose() const; + EIGEN_DEVICE_FUNC void transposeInPlace(); #ifndef EIGEN_NO_DEBUG protected: @@ -346,6 +363,7 @@ template<typename Derived> class DenseBase * Notice that in the case of a plain matrix or vector (not an expression) this function just returns * a const reference, in order to avoid a useless copy. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvalReturnType eval() const { // Even though MSVC does not honor strong inlining when the return type @@ -380,14 +398,14 @@ template<typename Derived> class DenseBase template<bool Enable> inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf() const; template<bool Enable> inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf(); - Scalar sum() const; - Scalar mean() const; - Scalar trace() const; + EIGEN_DEVICE_FUNC Scalar sum() const; + EIGEN_DEVICE_FUNC Scalar mean() const; + EIGEN_DEVICE_FUNC Scalar trace() const; - Scalar prod() const; + EIGEN_DEVICE_FUNC Scalar prod() const; - typename internal::traits<Derived>::Scalar minCoeff() const; - typename internal::traits<Derived>::Scalar maxCoeff() const; + EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const; + EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const; template<typename IndexType> typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const; @@ -399,15 +417,18 @@ template<typename Derived> class DenseBase typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const; template<typename BinaryOp> + EIGEN_DEVICE_FUNC typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type redux(const BinaryOp& func) const; template<typename Visitor> + EIGEN_DEVICE_FUNC void visit(Visitor& func) const; inline const WithFormat<Derived> format(const IOFormat& fmt) const; /** \returns the unique coefficient of a 1x1 expression */ + EIGEN_DEVICE_FUNC CoeffReturnType value() const { EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) @@ -417,8 +438,8 @@ template<typename Derived> class DenseBase /////////// Array module /////////// - bool all(void) const; - bool any(void) const; + bool all() const; + bool any() const; Index count() const; typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType; @@ -480,14 +501,16 @@ template<typename Derived> class DenseBase // disable the use of evalTo for dense objects with a nice compilation error - template<typename Dest> inline void evalTo(Dest& ) const + template<typename Dest> + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& ) const { EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); } protected: /** Default constructor. Do nothing. */ - DenseBase() + EIGEN_DEVICE_FUNC DenseBase() { /* Just checks for self-consistency of the flags. * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down @@ -500,9 +523,9 @@ template<typename Derived> class DenseBase } private: - explicit DenseBase(int); - DenseBase(int,int); - template<typename OtherDerived> explicit DenseBase(const DenseBase<OtherDerived>&); + EIGEN_DEVICE_FUNC explicit DenseBase(int); + EIGEN_DEVICE_FUNC DenseBase(int,int); + template<typename OtherDerived> EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase<OtherDerived>&); }; } // end namespace Eigen |