From 7bb8c58e7c1e8f22a68ddf3d74cd36d81f239f77 Mon Sep 17 00:00:00 2001 From: xsjk Date: Sat, 28 Dec 2024 15:17:55 +0000 Subject: [PATCH] Fix the missing CUDA device qualifier --- Eigen/src/Core/DiagonalMatrix.h | 15 +++++++++------ Eigen/src/Core/PlainObjectBase.h | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 248e4586f..4115b64fe 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -389,8 +389,9 @@ struct AssignmentKind { // Diagonal matrix to Dense assignment template struct Assignment { - static void run(DstXprType& dst, const SrcXprType& src, - const internal::assign_op& /*func*/) { + static EIGEN_DEVICE_FUNC void run( + DstXprType& dst, const SrcXprType& src, + const internal::assign_op& /*func*/) { Index dstRows = src.rows(); Index dstCols = src.cols(); if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols); @@ -399,13 +400,15 @@ struct Assignment { dst.diagonal() = src.diagonal(); } - static void run(DstXprType& dst, const SrcXprType& src, - const internal::add_assign_op& /*func*/) { + static EIGEN_DEVICE_FUNC void run( + DstXprType& dst, const SrcXprType& src, + const internal::add_assign_op& /*func*/) { dst.diagonal() += src.diagonal(); } - static void run(DstXprType& dst, const SrcXprType& src, - const internal::sub_assign_op& /*func*/) { + static EIGEN_DEVICE_FUNC void run( + DstXprType& dst, const SrcXprType& src, + const internal::sub_assign_op& /*func*/) { dst.diagonal() -= src.diagonal(); } }; diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 22f132982..8a5401438 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -525,7 +525,10 @@ class PlainObjectBase : public internal::dense_xpr_base::type eigen_assert(list_size == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); resize(list_size, ColsAtCompileTime); if (list.begin()->begin() != nullptr) { - std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data()); + Index index = 0; + for (const Scalar& e : *list.begin()) { + coeffRef(index++) = e; + } } } else { eigen_assert(list.size() == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);