Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Coo/Morpheus_Copy_Impl.hpp
1
24#ifndef MORPHEUS_COO_COPY_IMPL_HPP
25#define MORPHEUS_COO_COPY_IMPL_HPP
26
27#include <Morpheus_FormatTags.hpp>
28
29#include <impl/Morpheus_Utils.hpp>
30#include <impl/DenseVector/Morpheus_Copy_Impl.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_coo_matrix_format_container_v<SourceType> &&
39 Morpheus::is_coo_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 MORPHEUS_ASSERT(dst.nnnz() == src.nnnz(),
45 "Destination matrix must have equal number of non-zeros to "
46 "the source matrix");
47
48 Morpheus::Impl::copy(src.crow_indices(), dst.row_indices());
49 Morpheus::Impl::copy(src.ccolumn_indices(), dst.column_indices());
50 Morpheus::Impl::copy(src.cvalues(), dst.values());
51}
52
53} // namespace Impl
54} // namespace Morpheus
55
56#endif // MORPHEUS_COO_COPY_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24