Skip to content

Commit

Permalink
MRA: fix key iteration
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Schuchart <[email protected]>
  • Loading branch information
devreal committed Sep 5, 2024
1 parent f3571ad commit 4928703
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions examples/madness/mra-device/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,11 @@ namespace mra {
}

/// Used by iterator to increment child translation
SCOPE void next_child(size_t bits) {
SCOPE void next_child(size_t& bits) {
size_t oldbits = bits++;
for (Dimension d = 0; d < NDIM; ++d) {
l[d] += get_bit(bits, d) - get_bit(oldbits,d);
}
rehash();
}

/// Map translation to child index in parent which is formed from binary code (bits)
Expand Down Expand Up @@ -183,19 +182,19 @@ namespace mra {
return Key<3>(n+1, {(l[0]<<1)+1,(l[1]<<1)+1,(l[2]<<1)+1});
}

template <> inline SCOPE void Key<1>::next_child(size_t bits) {
template <> inline SCOPE void Key<1>::next_child(size_t& bits) {
bits++; l[0]++;
rehash();
}

template <> inline SCOPE void Key<2>::next_child(size_t bits) {
template <> inline SCOPE void Key<2>::next_child(size_t& bits) {
size_t oldbits = bits++;
l[0] += (bits&0x1) - (oldbits&0x1);
l[1] += ((bits&0x2)>>1) - ((oldbits&0x2)>>1);
rehash();
}

template <> inline SCOPE void Key<3>::next_child(size_t bits) {
template <> inline SCOPE void Key<3>::next_child(size_t& bits) {
size_t oldbits = bits++;
l[0] += (bits&0x1) - (oldbits&0x1);
l[1] += ((bits&0x2)>>1) - ((oldbits&0x2)>>1);
Expand Down
2 changes: 1 addition & 1 deletion examples/madness/mra-device/mrattg-device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void test(std::size_t K) {
auto printer2 = make_printer(compress_result, "compressed ", false);
auto printer3 = make_printer(reconstruct_result,"reconstructed", false);

auto connected = make_graph_executable(project.get());
auto connected = make_graph_executable(start.get());
assert(connected);

std::chrono::time_point<std::chrono::high_resolution_clock> beg, end;
Expand Down

0 comments on commit 4928703

Please sign in to comment.