Skip to content

Commit

Permalink
add version number to a c++ fun
Browse files Browse the repository at this point in the history
  • Loading branch information
maverickg committed Feb 14, 2014
1 parent 3bb3ac1 commit 6b5accf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions rstan/example/examplemodel.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# create sysdata.rdat file for the example
# in rstan's doc
# create csv files for examples in rstan
library(rstan)
excode <- '
transformed data {
Expand Down Expand Up @@ -27,6 +26,5 @@ excode <- '
'

exfit <- stan(model_code = excode, save_dso = FALSE, iter = 200, sample_file = "rstan_doc_ex.csv")
save(exfit, file = "../rstan/R/sysdata.rda", compress = "xz")
plot(exfit)
print(exfit)
2 changes: 1 addition & 1 deletion rstan/rstan/R/stanc.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ stanc <- function(file, model_code = '', model_name = "anon_model", verbose = FA
if (is.na(obfuscate_name)) obfuscate_name <- FALSE
# model_name in C++, to avoid names that would be problematic in C++.
model_cppname <- legitimate_model_name(model_name, obfuscate_name = obfuscate_name)
r <- .Call("CPP_stanc", model_code, model_cppname)
r <- .Call("CPP_stanc220", model_code, model_cppname)
# from the cpp code of stanc,
# returned is a named list with element 'status', 'model_cppname', and 'cppcode'
r$model_name <- model_name
Expand Down
4 changes: 2 additions & 2 deletions rstan/rstan/src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SEXP seq_permutation(SEXP conf);
SEXP CPP_read_comments(SEXP file, SEXP n);
SEXP stan_prob_autocovariance(SEXP v);
SEXP is_Null_NS(SEXP ns);
SEXP CPP_stanc(SEXP model_stancode, SEXP model_name);
SEXP CPP_stanc220(SEXP model_stancode, SEXP model_name);
SEXP CPP_stan_version();
#ifdef __cplusplus
}
Expand All @@ -40,7 +40,7 @@ static const R_CallMethodDef CallEntries[] = {
CALLDEF(CPP_read_comments, 2),
CALLDEF(stan_prob_autocovariance, 1),
CALLDEF(is_Null_NS, 1),
CALLDEF(CPP_stanc, 2),
CALLDEF(CPP_stanc220, 2),
CALLDEF(CPP_stan_version, 0),
{NULL, NULL, 0}
};
Expand Down
4 changes: 2 additions & 2 deletions rstan/rstan/src/stanc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Rcpp.h>
#include <rstan/io/r_ostream.hpp>

RcppExport SEXP CPP_stanc(SEXP model_stancode, SEXP model_name);
RcppExport SEXP CPP_stanc220(SEXP model_stancode, SEXP model_name);
RcppExport SEXP CPP_stan_version();

SEXP CPP_stan_version() {
Expand All @@ -28,7 +28,7 @@ SEXP CPP_stan_version() {
END_RCPP
}

SEXP CPP_stanc(SEXP model_stancode, SEXP model_name) {
SEXP CPP_stanc220(SEXP model_stancode, SEXP model_name) {
BEGIN_RCPP;
static const int SUCCESS_RC = 0;
static const int EXCEPTION_RC = -1;
Expand Down

0 comments on commit 6b5accf

Please # to comment.