Go to the documentation of this file.
22 #ifndef TILEDARRAY_RETILE_H
23 #define TILEDARRAY_RETILE_H
41 template <
typename TileType,
typename PolicyType>
46 auto tensor_rank = tensor.
trange().rank();
47 assert((
rank == tensor_rank) &&
"TiledRanges are of different ranks");
51 [&](std::size_t target_dim) -> std::tuple<std::string, std::string> {
52 std::ostringstream
final, switcher;
53 switcher <<
"i" << target_dim <<
",iX";
54 if (target_dim == 0) {
59 for (
unsigned int d = 1; d <
rank; ++d) {
60 if (d == target_dim) {
66 return {
final.str(), switcher.str()};
72 tensor_type output_tensor;
73 for (
auto i = 0; i <
rank; ++i) {
74 if (i == 0) { output_tensor(start) = tensor(start); }
75 if (new_trange.
dim(i) != tensor.
trange().dim(i)) {
78 auto identity = diagonal_array<tensor_type>(tensor.
world(), retiler);
81 auto [finish, change] = annotations(i);
84 output_tensor(finish) = output_tensor(start) *
identity(change);
94 #endif // TILEDARRAY_RETILE_H
std::string dummy_annotation(unsigned int n_outer_size, unsigned int n_inner_size=0)
const TiledRange1 & dim(std::size_t d) const
Accessor of the tiled range for one of the dimensions.
auto rank(const DistArray< Tile, Policy > &a)
std::size_t rank() const
The rank accessor.
Range data of a tiled array.
const trange_type & trange() const
Tiled range accessor.
World & world() const
World accessor.
auto retile(const DistArray< TileType, PolicyType > &tensor, const TiledRange &new_trange)
T identity()
identity for group of objects of type T