diff options
author | Robert Lukierski <robert@lukierski.eu> | 2016-10-12 16:35:17 +0100 |
---|---|---|
committer | Robert Lukierski <robert@lukierski.eu> | 2016-10-12 16:35:17 +0100 |
commit | 86711497c4584534793b186fb0c72f8002a9fe86 (patch) | |
tree | 72fee16848d0159b874da3f8d807ab1235ace432 /Eigen/src/Core | |
parent | 7f0599b6eb45c8a1a1aae9db32408d64eb7f5d45 (diff) |
Adding EIGEN_DEVICE_FUNC in the Geometry module.
Additional CUDA necessary fixes in the Core (mostly usage of
EIGEN_USING_STD_MATH).
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/AssignEvaluator.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseNullaryOp.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalMatrix.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/PlainObjectBase.h | 10 | ||||
-rw-r--r-- | Eigen/src/Core/TriangularMatrix.h | 13 | ||||
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/functors/BinaryFunctors.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/functors/UnaryFunctors.h | 2 |
9 files changed, 26 insertions, 15 deletions
diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index b7cc7c0e9..30b36be11 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -517,6 +517,7 @@ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling> { EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) { + EIGEN_USING_STD_MATH(min) typedef typename Kernel::Scalar Scalar; typedef typename Kernel::PacketType PacketType; enum { @@ -554,7 +555,7 @@ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling> for(Index inner = alignedEnd; inner<innerSize ; ++inner) kernel.assignCoeffByOuterInner(outer, inner); - alignedStart = std::min<Index>((alignedStart+alignedStep)%packetSize, innerSize); + alignedStart = min((Index)(alignedStart+alignedStep)%packetSize, (Index)innerSize); } } }; diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 25c3ef3d7..4ab32d430 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -752,7 +752,8 @@ struct setIdentity_impl<Derived, true> static EIGEN_STRONG_INLINE Derived& run(Derived& m) { m.setZero(); - const Index size = (std::min)(m.rows(), m.cols()); + EIGEN_USING_STD_MATH(min) + const Index size = min(m.rows(), m.cols()); for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); return m; } diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 92b2eee71..f04facecc 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -290,7 +290,7 @@ MatrixBase<Derived>::asDiagonal() const template<typename Derived> bool MatrixBase<Derived>::isDiagonal(const RealScalar& prec) const { - using std::abs; + EIGEN_USING_STD_MATH(abs) if(cols() != rows()) return false; RealScalar maxAbsOnDiagonal = static_cast<RealScalar>(-1); for(Index j = 0; j < cols(); ++j) diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index d56df8249..f7cf04cde 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -399,12 +399,14 @@ template<typename Derived> class MatrixBase EIGEN_DEVICE_FUNC inline PlainObject unitOrthogonal(void) const; + EIGEN_DEVICE_FUNC inline Matrix<Scalar,3,1> eulerAngles(Index a0, Index a1, Index a2) const; // put this as separate enum value to work around possible GCC 4.3 bug (?) enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1&&RowsAtCompileTime==1 ? ((internal::traits<Derived>::Flags&RowMajorBit)==RowMajorBit ? Horizontal : Vertical) : ColsAtCompileTime==1 ? Vertical : Horizontal }; typedef Homogeneous<Derived, HomogeneousReturnTypeDirection> HomogeneousReturnType; + EIGEN_DEVICE_FUNC inline HomogeneousReturnType homogeneous() const; enum { @@ -414,7 +416,7 @@ template<typename Derived> class MatrixBase internal::traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1, internal::traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType; - + EIGEN_DEVICE_FUNC inline const HNormalizedReturnType hnormalized() const; ////////// Householder module /////////// diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 55b4ac057..00313920c 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -916,8 +916,9 @@ struct conservative_resize_like_impl { // The storage order does not allow us to use reallocation. typename Derived::PlainObject tmp(rows,cols); - const Index common_rows = (std::min)(rows, _this.rows()); - const Index common_cols = (std::min)(cols, _this.cols()); + EIGEN_USING_STD_MATH(min) + const Index common_rows = min(rows, _this.rows()); + const Index common_cols = min(cols, _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } @@ -950,8 +951,9 @@ struct conservative_resize_like_impl { // The storage order does not allow us to use reallocation. typename Derived::PlainObject tmp(other); - const Index common_rows = (std::min)(tmp.rows(), _this.rows()); - const Index common_cols = (std::min)(tmp.cols(), _this.cols()); + EIGEN_USING_STD_MATH(min) + const Index common_rows = min(tmp.rows(), _this.rows()); + const Index common_cols = min(tmp.cols(), _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index e9606ec33..e804cf6bb 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -641,11 +641,12 @@ MatrixBase<Derived>::triangularView() const template<typename Derived> bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const { - using std::abs; + EIGEN_USING_STD_MATH(abs) RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1); + EIGEN_USING_STD_MATH(min) for(Index j = 0; j < cols(); ++j) { - Index maxi = (std::min)(j, rows()-1); + Index maxi = min(j, rows()-1); for(Index i = 0; i <= maxi; ++i) { RealScalar absValue = abs(coeff(i,j)); @@ -667,7 +668,8 @@ bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const template<typename Derived> bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const { - using std::abs; + EIGEN_USING_STD_MATH(abs) + EIGEN_USING_STD_MATH(min) RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1); for(Index j = 0; j < cols(); ++j) for(Index i = j; i < rows(); ++i) @@ -678,7 +680,7 @@ bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const RealScalar threshold = maxAbsOnLowerPart * prec; for(Index j = 1; j < cols(); ++j) { - Index maxi = (std::min)(j, rows()-1); + Index maxi = min(j, rows()-1); for(Index i = 0; i < maxi; ++i) if(abs(coeff(i, j)) > threshold) return false; } @@ -891,9 +893,10 @@ struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite> EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) { + EIGEN_USING_STD_MATH(min) for(Index j = 0; j < kernel.cols(); ++j) { - Index maxi = (std::min)(j, kernel.rows()); + Index maxi = min(j, kernel.rows()); Index i = 0; if (((Mode&Lower) && SetOpposite) || (Mode&Upper)) { diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index dd382e990..14f403594 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -625,6 +625,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /////////// Geometry module /////////// typedef Homogeneous<ExpressionType,Direction> HomogeneousReturnType; + EIGEN_DEVICE_FUNC HomogeneousReturnType homogeneous() const; typedef typename ExpressionType::PlainObject CrossReturnType; @@ -654,6 +655,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp Direction==Horizontal ? HNormalized_SizeMinusOne : 1> > HNormalizedReturnType; + EIGEN_DEVICE_FUNC const HNormalizedReturnType hnormalized() const; protected: diff --git a/Eigen/src/Core/functors/BinaryFunctors.h b/Eigen/src/Core/functors/BinaryFunctors.h index d82ffed02..96747bac7 100644 --- a/Eigen/src/Core/functors/BinaryFunctors.h +++ b/Eigen/src/Core/functors/BinaryFunctors.h @@ -266,7 +266,7 @@ struct scalar_hypot_op<Scalar,Scalar> : binary_op_base<Scalar,Scalar> // typedef typename NumTraits<Scalar>::Real result_type; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const { - using std::sqrt; + EIGEN_USING_STD_MATH(sqrt) Scalar p, qp; if(_x>_y) { diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 2009f8e57..2e6a00ffd 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h @@ -321,7 +321,7 @@ struct functor_traits<scalar_log1p_op<Scalar> > { */ template<typename Scalar> struct scalar_log10_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_log10_op) - EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { using std::log10; return log10(a); } + EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { EIGEN_USING_STD_MATH(log10) return log10(a); } template <typename Packet> EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog10(a); } }; |