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>
34 DistArray<Tile, DensePolicy>
37 ArrayType dense_array(sparse_array.
world(), sparse_array.
trange());
39 typedef typename ArrayType::pmap_interface pmap_interface;
40 std::shared_ptr<pmap_interface>
const& pmap = dense_array.
pmap();
42 typename pmap_interface::const_iterator end = pmap->end();
45 for (
typename pmap_interface::const_iterator it = pmap->begin(); it != end;
47 const std::size_t ord = *it;
48 if (!sparse_array.
is_zero(ord)) {
50 Tile tile(sparse_array.
find(ord).get().clone());
51 dense_array.set(ord, tile);
54 dense_array.set(ord, 0);
62 template <
typename Tile>
63 DistArray<Tile, DensePolicy>
70 #endif // TILEDARRAY_CONVERSIONS_SPARSE_TO_DENSE_H__INCLUDED Future< value_type > find(const Index &i) const
Find local or remote tile.
const trange_type & trange() const
Tiled range accessor.
bool is_zero(const Index &i) const
Check for zero tiles.
DistArray< Tile, DensePolicy > to_dense(DistArray< Tile, SparsePolicy > const &sparse_array)
World & world() const
World accessor.
An N-dimensional shallow copy wrapper for tile objects.
const std::shared_ptr< pmap_interface > & pmap() const
Process map accessor.