You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to iterate over the mask and do something at the indexes where the mask is set. This is very useful for switching vectorization direction or switching to scalar logic.
It could be extended to:
for (auto x : where(mask, vec)) {
// basically x = vec[i] for all i where mask[i] is true
}
The latter seems less useful. You probably want at least a pair containing the index and the value. But in that case the added convenience compared to the first example is minimal.
The text was updated successfully, but these errors were encountered:
Actually I implemented it as conversion to int (i.e. bits) with subsequent bit scan to find the indices where the mask is true.
This is useful when you need to fall back to scalar processing (maybe for locking, third party calls, ...) or change vectorization direction. E.g. in an LHC code multiple particle tracks through the detector are processed with the Kalman filter. Searching for the next best particle to include in the track requires gathers. Alternatively, I could vectorize the search for a single track. That's where the iteration over remaining active tracks (i.e. mask) is useful.
Vc has this cool feature:
The idea is to iterate over the mask and do something at the indexes where the mask is set. This is very useful for switching vectorization direction or switching to scalar logic.
It could be extended to:
The latter seems less useful. You probably want at least a pair containing the index and the value. But in that case the added convenience compared to the first example is minimal.
The text was updated successfully, but these errors were encountered: