diff --git a/ChangeLog b/ChangeLog index 4a4368687..0d1e6fd1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2016-08-14 James J Balamuta + + * inst/examples/FastLM/lmGSL.R: Updated example to use new GSL templates + 2016-08-11 Dirk Eddelbuettel - * .travis.yml: Switch to using run.sh for Travis CI + * .travis.yml: Switch to using run.sh for Travis CI 2016-08-09 Artem Klevtsov diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 1219a99be..922be91b0 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -24,6 +24,12 @@ \code{RCPP_RETURN_MATRIX} macro when C++11 compiler used (Artem Klevtsov in \ghpr{537} fixing \ghit{38}). } + \item Changes in Rcpp build system + \itemize{ + \item Travis CI is now driven via \code{run.sh} from our fork, and deploys + all packages as .deb binaries using our PPA where needed (Dirk in + \ghpr{540} addressing issue \ghit{517}). + } \item Changes in Rcpp unit tests \itemize{ \item New unit tests for random number generators the R namespace which @@ -34,7 +40,7 @@ \itemize{ \item Examples that used cxxfunction() from the inline package have been rewritten to use either sourceCpp() or cppFunction() - (James Balamuta in \ghpr{535}, \ghpr{534}, and \ghpr{532} + (James Balamuta in \ghpr{541}, \ghpr{535}, \ghpr{534}, and \ghpr{532} addressing issue \ghit{56}). } } diff --git a/inst/examples/FastLM/lmGSL.R b/inst/examples/FastLM/lmGSL.R index c52bc13e1..da23e48d7 100644 --- a/inst/examples/FastLM/lmGSL.R +++ b/inst/examples/FastLM/lmGSL.R @@ -86,17 +86,18 @@ sourceCpp(code=' // [[Rcpp::export]] Rcpp::List fun(Rcpp::NumericVector Yr, Rcpp::NumericMatrix Xr){ - int i,j,n = Xr.nrow(), k = Xr.ncol(); + int i, j, n = Xr.nrow(), k = Xr.ncol(); double chisq; - gsl_matrix *X = gsl_matrix_alloc (n, k); - gsl_vector *y = gsl_vector_alloc (n); - gsl_vector *c = gsl_vector_alloc (k); - gsl_matrix *cov = gsl_matrix_alloc (k, k); + RcppGSL::Matrix X(n, k); // allocate a gsl_matrix of dim n, k + RcppGSL::Vector y(n); // allocate a gsl_vector of length n + RcppGSL::Vector c(k); // allocate a gsl_vector of length k + RcppGSL::Matrix cov(k, k); // allocate a gsl_matrix of dim k, k + for (i = 0; i < n; i++) { for (j = 0; j < k; j++) - gsl_matrix_set (X, i, j, Xr(i,j)); - gsl_vector_set (y, i, Yr(i)); + X(i, j) = Xr(i, j); + y[i] = Yr(i); // Note vector requires [] not () } gsl_multifit_linear_workspace *work = gsl_multifit_linear_alloc (n, k); @@ -105,17 +106,13 @@ Rcpp::List fun(Rcpp::NumericVector Yr, Rcpp::NumericMatrix Xr){ Rcpp::NumericVector coefr(k), stderrestr(k); for (i = 0; i < k; i++) { - coefr(i) = gsl_vector_get(c,i); - stderrestr(i) = sqrt(gsl_matrix_get(cov,i,i)); + coefr(i) = c[i]; + stderrestr(i) = sqrt(cov(i,i)); } - gsl_matrix_free (X); - gsl_vector_free (y); - gsl_vector_free (c); - gsl_matrix_free (cov); - return Rcpp::List::create( Rcpp::Named( "coef", coefr), - Rcpp::Named( "stderr", stderrestr)); + return Rcpp::List::create( Rcpp::Named("coef") = coefr, + Rcpp::Named("stderr") = stderrestr); }') fun }