... | ... |
@@ -12,6 +12,32 @@ |
12 | 12 |
static std::vector< std::vector<unsigned> > sampleIndices(unsigned n, unsigned nSets) |
13 | 13 |
{ |
14 | 14 |
// TODO implement |
15 |
+ std::vector< std::vector<unsigned> > sampleIndices; |
|
16 |
+ unsigned count = 1; |
|
17 |
+ |
|
18 |
+ for (unsigned i = 0; i < (n - 1) % nSets; ++i) |
|
19 |
+ { |
|
20 |
+ std::vector<unsigned> set; |
|
21 |
+ for (unsigned i = 0; i < ((unsigned) (n - 1) / nSets) + 1; ++i) |
|
22 |
+ { |
|
23 |
+ set.push_back(count); |
|
24 |
+ ++count; |
|
25 |
+ } |
|
26 |
+ sampleIndices.push_back(set); |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ for (unsigned i = (n - 1) % nSets; i < nSets; ++i) |
|
30 |
+ { |
|
31 |
+ std::vector<unsigned> set; |
|
32 |
+ for (unsigned i = 0; i < (unsigned) (n - 1) / nSets; ++i) |
|
33 |
+ { |
|
34 |
+ set.push_back(count); |
|
35 |
+ ++count; |
|
36 |
+ } |
|
37 |
+ sampleIndices.push_back(set); |
|
38 |
+ } |
|
39 |
+ |
|
40 |
+ return sampleIndices; |
|
15 | 41 |
} |
16 | 42 |
|
17 | 43 |
GapsRunner::GapsRunner(const Rcpp::NumericMatrix &D, const Rcpp::NumericMatrix &S, |
... | ... |
@@ -285,4 +311,4 @@ void GapsRunner::makeCheckpointIfNeeded() |
285 | 311 |
createCheckpoint(); |
286 | 312 |
mLastCheckpoint = bpt_now(); |
287 | 313 |
} |
288 |
-} |
|
289 | 314 |
\ No newline at end of file |
315 |
+} |