diff options
Diffstat (limited to 'Eigen/src/Core/EigenBase.h')
-rw-r--r-- | Eigen/src/Core/EigenBase.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/Eigen/src/Core/EigenBase.h b/Eigen/src/Core/EigenBase.h index 2b8dd1b70..a25e823ab 100644 --- a/Eigen/src/Core/EigenBase.h +++ b/Eigen/src/Core/EigenBase.h @@ -31,29 +31,40 @@ template<typename Derived> struct EigenBase typedef typename internal::traits<Derived>::Index Index; /** \returns a reference to the derived object */ + EIGEN_DEVICE_FUNC Derived& derived() { return *static_cast<Derived*>(this); } /** \returns a const reference to the derived object */ + EIGEN_DEVICE_FUNC const Derived& derived() const { return *static_cast<const Derived*>(this); } + EIGEN_DEVICE_FUNC inline Derived& const_cast_derived() const { return *static_cast<Derived*>(const_cast<EigenBase*>(this)); } + EIGEN_DEVICE_FUNC inline const Derived& const_derived() const { return *static_cast<const Derived*>(this); } /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ + EIGEN_DEVICE_FUNC inline Index rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ + EIGEN_DEVICE_FUNC inline Index cols() const { return derived().cols(); } /** \returns the number of coefficients, which is rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC inline Index size() const { return rows() * cols(); } /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ - template<typename Dest> inline void evalTo(Dest& dst) const + template<typename Dest> + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { derived().evalTo(dst); } /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ - template<typename Dest> inline void addTo(Dest& dst) const + template<typename Dest> + EIGEN_DEVICE_FUNC + inline void addTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -63,7 +74,9 @@ template<typename Derived> struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ - template<typename Dest> inline void subTo(Dest& dst) const + template<typename Dest> + EIGEN_DEVICE_FUNC + inline void subTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -73,7 +86,8 @@ template<typename Derived> struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ - template<typename Dest> inline void applyThisOnTheRight(Dest& dst) const + template<typename Dest> + EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -81,7 +95,8 @@ template<typename Derived> struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ - template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const + template<typename Dest> + EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. |