-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
698 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include <Rcpp.h> | ||
using namespace Rcpp; | ||
|
||
// [[Rcpp::export]] | ||
NumericVector align_by_target_inner_loop(double t, int idxEvals, int idxTarget, | ||
List data, NumericVector index, NumericMatrix next_lines, NumericVector curr_eval) { | ||
|
||
int N = data.size(); | ||
NumericVector out = clone(curr_eval); | ||
|
||
for (int k = 0; k < N; k++) { | ||
NumericMatrix d = as<NumericMatrix>(data[k]); | ||
int n_row = d.nrow(); | ||
int n_col = d.ncol(); | ||
int iter = index[k]; | ||
|
||
while (true) { | ||
if (next_lines(k, idxTarget) >= t) { | ||
out[k] = next_lines(k, idxEvals); | ||
break; | ||
} | ||
|
||
if (iter < (n_row - 1)) { | ||
iter++; | ||
for (int j = 0; j < n_col; j++) { | ||
next_lines(k, j) = d(iter, j); | ||
} | ||
} else { | ||
break; | ||
} | ||
} | ||
index[k] = iter; | ||
} | ||
return out; | ||
} | ||
|
||
// TODO: verify this function | ||
// [[Rcpp::export]] | ||
void align_by_runtime_inner_loop(int r, int idxEvals, int idxTarget, | ||
List data, NumericVector n_rows, NumericVector index, NumericMatrix next_lines, | ||
NumericVector curr_fvalues) { | ||
|
||
int N = data.size(); | ||
for (int k = 0; k < N; k++) { | ||
NumericMatrix d = as<NumericMatrix>(data[k]); | ||
int n_row = n_rows[k]; | ||
int iter = index[k]; | ||
int n_col = d.ncol(); | ||
|
||
while (!NumericVector::is_na(next_lines(k, idxEvals))) { | ||
if (next_lines(k, idxEvals) > r) { | ||
curr_fvalues[k] = next_lines(k, idxTarget); | ||
break; | ||
} | ||
|
||
if (iter < (n_row - 1)) { | ||
iter++; | ||
for (int j = 0; j < n_col; j++) { | ||
next_lines(k, j) = d(iter, j); | ||
} | ||
} else { | ||
curr_fvalues[k] = next_lines(k, idxTarget); | ||
next_lines(k, idxEvals) = NA_REAL; | ||
} | ||
} | ||
index[k] = iter; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.