Skip to content

Commit

Permalink
Added placeholder `UpdateRPlee11_cpp() (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed Oct 22, 2024
1 parent 8418d3e commit 201ffe5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ UpdateGamma_cpp <- function(sobj, hyperpar, ini, S, method, MRF_G, MRF_2b) {
.Call(`_BayesSurvive_UpdateGamma_cpp`, sobj, hyperpar, ini, S, method, MRF_G, MRF_2b)
}

UpdateRPlee11_cpp <- function(sobj, hyperpar, ini, S, method, MRF_G) {
.Call(`_BayesSurvive_UpdateRPlee11_cpp`, sobj, hyperpar, ini, S, method, MRF_G)
}

func_MCMC_graph_cpp <- function(sobj, hyperpar, ini, S, method, MRF_2b) {
.Call(`_BayesSurvive_func_MCMC_graph_cpp`, sobj, hyperpar, ini, S, method, MRF_2b)
}
Expand Down
5 changes: 5 additions & 0 deletions R/UpdateRPlee11.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
#'
#' @inheritParams BayesSurvive
#' @inheritParams func_MCMC
#' @inheritParams func_MCMC_graph
#'
#' @return A list object with component 'beta.ini' for the updated coefficients
#' and component 'acceptlee' for the MCMC acceptance rate
#'
#' @export
UpdateRPlee11 <- function(sobj, hyperpar, ini, S, method, MRF_G, cpp = FALSE) {
if (cpp) {
warning("Cpp not implemented. Rerouting to R implementation.")
return(UpdateRPlee11(sobj, hyperpar, ini, S, method, MRF_G))
}
p <- sobj$p
tau <- hyperpar$tau
cb <- hyperpar$cb
Expand Down
16 changes: 16 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// UpdateRPlee11_cpp
Rcpp::List UpdateRPlee11_cpp(const Rcpp::List sobj, const Rcpp::List hyperpar, const Rcpp::List ini, const uint S, const std::string method, const bool MRF_G);
RcppExport SEXP _BayesSurvive_UpdateRPlee11_cpp(SEXP sobjSEXP, SEXP hyperparSEXP, SEXP iniSEXP, SEXP SSEXP, SEXP methodSEXP, SEXP MRF_GSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const Rcpp::List >::type sobj(sobjSEXP);
Rcpp::traits::input_parameter< const Rcpp::List >::type hyperpar(hyperparSEXP);
Rcpp::traits::input_parameter< const Rcpp::List >::type ini(iniSEXP);
Rcpp::traits::input_parameter< const uint >::type S(SSEXP);
Rcpp::traits::input_parameter< const std::string >::type method(methodSEXP);
Rcpp::traits::input_parameter< const bool >::type MRF_G(MRF_GSEXP);
rcpp_result_gen = Rcpp::wrap(UpdateRPlee11_cpp(sobj, hyperpar, ini, S, method, MRF_G));
return rcpp_result_gen;
END_RCPP
}
// func_MCMC_graph_cpp
Rcpp::List func_MCMC_graph_cpp(const Rcpp::List sobj, const Rcpp::List hyperpar, const Rcpp::List ini, const uint S, const std::string method, const bool MRF_2b);
RcppExport SEXP _BayesSurvive_func_MCMC_graph_cpp(SEXP sobjSEXP, SEXP hyperparSEXP, SEXP iniSEXP, SEXP SSEXP, SEXP methodSEXP, SEXP MRF_2bSEXP) {
Expand Down
18 changes: 18 additions & 0 deletions src/UpdateRPlee11_cpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <RcppArmadillo.h>
#include "misc.h"
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
Rcpp::List UpdateRPlee11_cpp(
const Rcpp::List sobj,
const Rcpp::List hyperpar,
const Rcpp::List ini,
const uint S,
const std::string method,
const bool MRF_G
){
Rcpp::List out = Rcpp::List::create(
Rcpp::Named("beta.ini") = NA_REAL, // TEMP
Rcpp::Named("acceptlee") = NA_REAL // TEMP
);
return out;
}
2 changes: 2 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern SEXP _BayesSurvive_updateRP_genomic_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEX
extern SEXP _BayesSurvive_func_MCMC_graph_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP _BayesSurvive_UpdateGamma_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP _BayesSurvive_list_to_matrix(SEXP);
extern SEXP _BayesSurvive_UpdateRPlee11_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);

static const R_CallMethodDef CallEntries[] = {
{"_BayesSurvive_calJpost_helper_cpp", (DL_FUNC) &_BayesSurvive_calJpost_helper_cpp, 9},
Expand All @@ -28,6 +29,7 @@ static const R_CallMethodDef CallEntries[] = {
{"_BayesSurvive_func_MCMC_graph_cpp", (DL_FUNC) &_BayesSurvive_func_MCMC_graph_cpp, 6},
{"_BayesSurvive_UpdateGamma_cpp", (DL_FUNC) &_BayesSurvive_UpdateGamma_cpp, 7},
{"_BayesSurvive_list_to_matrix", (DL_FUNC) &_BayesSurvive_list_to_matrix, 1},
{"_BayesSurvive_UpdateRPlee11_cpp", (DL_FUNC) &_BayesSurvive_UpdateRPlee11_cpp, 6},
{NULL, NULL, 0}
};

Expand Down

0 comments on commit 201ffe5

Please sign in to comment.