tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
tatami
utils
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
9
namespace
tatami
{
10
26
template
<
typename
Index_,
class
Function_>
27
void
process_consecutive_indices
(
const
Index_
*
indices
,
Index_
length
,
Function_
fun
) {
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
tatami
Flexible representations for matrix data.
Definition
Extractor.hpp:15
tatami::process_consecutive_indices
void process_consecutive_indices(const Index_ *indices, Index_ length, Function_ fun)
Definition
process_consecutive_indices.hpp:27
tatami::consecutive_extractor
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition
consecutive_extractor.hpp:35
Generated by
1.9.8