Skip to content

Iterating all indices of wavemaps #78

Answered by victorreijgwart
PaulKemppi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @PaulKemppi ,

Thanks for the good question! To do what you described, you could use the map interface's forEachLeaf method. It takes a lambda function, which it then calls for each leaf node in the map - passing the node's index and value as arguments. We didn't get to add it to the Python API yet, though, so it's currently only available in C++.

To compare map_a to map_b, you could

  • Instantiate a QueryAccelerator for map_b.
  • Define a comparison lambda auto comparator_fn = ... that captures accelerator_b by reference and expects node_index and node_value_a as arguments. In the lambda, it then uses accelerator_b to look up node_value_b.
  • Dispatch it by calling map_a.forEachLeaf(comparator…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PaulKemppi
Comment options

Answer selected by PaulKemppi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants