Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
DenseMatrix/Morpheus_Copy_Impl.hpp
1
24#ifndef MORPHEUS_DENSEMATRIX_COPY_IMPL_HPP
25#define MORPHEUS_DENSEMATRIX_COPY_IMPL_HPP
26
27#include <Morpheus_FormatTags.hpp>
28
29#include <impl/Morpheus_Utils.hpp>
30#include <Kokkos_Core.hpp>
31
32namespace Morpheus {
33namespace Impl {
34
35template <typename SourceType, typename DestinationType>
36void copy(const SourceType& src, DestinationType& dst,
37 typename std::enable_if_t<
38 Morpheus::is_dense_matrix_format_container_v<SourceType> &&
39 Morpheus::is_dense_matrix_format_container_v<DestinationType>>* =
40 nullptr) {
41 MORPHEUS_ASSERT(
42 (dst.nrows() == src.nrows()) && (dst.ncols() == src.ncols()),
43 "Destination matrix must have equal shape to the source matrix");
44
45 // Kokkos has src and dst the other way round
46 Kokkos::deep_copy(dst.view(), src.const_view());
47}
48
49} // namespace Impl
50} // namespace Morpheus
51
52#endif // MORPHEUS_DENSEMATRIX_COPY_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24