From 36b1b845a2b429eb29942fe1a760231a20c760d3 Mon Sep 17 00:00:00 2001 From: "chung@molgen.mpg.de" Date: Wed, 20 Jan 2016 12:46:51 +0100 Subject: [PATCH] added return vars --- R/RcppExports.R | 2 +- src/RcppExports.cpp | 7 ++++--- src/rmn.cpp | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/R/RcppExports.R b/R/RcppExports.R index 0c8f4a5..ae6c03e 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -2,6 +2,6 @@ # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 estimate <- function(t_, s_, z_, empty_, mu_, nContig, nExperiment, iter = 0L, maxIter = 10L, seed = 0L) { - invisible(.Call('decon_estimate', PACKAGE = 'decon', t_, s_, z_, empty_, mu_, nContig, nExperiment, iter, maxIter, seed)) + .Call('decon_estimate', PACKAGE = 'decon', t_, s_, z_, empty_, mu_, nContig, nExperiment, iter, maxIter, seed) } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 4157955..2c6d885 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -8,9 +8,10 @@ using namespace Rcpp; // estimate -void estimate(Rcpp::List t_, Rcpp::List s_, Rcpp::List z_, Rcpp::List empty_, Rcpp::List mu_, int nContig, int nExperiment, int iter, int maxIter, long seed); +Rcpp::List estimate(Rcpp::List t_, Rcpp::List s_, Rcpp::List z_, Rcpp::List empty_, Rcpp::List mu_, int nContig, int nExperiment, int iter, int maxIter, long seed); RcppExport SEXP decon_estimate(SEXP t_SEXP, SEXP s_SEXP, SEXP z_SEXP, SEXP empty_SEXP, SEXP mu_SEXP, SEXP nContigSEXP, SEXP nExperimentSEXP, SEXP iterSEXP, SEXP maxIterSEXP, SEXP seedSEXP) { BEGIN_RCPP + Rcpp::RObject __result; Rcpp::RNGScope __rngScope; Rcpp::traits::input_parameter< Rcpp::List >::type t_(t_SEXP); Rcpp::traits::input_parameter< Rcpp::List >::type s_(s_SEXP); @@ -22,7 +23,7 @@ BEGIN_RCPP Rcpp::traits::input_parameter< int >::type iter(iterSEXP); Rcpp::traits::input_parameter< int >::type maxIter(maxIterSEXP); Rcpp::traits::input_parameter< long >::type seed(seedSEXP); - estimate(t_, s_, z_, empty_, mu_, nContig, nExperiment, iter, maxIter, seed); - return R_NilValue; + __result = Rcpp::wrap(estimate(t_, s_, z_, empty_, mu_, nContig, nExperiment, iter, maxIter, seed)); + return __result; END_RCPP } diff --git a/src/rmn.cpp b/src/rmn.cpp index de9cd60..f62c75a 100644 --- a/src/rmn.cpp +++ b/src/rmn.cpp @@ -164,7 +164,7 @@ void sampleU( } //[[Rcpp::export]] -void estimate( +Rcpp::List estimate( Rcpp::List t_, Rcpp::List s_, Rcpp::List z_, @@ -270,7 +270,11 @@ void estimate( } std::cout << iter << ": new likelihood: " << lnL << std::endl; } - + return Rcpp::List::create( + Rcpp::Named("z") = z, + Rcpp::Named("empty") = empty, + Rcpp::Named("mu") = mu, + Rcpp::Named("lnL") = lnL); }