diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-08-01 16:26:57 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-08-01 16:26:57 +0200 |
commit | ddf775363147fc7ee778b42c21b642f085193f55 (patch) | |
tree | dc08320f7a4dd5812599a84f0c8fa2c31a70e210 /Eigen/src/Core/Swap.h | |
parent | 55b57fcba6e56bea5c084cc756b50a447985e5c2 (diff) |
Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits
Diffstat (limited to 'Eigen/src/Core/Swap.h')
-rw-r--r-- | Eigen/src/Core/Swap.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index bf58bd599..d602fba65 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -33,11 +33,16 @@ template<typename ExpressionType> class SwapWrapper EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper) typedef typename internal::packet_traits<Scalar>::type Packet; + EIGEN_DEVICE_FUNC inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {} + 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(); } typedef typename internal::conditional< @@ -46,30 +51,37 @@ template<typename ExpressionType> class SwapWrapper const Scalar >::type ScalarWithConstIfNotLvalue; + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) { return m_expression.const_cast_derived().coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { return m_expression.const_cast_derived().coeffRef(index); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) const { return m_expression.coeffRef(index); } template<typename OtherDerived> + EIGEN_DEVICE_FUNC void copyCoeff(Index rowId, Index colId, const DenseBase<OtherDerived>& other) { OtherDerived& _other = other.const_cast_derived(); @@ -81,6 +93,7 @@ template<typename ExpressionType> class SwapWrapper } template<typename OtherDerived> + EIGEN_DEVICE_FUNC void copyCoeff(Index index, const DenseBase<OtherDerived>& other) { OtherDerived& _other = other.const_cast_derived(); @@ -115,6 +128,7 @@ template<typename ExpressionType> class SwapWrapper _other.template writePacket<LoadMode>(index, tmp); } + EIGEN_DEVICE_FUNC ExpressionType& expression() const { return m_expression; } protected: |