26 #ifndef TILEDARRAY_CONVERSIONS_SPARSE_TO_DENSE_H__INCLUDED
27 #define TILEDARRAY_CONVERSIONS_SPARSE_TO_DENSE_H__INCLUDED
29 #include "../dist_array.h"
33 template <
typename Tile,
typename ResultPolicy = DensePolicy,
35 inline std::enable_if_t<is_dense_v<ResultPolicy> && !is_dense_v<ArgPolicy>,
36 DistArray<Tile, ResultPolicy>>
39 ArrayType dense_array(sparse_array.
world(), sparse_array.
trange());
41 typedef typename ArrayType::pmap_interface pmap_interface;
42 std::shared_ptr<pmap_interface>
const& pmap = dense_array.pmap();
44 typename pmap_interface::const_iterator end = pmap->end();
47 for (
typename pmap_interface::const_iterator it = pmap->begin(); it != end;
49 const std::size_t ord = *it;
50 if (!sparse_array.
is_zero(ord)) {
52 Tile tile(sparse_array.
find(ord).get().clone());
53 dense_array.set(ord, tile);
56 dense_array.set(ord, 0);
64 template <
typename Tile,
typename Policy>
72 #endif // TILEDARRAY_CONVERSIONS_SPARSE_TO_DENSE_H__INCLUDED