Skip to content

Commit

Permalink
remove obsolete C++ function
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Oct 22, 2024
1 parent 2bf7430 commit b736c8f
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 65 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ S3method(pecs,list)
S3method(plot,LearnerSurv)
S3method(plot,TaskDens)
S3method(plot,TaskSurv)
export(.c_get_unique_times)
export(.c_weight_survival_score)
export(.surv_return)
export(LearnerDens)
Expand Down
4 changes: 0 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ c_assert_surv <- function(mat) {
.Call(`_mlr3proba_c_assert_surv`, mat)
}

.c_get_unique_times <- function(true_times, req_times) {
.Call(`_mlr3proba_c_get_unique_times`, true_times, req_times)
}

c_score_intslogloss <- function(truth, unique_times, cdf, eps) {
.Call(`_mlr3proba_c_score_intslogloss`, truth, unique_times, cdf, eps)
}
Expand Down
5 changes: 0 additions & 5 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ NULL
#' @export
NULL

#' @name .c_get_unique_times
#' @rdname cpp
#' @export
NULL

# nolint start
#' @import checkmate
#' @import data.table
Expand Down
1 change: 0 additions & 1 deletion man/cpp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// c_get_unique_times
NumericVector c_get_unique_times(NumericVector true_times, NumericVector req_times);
RcppExport SEXP _mlr3proba_c_get_unique_times(SEXP true_timesSEXP, SEXP req_timesSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< NumericVector >::type true_times(true_timesSEXP);
Rcpp::traits::input_parameter< NumericVector >::type req_times(req_timesSEXP);
rcpp_result_gen = Rcpp::wrap(c_get_unique_times(true_times, req_times));
return rcpp_result_gen;
END_RCPP
}
// c_score_intslogloss
NumericMatrix c_score_intslogloss(const NumericVector& truth, const NumericVector& unique_times, const NumericMatrix& cdf, double eps);
RcppExport SEXP _mlr3proba_c_score_intslogloss(SEXP truthSEXP, SEXP unique_timesSEXP, SEXP cdfSEXP, SEXP epsSEXP) {
Expand Down Expand Up @@ -110,7 +98,6 @@ END_RCPP

static const R_CallMethodDef CallEntries[] = {
{"_mlr3proba_c_assert_surv", (DL_FUNC) &_mlr3proba_c_assert_surv, 1},
{"_mlr3proba_c_get_unique_times", (DL_FUNC) &_mlr3proba_c_get_unique_times, 2},
{"_mlr3proba_c_score_intslogloss", (DL_FUNC) &_mlr3proba_c_score_intslogloss, 4},
{"_mlr3proba_c_score_graf_schmid", (DL_FUNC) &_mlr3proba_c_score_graf_schmid, 4},
{"_mlr3proba_c_weight_survival_score", (DL_FUNC) &_mlr3proba_c_weight_survival_score, 6},
Expand Down
41 changes: 0 additions & 41 deletions src/survival_scores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,6 @@
using namespace Rcpp;
using namespace std;

// This function essentially finds and returns the subset of `true_times` that
// align with the requested times (`req_times`), after cleaning up the invalid
// `req_times` (outside of the `true_times` range or duplicate consecutive elements)
// [[Rcpp::export(.c_get_unique_times)]]
NumericVector c_get_unique_times(NumericVector true_times, NumericVector req_times) {
if (req_times.length() == 0) {
return sort_unique(true_times);
}

std::sort(true_times.begin(), true_times.end());
std::sort(req_times.begin(), req_times.end());

double mintime = true_times(0);
double maxtime = true_times(true_times.length() - 1);

for (int i = 0; i < req_times.length(); i++) {
if (req_times[i] < mintime || req_times[i] > maxtime || ((i > 1) && req_times[i] == req_times[i - 1])) {
req_times.erase(i);
i--;
}
}

if (req_times.length() == 0) {
Rcpp::stop("Requested times are all outside the observed range.");
}
for (int i = 0; i < true_times.length(); i++) {
for (int j = 0; j < req_times.length(); j++) {
if (true_times[i] <= req_times[j] &&
(i == true_times.length() - 1 || true_times[i + 1] > req_times[j])) {
break;
} else if (j == req_times.length() - 1) {
true_times.erase(i);
i--;
break;
}
}
}

return true_times;
}

// [[Rcpp::export]]
NumericMatrix c_score_intslogloss(const NumericVector& truth,
const NumericVector& unique_times,
Expand Down

0 comments on commit b736c8f

Please sign in to comment.