tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
process_consecutive_indices.hpp
Go to the documentation of this file.
1#ifndef TATAMI_PROCESS_CONSECUTIVE_INDICES_HPP
2#define TATAMI_PROCESS_CONSECUTIVE_INDICES_HPP
3
9namespace tatami {
10
26template<typename Index_, class Function_>
28 if (length > 0) {
29 Index_ start = indices[0], last = start + 1;
30 for (Index_ i = 1; i < length; ++i) {
31 if (indices[i] > last) {
32 fun(start, last - start);
33 start = indices[i];
34 }
35 last = indices[i] + 1;
36 }
37 fun(start, last - start);
38 }
39}
40
41}
42
43#endif
Flexible representations for matrix data.
Definition Extractor.hpp:15
void process_consecutive_indices(const Index_ *indices, Index_ length, Function_ fun)
Definition process_consecutive_indices.hpp:27
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition consecutive_extractor.hpp:35