diff options
author | 2014-10-30 20:16:16 +0100 | |
---|---|---|
committer | 2014-10-30 20:16:16 +0100 | |
commit | 883168ed94ca2559231861957558a9ded13e4831 (patch) | |
tree | 347dc5bbf3b31353844bcafb6149a5cd974c21e0 | |
parent | e5f134006b431d7d307c8ce7706c5aa1df09895c (diff) |
Make select CUDA compatible (comparison operators aren't yet, so no test case yet)
-rw-r--r-- | Eigen/src/Core/CoreEvaluators.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/Select.h | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 836d25b3b..a0dc72c4d 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -859,7 +859,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> > Flags = (unsigned int)evaluator<ThenMatrixType>::Flags & evaluator<ElseMatrixType>::Flags & HereditaryBits }; - EIGEN_DEVICE_FUNC explicit evaluator(const XprType& select) + inline EIGEN_DEVICE_FUNC explicit evaluator(const XprType& select) : m_conditionImpl(select.conditionMatrix()), m_thenImpl(select.thenMatrix()), m_elseImpl(select.elseMatrix()) @@ -868,7 +868,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> > typedef typename XprType::Index Index; typedef typename XprType::CoeffReturnType CoeffReturnType; - EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const + inline EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const { if (m_conditionImpl.coeff(row, col)) return m_thenImpl.coeff(row, col); @@ -876,7 +876,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> > return m_elseImpl.coeff(row, col); } - EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const + inline EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const { if (m_conditionImpl.coeff(index)) return m_thenImpl.coeff(index); diff --git a/Eigen/src/Core/Select.h b/Eigen/src/Core/Select.h index 0cb85a4ad..0c09a4ff4 100644 --- a/Eigen/src/Core/Select.h +++ b/Eigen/src/Core/Select.h @@ -57,6 +57,7 @@ class Select : internal::no_assignment_operator, typedef typename internal::dense_xpr_base<Select>::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Select) + inline EIGEN_DEVICE_FUNC Select(const ConditionMatrixType& a_conditionMatrix, const ThenMatrixType& a_thenMatrix, const ElseMatrixType& a_elseMatrix) @@ -66,9 +67,10 @@ class Select : internal::no_assignment_operator, eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols()); } - Index rows() const { return m_condition.rows(); } - Index cols() const { return m_condition.cols(); } + inline EIGEN_DEVICE_FUNC Index rows() const { return m_condition.rows(); } + inline EIGEN_DEVICE_FUNC Index cols() const { return m_condition.cols(); } + inline EIGEN_DEVICE_FUNC const Scalar coeff(Index i, Index j) const { if (m_condition.coeff(i,j)) @@ -77,6 +79,7 @@ class Select : internal::no_assignment_operator, return m_else.coeff(i,j); } + inline EIGEN_DEVICE_FUNC const Scalar coeff(Index i) const { if (m_condition.coeff(i)) @@ -85,17 +88,17 @@ class Select : internal::no_assignment_operator, return m_else.coeff(i); } - const ConditionMatrixType& conditionMatrix() const + inline EIGEN_DEVICE_FUNC const ConditionMatrixType& conditionMatrix() const { return m_condition; } - const ThenMatrixType& thenMatrix() const + inline EIGEN_DEVICE_FUNC const ThenMatrixType& thenMatrix() const { return m_then; } - const ElseMatrixType& elseMatrix() const + inline EIGEN_DEVICE_FUNC const ElseMatrixType& elseMatrix() const { return m_else; } |