[Rcpp-commits] r1007 - in pkg/RcppGSL: . inst/include inst/unitTests src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 6 09:57:00 CEST 2010
Author: romain
Date: 2010-04-06 09:57:00 +0200 (Tue, 06 Apr 2010)
New Revision: 1007
Modified:
pkg/RcppGSL/DESCRIPTION
pkg/RcppGSL/inst/include/RcppGSL.h
pkg/RcppGSL/inst/include/RcppGSLForward.h
pkg/RcppGSL/inst/unitTests/runit.gsl.R
pkg/RcppGSL/src/Makevars.in
pkg/RcppGSL/src/Makevars.win
pkg/RcppGSL/src/RcppGSL.cpp
Log:
added support for gsl_vector_int and gsl_vector_long, using LinkingTo since we do now depend on a version of Rcpp that will support it
Modified: pkg/RcppGSL/DESCRIPTION
===================================================================
--- pkg/RcppGSL/DESCRIPTION 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/DESCRIPTION 2010-04-06 07:57:00 UTC (rev 1007)
@@ -8,5 +8,6 @@
Description: Glue between Rcpp and the GNU GSL
License: GPL (>=2)
LazyLoad: yes
-Depends: Rcpp (>= 0.7.11.2)
+Depends: Rcpp (>= 0.7.11.3)
+LinkingTo: Rcpp
SystemRequirements: GNU GSL
Modified: pkg/RcppGSL/inst/include/RcppGSL.h
===================================================================
--- pkg/RcppGSL/inst/include/RcppGSL.h 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/inst/include/RcppGSL.h 2010-04-06 07:57:00 UTC (rev 1007)
@@ -24,7 +24,7 @@
#include <Rcpp.h>
namespace Rcpp{
-
+
template <> SEXP wrap( const gsl_vector& x){
return wrap( x.data, x.data + x.size ) ;
}
@@ -33,6 +33,15 @@
return wrap( x.data, x.data + x.size ) ;
}
+template <> SEXP wrap( const gsl_vector_int& x){
+ return wrap( x.data, x.data + x.size ) ;
+}
+
+template <> SEXP wrap( const gsl_vector_long& x){
+ return wrap( x.data, x.data + x.size ) ;
+}
+
+
}
#endif
Modified: pkg/RcppGSL/inst/include/RcppGSLForward.h
===================================================================
--- pkg/RcppGSL/inst/include/RcppGSLForward.h 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/inst/include/RcppGSLForward.h 2010-04-06 07:57:00 UTC (rev 1007)
@@ -27,6 +27,8 @@
namespace Rcpp{
template <> SEXP wrap( const gsl_vector& ) ;
template <> SEXP wrap( const gsl_vector_float& ) ;
+ template <> SEXP wrap( const gsl_vector_int& ) ;
+ template <> SEXP wrap( const gsl_vector_long& ) ;
}
#endif
Modified: pkg/RcppGSL/inst/unitTests/runit.gsl.R
===================================================================
--- pkg/RcppGSL/inst/unitTests/runit.gsl.R 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/inst/unitTests/runit.gsl.R 2010-04-06 07:57:00 UTC (rev 1007)
@@ -22,7 +22,9 @@
checkEquals( res,
list(
"gsl_vector" = numeric(10),
- "gsl_vector_float" = numeric(10)
+ "gsl_vector_float" = numeric(10),
+ "gsl_vector_int" = integer(10),
+ "gsl_vector_long" = numeric(10)
),
msg = "wrap( gsl_vector )" )
}
Modified: pkg/RcppGSL/src/Makevars.in
===================================================================
--- pkg/RcppGSL/src/Makevars.in 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/src/Makevars.in 2010-04-06 07:57:00 UTC (rev 1007)
@@ -2,12 +2,10 @@
# set by configure
GSL_CFLAGS = @GSL_CFLAGS@
GSL_LIBS = @GSL_LIBS@
-RCPP_CXXFLAGS = @RCPP_CXXFLAGS@
RCPP_LDFLAGS = @RCPP_LDFLAGS@
# combine to standard arguments for R
PKG_CPPFLAGS = -W $(GSL_CFLAGS) -I../inst/include
-PKG_CXXFLAGS = $(RCPP_CXXFLAGS)
PKG_LIBS = $(GSL_LIBS) $(RCPP_LDFLAGS)
Modified: pkg/RcppGSL/src/Makevars.win
===================================================================
--- pkg/RcppGSL/src/Makevars.win 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/src/Makevars.win 2010-04-06 07:57:00 UTC (rev 1007)
@@ -1,7 +1,7 @@
## This assumes that the LIB_GSL variable points to working GSL libraries
## It also assume that we can call Rscript to ask Rcpp about its locations
-PKG_CPPFLAGS=-I$(LIB_GSL)/include $(shell Rscript.exe -e "Rcpp:::CxxFlags()") -I../inst/include
+PKG_CPPFLAGS=-I$(LIB_GSL)/include -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas $(shell Rscript.exe -e "Rcpp:::LdFlags()")
Modified: pkg/RcppGSL/src/RcppGSL.cpp
===================================================================
--- pkg/RcppGSL/src/RcppGSL.cpp 2010-04-06 07:55:50 UTC (rev 1006)
+++ pkg/RcppGSL/src/RcppGSL.cpp 2010-04-06 07:57:00 UTC (rev 1007)
@@ -5,16 +5,22 @@
extern "C" SEXP test_gsl_vector(){
gsl_vector * x_double = gsl_vector_calloc (10);
gsl_vector_float * x_float = gsl_vector_float_calloc(10) ;
+ gsl_vector_int * x_int = gsl_vector_int_calloc(10) ;
+ gsl_vector_long * x_long = gsl_vector_long_calloc(10) ;
/* create an R list containing copies of gsl data */
List res = List::create(
_["gsl_vector"] = *x_double,
- _["gsl_vector_float"] = *x_float
+ _["gsl_vector_float"] = *x_float,
+ _["gsl_vector_int"] = *x_int,
+ _["gsl_vector_long"] = *x_long
) ;
/* cleanup gsl data */
gsl_vector_free(x_double);
gsl_vector_float_free( x_float);
+ gsl_vector_int_free( x_int );
+ gsl_vector_long_free( x_long );
return res ;
}
More information about the Rcpp-commits
mailing list