aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/products/CoeffBasedProduct.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/products/CoeffBasedProduct.h')
-rw-r--r--Eigen/src/Core/products/CoeffBasedProduct.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/Eigen/src/Core/products/CoeffBasedProduct.h b/Eigen/src/Core/products/CoeffBasedProduct.h
index 403d25fa9..312a05c71 100644
--- a/Eigen/src/Core/products/CoeffBasedProduct.h
+++ b/Eigen/src/Core/products/CoeffBasedProduct.h
@@ -140,11 +140,13 @@ class CoeffBasedProduct
public:
+ EIGEN_DEVICE_FUNC
inline CoeffBasedProduct(const CoeffBasedProduct& other)
: Base(), m_lhs(other.m_lhs), m_rhs(other.m_rhs)
{}
template<typename Lhs, typename Rhs>
+ EIGEN_DEVICE_FUNC
inline CoeffBasedProduct(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{
@@ -157,9 +159,10 @@ class CoeffBasedProduct
&& "if you wanted a coeff-wise or a dot product use the respective explicit functions");
}
- EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
- EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
+ EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
{
Scalar res;
@@ -170,6 +173,7 @@ class CoeffBasedProduct
/* Allow index-based non-packet access. It is impossible though to allow index-based packed access,
* which is why we don't set the LinearAccessBit.
*/
+ EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
{
Scalar res;
@@ -191,22 +195,26 @@ class CoeffBasedProduct
}
// Implicit conversion to the nested type (trigger the evaluation of the product)
+ EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE operator const PlainObject& () const
{
m_result.lazyAssign(*this);
return m_result;
}
- const _LhsNested& lhs() const { return m_lhs; }
- const _RhsNested& rhs() const { return m_rhs; }
+ EIGEN_DEVICE_FUNC const _LhsNested& lhs() const { return m_lhs; }
+ EIGEN_DEVICE_FUNC const _RhsNested& rhs() const { return m_rhs; }
+ EIGEN_DEVICE_FUNC
const Diagonal<const LazyCoeffBasedProductType,0> diagonal() const
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); }
template<int DiagonalIndex>
+ EIGEN_DEVICE_FUNC
const Diagonal<const LazyCoeffBasedProductType,DiagonalIndex> diagonal() const
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); }
+ EIGEN_DEVICE_FUNC
const Diagonal<const LazyCoeffBasedProductType,Dynamic> diagonal(Index index) const
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); }
@@ -239,6 +247,7 @@ template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
struct product_coeff_impl<DefaultTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
+ EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
{
product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
@@ -250,6 +259,7 @@ template<typename Lhs, typename Rhs, typename RetScalar>
struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
+ EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
{
res = lhs.coeff(row, 0) * rhs.coeff(0, col);
@@ -260,6 +270,7 @@ template<typename Lhs, typename Rhs, typename RetScalar>
struct product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
+ EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
{
eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");