Fix the missing CUDA device qualifier

This commit is contained in:
xsjk 2024-12-28 15:17:55 +00:00 committed by Antonio Sánchez
parent 24e0c2a125
commit 7bb8c58e7c
2 changed files with 13 additions and 7 deletions

View File

@ -389,8 +389,9 @@ struct AssignmentKind<DenseShape, DiagonalShape> {
// Diagonal matrix to Dense assignment
template <typename DstXprType, typename SrcXprType, typename Functor>
struct Assignment<DstXprType, SrcXprType, Functor, Diagonal2Dense> {
static void run(DstXprType& dst, const SrcXprType& src,
const internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*func*/) {
static EIGEN_DEVICE_FUNC void run(
DstXprType& dst, const SrcXprType& src,
const internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*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<DstXprType, SrcXprType, Functor, Diagonal2Dense> {
dst.diagonal() = src.diagonal();
}
static void run(DstXprType& dst, const SrcXprType& src,
const internal::add_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*func*/) {
static EIGEN_DEVICE_FUNC void run(
DstXprType& dst, const SrcXprType& src,
const internal::add_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*func*/) {
dst.diagonal() += src.diagonal();
}
static void run(DstXprType& dst, const SrcXprType& src,
const internal::sub_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*func*/) {
static EIGEN_DEVICE_FUNC void run(
DstXprType& dst, const SrcXprType& src,
const internal::sub_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>& /*func*/) {
dst.diagonal() -= src.diagonal();
}
};

View File

@ -525,7 +525,10 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
eigen_assert(list_size == static_cast<size_t>(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<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);