Exemple #1
0
// [[Rcpp::export]]
Rcpp::NumericVector CALLINIT(Rcpp::NumericVector Nparam, Rcpp::NumericVector Ninit, SEXP xifun) {

  Rodeproblem *prob = new Rodeproblem(Nparam,Ninit);

  int i=0;
  int neq = prob->neq();

  prob->Rodeproblem::init_fun(xifun);

  Rcpp::NumericVector ans(neq);

  double time =0;
  prob->time(0);
  prob->evid(0);

  prob->init_call(time);

  for(i=0; i < neq; i++) ans[i] = prob->init(i);
  delete prob;
  return(ans);
}
Exemple #2
0
// [[Rcpp::export]]
Rcpp::List TOUCH_FUNS(Rcpp::NumericVector lparam, Rcpp::NumericVector linit,
		      SEXP xifun, SEXP xtfun, SEXP xdfun) {


  int i;

  Rcpp::List ans;

  Rodeproblem *prob  = new Rodeproblem(lparam, linit);

  prob->Rodeproblem::init_fun(xifun);
  prob->Rodeproblem::table_fun(xtfun);

  double time = 0;
  prob->time(time);
  prob->newind(0);

  prob->init_call(time);
  prob->table_init_call();

  std::vector<std::string> tablenames;
  const sd_map& Tabledata = prob->table();
  for(tablemap::const_iterator it=Tabledata.begin(); it !=Tabledata.end(); ++it) {
    tablenames.push_back(it->first);
  }

  const dvec& init = prob->init();

  Rcpp::NumericVector init_val(prob->neq());

  for(i=0; i < (prob->neq()); i++) init_val[i] = init[i];

  ans["tnames"] = tablenames;
  ans["init"] = init_val;
  ans["npar"] = prob->npar();
  ans["neq"] = prob->neq();
  delete prob;
  return(ans);
}