diff options
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/ArrayBase.h | 12 | ||||
-rw-r--r-- | Eigen/src/Core/ArrayWrapper.h | 33 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseBinaryOp.h | 1 | ||||
-rw-r--r-- | Eigen/src/Core/Diagonal.h | 18 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalMatrix.h | 33 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 20 | ||||
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseBinaryOps.h | 11 | ||||
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseUnaryOps.h | 1 |
8 files changed, 126 insertions, 3 deletions
diff --git a/Eigen/src/Core/ArrayBase.h b/Eigen/src/Core/ArrayBase.h index 38852600d..9c6daf4fe 100644 --- a/Eigen/src/Core/ArrayBase.h +++ b/Eigen/src/Core/ArrayBase.h @@ -118,40 +118,52 @@ template<typename Derived> class ArrayBase /** 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 ArrayBase& other) { return internal::assign_selector<Derived,Derived>::run(derived(), other.derived()); } + EIGEN_DEVICE_FUNC Derived& operator+=(const Scalar& scalar) { return *this = derived() + scalar; } + EIGEN_DEVICE_FUNC Derived& operator-=(const Scalar& scalar) { return *this = derived() - scalar; } template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator+=(const ArrayBase<OtherDerived>& other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator-=(const ArrayBase<OtherDerived>& other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator*=(const ArrayBase<OtherDerived>& other); template<typename OtherDerived> + EIGEN_DEVICE_FUNC Derived& operator/=(const ArrayBase<OtherDerived>& other); public: + EIGEN_DEVICE_FUNC ArrayBase<Derived>& array() { return *this; } + EIGEN_DEVICE_FUNC const ArrayBase<Derived>& array() const { return *this; } /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array * \sa MatrixBase::array() */ + EIGEN_DEVICE_FUNC MatrixWrapper<Derived> matrix() { return derived(); } + EIGEN_DEVICE_FUNC const MatrixWrapper<const Derived> matrix() const { return derived(); } // template<typename Dest> // inline void evalTo(Dest& dst) const { dst = matrix(); } protected: + EIGEN_DEVICE_FUNC ArrayBase() : Base() {} private: diff --git a/Eigen/src/Core/ArrayWrapper.h b/Eigen/src/Core/ArrayWrapper.h index a791bc358..21830745b 100644 --- a/Eigen/src/Core/ArrayWrapper.h +++ b/Eigen/src/Core/ArrayWrapper.h @@ -48,41 +48,54 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > typedef typename internal::nested<ExpressionType>::type NestedExpressionType; + EIGEN_DEVICE_FUNC inline ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} + EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index rowId, Index colId) const { return m_expression.coeff(rowId, colId); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) { return m_expression.const_cast_derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.const_cast_derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index index) const { return m_expression.coeff(index); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { return m_expression.const_cast_derived().coeffRef(index); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { return m_expression.const_cast_derived().coeffRef(index); @@ -113,9 +126,11 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > } template<typename Dest> + EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { dst = m_expression; } const typename internal::remove_all<NestedExpressionType>::type& + EIGEN_DEVICE_FUNC nestedExpression() const { return m_expression; @@ -123,9 +138,11 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC void resize(Index newSize) { m_expression.const_cast_derived().resize(newSize); } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC void resize(Index nbRows, Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); } protected: @@ -168,41 +185,54 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > typedef typename internal::nested<ExpressionType>::type NestedExpressionType; + EIGEN_DEVICE_FUNC inline MatrixWrapper(ExpressionType& a_matrix) : m_expression(a_matrix) {} + EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index rowId, Index colId) const { return m_expression.coeff(rowId, colId); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) { return m_expression.const_cast_derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index index) const { return m_expression.coeff(index); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { return m_expression.const_cast_derived().coeffRef(index); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { return m_expression.const_cast_derived().coeffRef(index); @@ -232,6 +262,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > m_expression.const_cast_derived().template writePacket<LoadMode>(index, val); } + EIGEN_DEVICE_FUNC const typename internal::remove_all<NestedExpressionType>::type& nestedExpression() const { @@ -240,9 +271,11 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC void resize(Index newSize) { m_expression.const_cast_derived().resize(newSize); } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC void resize(Index nbRows, Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); } protected: diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index e603fb9d6..e20daacc8 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -235,3 +235,4 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) } // end namespace Eigen #endif // EIGEN_CWISE_BINARY_OP_H + diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index aab8007b3..4436c6a69 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h @@ -70,20 +70,25 @@ template<typename MatrixType, int _DiagIndex> class Diagonal typedef typename internal::dense_xpr_base<Diagonal>::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) + EIGEN_DEVICE_FUNC inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + EIGEN_DEVICE_FUNC inline Index rows() const { return m_index.value()<0 ? (std::min<Index>)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min<Index>)(m_matrix.rows(),m_matrix.cols()-m_index.value()); } + EIGEN_DEVICE_FUNC inline Index cols() const { return 1; } + EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_matrix.outerStride() + 1; } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return 0; @@ -95,47 +100,57 @@ template<typename MatrixType, int _DiagIndex> class Diagonal const Scalar >::type ScalarWithConstIfNotLvalue; + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index row, Index) const { return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index row, Index) const { return m_matrix.coeff(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index idx) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index idx) const { return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index idx) const { return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); } + EIGEN_DEVICE_FUNC const typename internal::remove_all<typename MatrixType::Nested>::type& nestedExpression() const { return m_matrix; } + EIGEN_DEVICE_FUNC int index() const { return m_index.value(); @@ -147,8 +162,11 @@ template<typename MatrixType, int _DiagIndex> class Diagonal private: // some compilers may fail to optimize std::max etc in case of compile-time constants... + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } // triger a compile time error is someone try to call packet template<int LoadMode> typename MatrixType::PacketReturnType packet(Index) const; diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index e6c220f41..f7ac22f8b 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -37,45 +37,59 @@ class DiagonalBase : public EigenBase<Derived> typedef DenseMatrixType DenseType; typedef DiagonalMatrix<Scalar,DiagonalVectorType::SizeAtCompileTime,DiagonalVectorType::MaxSizeAtCompileTime> PlainObject; + EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast<const Derived*>(this); } + EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast<Derived*>(this); } + EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const { return derived(); } template<typename DenseDerived> + EIGEN_DEVICE_FUNC void evalTo(MatrixBase<DenseDerived> &other) const; template<typename DenseDerived> + EIGEN_DEVICE_FUNC void addTo(MatrixBase<DenseDerived> &other) const { other.diagonal() += diagonal(); } template<typename DenseDerived> + EIGEN_DEVICE_FUNC void subTo(MatrixBase<DenseDerived> &other) const { other.diagonal() -= diagonal(); } + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + EIGEN_DEVICE_FUNC inline Index rows() const { return diagonal().size(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return diagonal().size(); } /** \returns the diagonal matrix product of \c *this by the matrix \a matrix. */ template<typename MatrixDerived> + EIGEN_DEVICE_FUNC const DiagonalProduct<MatrixDerived, Derived, OnTheLeft> operator*(const MatrixBase<MatrixDerived> &matrix) const { return DiagonalProduct<MatrixDerived, Derived, OnTheLeft>(matrix.derived(), derived()); } + EIGEN_DEVICE_FUNC inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> > inverse() const { return diagonal().cwiseInverse(); } + EIGEN_DEVICE_FUNC inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const DiagonalVectorType> > operator*(const Scalar& scalar) const { return diagonal() * scalar; } + EIGEN_DEVICE_FUNC friend inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const DiagonalVectorType> > operator*(const Scalar& scalar, const DiagonalBase& other) { @@ -84,11 +98,13 @@ class DiagonalBase : public EigenBase<Derived> #ifdef EIGEN2_SUPPORT template<typename OtherDerived> + EIGEN_DEVICE_FUNC bool isApprox(const DiagonalBase<OtherDerived>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const { return diagonal().isApprox(other.diagonal(), precision); } template<typename OtherDerived> + EIGEN_DEVICE_FUNC bool isApprox(const MatrixBase<OtherDerived>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const { return toDenseMatrix().isApprox(other, precision); @@ -151,24 +167,31 @@ class DiagonalMatrix public: /** const version of diagonal(). */ + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return m_diagonal; } /** \returns a reference to the stored vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return m_diagonal; } /** Default constructor without initialization */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix() {} /** Constructs a diagonal matrix with given dimension */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} /** 2D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} /** 3D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} /** Copy constructor. */ template<typename OtherDerived> + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const DiagonalBase<OtherDerived>& other) : m_diagonal(other.diagonal()) {} #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -178,11 +201,13 @@ class DiagonalMatrix /** generic constructor from expression of the diagonal coefficients */ template<typename OtherDerived> + EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(const MatrixBase<OtherDerived>& other) : m_diagonal(other) {} /** Copy operator. */ template<typename OtherDerived> + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalBase<OtherDerived>& other) { m_diagonal = other.diagonal(); @@ -193,6 +218,7 @@ class DiagonalMatrix /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalMatrix& other) { m_diagonal = other.diagonal(); @@ -201,14 +227,19 @@ class DiagonalMatrix #endif /** Resizes to given size. */ + EIGEN_DEVICE_FUNC inline void resize(Index size) { m_diagonal.resize(size); } /** Sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero() { m_diagonal.setZero(); } /** Resizes and sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero(Index size) { m_diagonal.setZero(size); } /** Sets this matrix to be the identity matrix of the current size. */ + EIGEN_DEVICE_FUNC inline void setIdentity() { m_diagonal.setOnes(); } /** Sets this matrix to be the identity matrix of the given size. */ + EIGEN_DEVICE_FUNC inline void setIdentity(Index size) { m_diagonal.setOnes(size); } }; @@ -255,9 +286,11 @@ class DiagonalWrapper #endif /** Constructor from expression of diagonal coefficients to wrap. */ + EIGEN_DEVICE_FUNC inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + EIGEN_DEVICE_FUNC const DiagonalVectorType& diagonal() const { return m_diagonal; } protected: diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index eed10de2d..8b8a868b7 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -98,6 +98,7 @@ template<typename Derived> class MatrixBase /** \returns the size of the main diagonal, which is min(rows(),cols()). * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC inline Index diagonalSize() const { return (std::min)(rows(),cols()); } /** \brief The plain matrix type corresponding to this expression. @@ -206,6 +207,7 @@ template<typename Derived> class MatrixBase void applyOnTheRight(const EigenBase<OtherDerived>& other); template<typename DiagonalDerived> + EIGEN_DEVICE_FUNC const DiagonalProduct<Derived, DiagonalDerived, OnTheRight> operator*(const DiagonalBase<DiagonalDerived> &diagonal) const; @@ -231,15 +233,23 @@ template<typename Derived> class MatrixBase EIGEN_DEVICE_FUNC void adjointInPlace(); typedef Diagonal<Derived> DiagonalReturnType; + EIGEN_DEVICE_FUNC DiagonalReturnType diagonal(); - typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType; + + typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType; + EIGEN_DEVICE_FUNC ConstDiagonalReturnType diagonal() const; template<int Index> struct DiagonalIndexReturnType { typedef Diagonal<Derived,Index> Type; }; template<int Index> struct ConstDiagonalIndexReturnType { typedef const Diagonal<const Derived,Index> Type; }; - template<int Index> typename DiagonalIndexReturnType<Index>::Type diagonal(); - template<int Index> typename ConstDiagonalIndexReturnType<Index>::Type diagonal() const; + template<int Index> + EIGEN_DEVICE_FUNC + typename DiagonalIndexReturnType<Index>::Type diagonal(); + + template<int Index> + EIGEN_DEVICE_FUNC + typename ConstDiagonalIndexReturnType<Index>::Type diagonal() const; // Note: The "MatrixBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. // On the other hand they confuse MSVC8... @@ -247,7 +257,10 @@ template<typename Derived> class MatrixBase typename MatrixBase::template DiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index); typename MatrixBase::template ConstDiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index) const; #else + EIGEN_DEVICE_FUNC typename DiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index); + + EIGEN_DEVICE_FUNC typename ConstDiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index) const; #endif @@ -285,6 +298,7 @@ template<typename Derived> class MatrixBase static const BasisReturnType UnitZ(); static const BasisReturnType UnitW(); + EIGEN_DEVICE_FUNC const DiagonalWrapper<const Derived> asDiagonal() const; const PermutationWrapper<const Derived> asPermutation() const; diff --git a/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/Eigen/src/plugins/ArrayCwiseBinaryOps.h index 5c8c476ee..2a77fd956 100644 --- a/Eigen/src/plugins/ArrayCwiseBinaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseBinaryOps.h @@ -3,6 +3,7 @@ * \sa MatrixBase::cwiseProduct */ template<typename OtherDerived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived) operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const { @@ -14,6 +15,7 @@ operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const * \sa MatrixBase::cwiseQuotient */ template<typename OtherDerived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived> operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const { @@ -33,6 +35,7 @@ EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op) * * \sa max() */ +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > #ifdef EIGEN_PARSED_BY_DOXYGEN @@ -58,6 +61,7 @@ EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op) * * \sa min() */ +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > #ifdef EIGEN_PARSED_BY_DOXYGEN @@ -143,12 +147,14 @@ EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to) * * \sa operator+=(), operator-() */ +EIGEN_DEVICE_FUNC inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> operator+(const Scalar& scalar) const { return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar)); } +EIGEN_DEVICE_FUNC friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other) { @@ -162,12 +168,14 @@ operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& * * \sa operator+(), operator-=() */ +EIGEN_DEVICE_FUNC inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> operator-(const Scalar& scalar) const { return *this + (-scalar); } +EIGEN_DEVICE_FUNC friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> > operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other) { @@ -184,6 +192,7 @@ operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& * \sa operator||(), select() */ template<typename OtherDerived> +EIGEN_DEVICE_FUNC inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived> operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const { @@ -202,6 +211,7 @@ operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const * \sa operator&&(), select() */ template<typename OtherDerived> +EIGEN_DEVICE_FUNC inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived> operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const { @@ -209,3 +219,4 @@ operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); return CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>(derived(),other.derived()); } + diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index afb0fb6e3..71a7d4185 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -201,6 +201,7 @@ cube() const } #define EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(METHOD_NAME,FUNCTOR) \ + EIGEN_DEVICE_FUNC \ inline const CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \ METHOD_NAME(const Scalar& s) const { \ return CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \ |