Skip to content

Commit

Permalink
Use back_inserter in permutations to only do one pass over perm_arr/p…
Browse files Browse the repository at this point in the history
…erm_offseted
  • Loading branch information
msimberg committed Aug 7, 2023
1 parent 8843352 commit 5781370
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/dlaf/permutations/general/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,9 @@ void unpackLocalOnCPU(const matrix::Distribution& subm_dist, const matrix::Distr
// at index 1 in mat_recv.
const int a_r = std::accumulate(recv_counts.cbegin(), recv_counts.cbegin() + rank, 0);
const SizeType offset = to_SizeType(a - a_r);
// TODO: back_insert directly into perm_offseted?
std::vector<SizeType> perm_offseted(perm_arr, perm_arr + subm_dist.size().get<C>());
std::transform(perm_offseted.begin(), perm_offseted.end(), perm_offseted.begin(),
std::vector<SizeType> perm_offseted;
perm_offseted.reserve(to_sizet(subm_dist.size().get<C>()));
std::transform(perm_arr, perm_arr + subm_dist.size().get<C>(), std::back_inserter(perm_offseted),
[offset](const SizeType perm) { return perm + offset; });

constexpr auto OC = orthogonal(C);
Expand Down

0 comments on commit 5781370

Please sign in to comment.