From noreply at r-forge.r-project.org Tue Sep 10 16:56:32 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 10 Sep 2013 16:56:32 +0200 (CEST) Subject: [Rcpp-commits] r4470 - in pkg/RcppGSL: . inst Message-ID: <20130910145632.630EB1848A0@r-forge.r-project.org> Author: edd Date: 2013-09-10 16:56:32 +0200 (Tue, 10 Sep 2013) New Revision: 4470 Modified: pkg/RcppGSL/ChangeLog pkg/RcppGSL/DESCRIPTION pkg/RcppGSL/inst/NEWS.Rd Log: Changed to 'Imports: Rcpp' rather than 'Depends: Rcpp' to make r-devel happy Modified: pkg/RcppGSL/ChangeLog =================================================================== --- pkg/RcppGSL/ChangeLog 2013-08-31 21:27:49 UTC (rev 4469) +++ pkg/RcppGSL/ChangeLog 2013-09-10 14:56:32 UTC (rev 4470) @@ -1,3 +1,8 @@ +2013-09-10 Dirk Eddelbuettel + + * DESCRIPTION (Imports): Now 'Imports: Rcpp' rather than Depends: to + satisfy R CMD check for the R version under development + 2013-08-24 Dirk Eddelbuettel * DESCRIPTION (Suggests): Added 'highlight' so that the package is Modified: pkg/RcppGSL/DESCRIPTION =================================================================== --- pkg/RcppGSL/DESCRIPTION 2013-08-31 21:27:49 UTC (rev 4469) +++ pkg/RcppGSL/DESCRIPTION 2013-09-10 14:56:32 UTC (rev 4470) @@ -1,7 +1,7 @@ Package: RcppGSL Type: Package Title: Rcpp integration for GNU GSL vectors and matrices -Version: 0.2.0.1 +Version: 0.2.0.2 Date: $Date$ Author: Romain Francois and Dirk Eddelbuettel Maintainer: Dirk Eddelbuettel @@ -27,7 +27,7 @@ write a similar package against another library. License: GPL (>= 2) LazyLoad: yes -Depends: Rcpp (>= 0.10.3) +Imports: Rcpp Suggests: RUnit, inline, highlight LinkingTo: Rcpp SystemRequirements: GNU GSL Modified: pkg/RcppGSL/inst/NEWS.Rd =================================================================== --- pkg/RcppGSL/inst/NEWS.Rd 2013-08-31 21:27:49 UTC (rev 4469) +++ pkg/RcppGSL/inst/NEWS.Rd 2013-09-10 14:56:32 UTC (rev 4470) @@ -15,6 +15,9 @@ also been added for command-line builds. \item Unit tests now use \code{sourceCpp()} instead of \code{cxxfunction()} from the \pkg{inline} package + \item The \code{DESCRIPTION} file now uses \code{Imports: Rcpp} + rather than \code{Depends: Rcpp} to satisfy \code{R CMD check} under + the R development version. } } From noreply at r-forge.r-project.org Wed Sep 11 14:39:36 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 11 Sep 2013 14:39:36 +0200 (CEST) Subject: [Rcpp-commits] r4471 - pkg/RcppGSL Message-ID: <20130911123936.6846C1850EF@r-forge.r-project.org> Author: edd Date: 2013-09-11 14:39:36 +0200 (Wed, 11 Sep 2013) New Revision: 4471 Modified: pkg/RcppGSL/DESCRIPTION Log: Restored versioned dependency in DESCRIPTION as Imports: can be versioned too Modified: pkg/RcppGSL/DESCRIPTION =================================================================== --- pkg/RcppGSL/DESCRIPTION 2013-09-10 14:56:32 UTC (rev 4470) +++ pkg/RcppGSL/DESCRIPTION 2013-09-11 12:39:36 UTC (rev 4471) @@ -27,7 +27,7 @@ write a similar package against another library. License: GPL (>= 2) LazyLoad: yes -Imports: Rcpp +Imports: Rcpp (>= 0.9.8) Suggests: RUnit, inline, highlight LinkingTo: Rcpp SystemRequirements: GNU GSL From noreply at r-forge.r-project.org Thu Sep 12 12:02:13 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 12 Sep 2013 12:02:13 +0200 (CEST) Subject: [Rcpp-commits] r4472 - in pkg/Rcpp: . inst/include/Rcpp/platform Message-ID: <20130912100213.53CDE1813BB@r-forge.r-project.org> Author: romain Date: 2013-09-12 12:02:11 +0200 (Thu, 12 Sep 2013) New Revision: 4472 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: murray long long patch Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-11 12:39:36 UTC (rev 4471) +++ pkg/Rcpp/ChangeLog 2013-09-12 10:02:11 UTC (rev 4472) @@ -1,3 +1,8 @@ +2013-09-12 Romain Francois + + * include/Rcpp/platform/compiler.h : patch submitted by Murray for better + support of long long type. + 2013-08-31 Dirk Eddelbuettel * inst/doc/*: Moved all vignettes to vignettes/* Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-11 12:39:36 UTC (rev 4471) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-12 10:02:11 UTC (rev 4472) @@ -185,7 +185,7 @@ #endif #ifdef __GNUC__ -#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__LP64__) #ifdef __LONG_LONG_MAX__ __extension__ typedef long long int rcpp_long_long_type; __extension__ typedef unsigned long long int rcpp_ulong_long_type; From noreply at r-forge.r-project.org Thu Sep 12 15:26:43 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 12 Sep 2013 15:26:43 +0200 (CEST) Subject: [Rcpp-commits] r4473 - in pkg/Rcpp: . inst/include/Rcpp/platform Message-ID: <20130912132643.3871B185D37@r-forge.r-project.org> Author: romain Date: 2013-09-12 15:26:42 +0200 (Thu, 12 Sep 2013) New Revision: 4473 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: gcc 4.2.1 has tr1 unordered maps and sets Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-12 10:02:11 UTC (rev 4472) +++ pkg/Rcpp/ChangeLog 2013-09-12 13:26:42 UTC (rev 4473) @@ -2,6 +2,8 @@ * include/Rcpp/platform/compiler.h : patch submitted by Murray for better support of long long type. + * include/Rcpp/platform/compiler.h : gcc 4.2.1 has tr1/unordered_map + and tr1/unordered_set. Previous test was for gcc 4.4.0 for some reason 2013-08-31 Dirk Eddelbuettel Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-12 10:02:11 UTC (rev 4472) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-12 13:26:42 UTC (rev 4473) @@ -116,7 +116,7 @@ // Check TR1 Headers #if defined(__INTEL_COMPILER) || (defined(__GNUC__) && !defined(__clang__)) #if defined(__GLIBCXX__) - #if GCC_VERSION >= 40400 + #if GCC_VERSION >= 40201 #define HAS_TR1_UNORDERED_MAP #define HAS_TR1_UNORDERED_SET #endif From noreply at r-forge.r-project.org Thu Sep 12 16:02:25 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 12 Sep 2013 16:02:25 +0200 (CEST) Subject: [Rcpp-commits] r4474 - pkg/Rcpp/inst/include/Rcpp/platform Message-ID: <20130912140225.2BC8A185DBF@r-forge.r-project.org> Author: romain Date: 2013-09-12 16:02:24 +0200 (Thu, 12 Sep 2013) New Revision: 4474 Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: more precise version that only fixes it for the mac Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-12 13:26:42 UTC (rev 4473) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-12 14:02:24 UTC (rev 4474) @@ -116,7 +116,7 @@ // Check TR1 Headers #if defined(__INTEL_COMPILER) || (defined(__GNUC__) && !defined(__clang__)) #if defined(__GLIBCXX__) - #if GCC_VERSION >= 40201 + #if GCC_VERSION >= 40400 || ( GCC_VERSION >= 40201 && defined(__APPLE__) ) #define HAS_TR1_UNORDERED_MAP #define HAS_TR1_UNORDERED_SET #endif From noreply at r-forge.r-project.org Fri Sep 13 10:59:25 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 10:59:25 +0200 (CEST) Subject: [Rcpp-commits] r4475 - in pkg/Rcpp: . src Message-ID: <20130913085925.A4BA7183B43@r-forge.r-project.org> Author: romain Date: 2013-09-13 10:59:25 +0200 (Fri, 13 Sep 2013) New Revision: 4475 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/src/api.cpp Log: capabilities now checks for the RCPP_HAS_LONG_LONG_TYPES macro Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-12 14:02:24 UTC (rev 4474) +++ pkg/Rcpp/ChangeLog 2013-09-13 08:59:25 UTC (rev 4475) @@ -1,3 +1,7 @@ +2013-09-13 Romain Francois + + * src/api.cpp : added "long long" to the capabilities function. + 2013-09-12 Romain Francois * include/Rcpp/platform/compiler.h : patch submitted by Murray for better Modified: pkg/Rcpp/src/api.cpp =================================================================== --- pkg/Rcpp/src/api.cpp 2013-09-12 14:02:24 UTC (rev 4474) +++ pkg/Rcpp/src/api.cpp 2013-09-13 08:59:25 UTC (rev 4475) @@ -1329,8 +1329,8 @@ } SEXP rcpp_capabilities(){ - SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 8) ) ; - SEXP names = PROTECT( Rf_allocVector( STRSXP, 8 ) ) ; + SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 9) ) ; + SEXP names = PROTECT( Rf_allocVector( STRSXP, 9 ) ) ; #ifdef HAS_VARIADIC_TEMPLATES LOGICAL(cap)[0] = TRUE ; #else @@ -1365,6 +1365,12 @@ #endif LOGICAL(cap)[7] = FALSE ; + +#ifdef RCPP_HAS_LONG_LONG_TYPES + LOGICAL(cap)[8] = TRUE ; +#else + LOGICAL(cap)[8] = FALSE ; +#endif SET_STRING_ELT(names, 0, Rf_mkChar("variadic templates") ) ; SET_STRING_ELT(names, 1, Rf_mkChar("initializer lists") ) ; @@ -1374,6 +1380,7 @@ SET_STRING_ELT(names, 5, Rf_mkChar("Rcpp modules") ) ; SET_STRING_ELT(names, 6, Rf_mkChar("demangling") ) ; SET_STRING_ELT(names, 7, Rf_mkChar("classic api") ) ; + SET_STRING_ELT(names, 8, Rf_mkChar("long long") ) ; Rf_setAttrib( cap, R_NamesSymbol, names ) ; UNPROTECT(2) ; return cap ; From noreply at r-forge.r-project.org Fri Sep 13 11:11:05 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 11:11:05 +0200 (CEST) Subject: [Rcpp-commits] r4476 - in pkg/Rcpp: . inst/include/Rcpp/platform Message-ID: <20130913091105.56F83185027@r-forge.r-project.org> Author: romain Date: 2013-09-13 11:11:04 +0200 (Fri, 13 Sep 2013) New Revision: 4476 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: reenable demangling on OSX >= 10.8, it was disabled on 10.8 for whatever reason Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-13 08:59:25 UTC (rev 4475) +++ pkg/Rcpp/ChangeLog 2013-09-13 09:11:04 UTC (rev 4476) @@ -1,6 +1,8 @@ 2013-09-13 Romain Francois - * src/api.cpp : added "long long" to the capabilities function. + * src/api.cpp : added "long long" to the capabilities function. + * include/Rcpp/platform/compiler.h : demangling is definitely available + on all mac versions using gcc. No point is testing for OSX version. 2013-09-12 Romain Francois Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-13 08:59:25 UTC (rev 4475) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-13 09:11:04 UTC (rev 4476) @@ -174,14 +174,7 @@ #endif #ifdef __GNUC__ - #ifdef __APPLE__ - #include - #ifndef __MAC_10_8 - #define RCPP_HAS_DEMANGLING - #endif - #else - #define RCPP_HAS_DEMANGLING - #endif + #define RCPP_HAS_DEMANGLING #endif #ifdef __GNUC__ From noreply at r-forge.r-project.org Fri Sep 13 17:22:51 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 17:22:51 +0200 (CEST) Subject: [Rcpp-commits] r4477 - in pkg/Rcpp: . inst/include inst/include/Rcpp src Message-ID: <20130913152251.14E73185DBF@r-forge.r-project.org> Author: romain Date: 2013-09-13 17:22:50 +0200 (Fri, 13 Sep 2013) New Revision: 4477 Added: pkg/Rcpp/inst/include/Rcpp/InputParameter.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/inst/include/RcppCommon.h pkg/Rcpp/src/attributes.cpp Log: added InputParameter for an extra layer of abstraction that we can use to define custom handling of references. For example this is used in RcppArmadillo Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-13 09:11:04 UTC (rev 4476) +++ pkg/Rcpp/ChangeLog 2013-09-13 15:22:50 UTC (rev 4477) @@ -3,7 +3,11 @@ * src/api.cpp : added "long long" to the capabilities function. * include/Rcpp/platform/compiler.h : demangling is definitely available on all mac versions using gcc. No point is testing for OSX version. - + * include/Rcpp/InputParameter.h : extra layer of abstraction to allow for + custom handling of references etc ... used in RcppArmadillo + * src/attributes.cpp : using InputParameter + * DESCRIPTION: bump to 0.10.4.4 + 2013-09-12 Romain Francois * include/Rcpp/platform/compiler.h : patch submitted by Murray for better Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-09-13 09:11:04 UTC (rev 4476) +++ pkg/Rcpp/DESCRIPTION 2013-09-13 15:22:50 UTC (rev 4477) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.4.3 +Version: 0.10.4.4 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire Added: pkg/Rcpp/inst/include/Rcpp/InputParameter.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/InputParameter.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/InputParameter.h 2013-09-13 15:22:50 UTC (rev 4477) @@ -0,0 +1,40 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +// +// InputParameter.h: Rcpp R/C++ interface class library -- +// +// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of Rcpp. +// +// Rcpp is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Rcpp is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Rcpp. If not, see . + +#ifndef Rcpp__InputParameter__h +#define Rcpp__InputParameter__h + +namespace Rcpp { + + template + class InputParameter { + public: + InputParameter(SEXP x_) : x(x_){} + + inline operator T() { return as(x) ; } + + private: + SEXP x ; + } ; + +} + +#endif Modified: pkg/Rcpp/inst/include/RcppCommon.h =================================================================== --- pkg/Rcpp/inst/include/RcppCommon.h 2013-09-13 09:11:04 UTC (rev 4476) +++ pkg/Rcpp/inst/include/RcppCommon.h 2013-09-13 15:22:50 UTC (rev 4477) @@ -110,6 +110,7 @@ #include #include #include +#include #include #include Modified: pkg/Rcpp/src/attributes.cpp =================================================================== --- pkg/Rcpp/src/attributes.cpp 2013-09-13 09:11:04 UTC (rev 4476) +++ pkg/Rcpp/src/attributes.cpp 2013-09-13 15:22:50 UTC (rev 4477) @@ -2167,9 +2167,8 @@ for (size_t i = 0; i(" - << argument.name() << "SEXP);" << std::endl; + ostr << " Rcpp::InputParameter< " << argument.type().full_name() << "> " << argument.name() + << "(" << argument.name() << "SEXP );" << std::endl; } ostr << " "; From noreply at r-forge.r-project.org Fri Sep 13 17:26:28 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 17:26:28 +0200 (CEST) Subject: [Rcpp-commits] r4478 - in pkg/RcppArmadillo: . inst/include Message-ID: <20130913152628.F3586185A12@r-forge.r-project.org> Author: romain Date: 2013-09-13 17:26:28 +0200 (Fri, 13 Sep 2013) New Revision: 4478 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h Log: implementation of InputParameter for arma::Mat Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-13 15:22:50 UTC (rev 4477) +++ pkg/RcppArmadillo/ChangeLog 2013-09-13 15:26:28 UTC (rev 4478) @@ -1,3 +1,10 @@ +2013-09-13 Romain Francois + + * DESCRIPTION : require Rcpp 0.10.4.4 + * include/RcppArmadilloForward.h : declaration of specializations of InputParameter + for references and const reference to arma::Mat + * include/RcppArmadilloAs.h : definitions of the above + 2013-08-24 Romain Francois * include/RcppArmadilloExtensions/sample.h: added include guard, made Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-09-13 15:22:50 UTC (rev 4477) +++ pkg/RcppArmadillo/DESCRIPTION 2013-09-13 15:26:28 UTC (rev 4478) @@ -32,7 +32,7 @@ or later, as is the rest of Rcpp. License: GPL (>= 2) LazyLoad: yes -Depends: R (>= 2.14.0), Rcpp (>= 0.10.2) +Depends: R (>= 2.14.0), Rcpp (>= 0.10.4.4) LinkingTo: Rcpp Suggests: RUnit URL: http://arma.sourceforge.net/, http://dirk.eddelbuettel.com/code/rcpp.armadillo.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/RcppArmadillo Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 15:22:50 UTC (rev 4477) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 15:26:28 UTC (rev 4478) @@ -43,7 +43,21 @@ public: Exporter(SEXP x) : MatrixExporter< arma::Mat, T >(x){} }; + + template + class Exporter< const arma::Mat& > { + public: + typedef typename Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > MATRIX ; + Exporter(SEXP x) : mat(x) {} + + inline arma::Mat* get(){ + return new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; + } + + private: + MATRIX mat ; + }; template class Exporter< arma::SpMat > { @@ -85,6 +99,49 @@ S4 mat ; } ; } + + template + class InputParameter< const arma::Mat& > { + public: + typedef const typename arma::Mat& const_reference ; + + InputParameter( SEXP x_ ) : mat(x_) { + ptr = new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; + } + inline operator const_reference(){ + return const_cast( *ptr ) ; + } + + ~InputParameter(){ + delete ptr ; + } + + private: + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > mat ; + arma::Mat* ptr ; + } ; + + template + class InputParameter< arma::Mat& > { + public: + typedef typename arma::Mat& reference ; + + InputParameter( SEXP x_ ) : mat(x_) { + ptr = new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; + } + inline operator reference(){ + return *ptr ; + } + + ~InputParameter(){ + delete ptr ; + } + + private: + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > mat ; + arma::Mat* ptr ; + } ; + } #endif Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-13 15:22:50 UTC (rev 4477) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-13 15:26:28 UTC (rev 4478) @@ -90,11 +90,18 @@ template class Exporter< arma::Row > ; template class Exporter< arma::Col > ; template class Exporter< arma::SpMat > ; - // template class Exporter< arma::field > ; + + // template class Exporter< arma::field > ; // template class Exporter< arma::Cube > ; } // namespace traits + template + class InputParameter< const arma::Mat& > ; + + template + class InputParameter< arma::Mat& > ; + } #endif From noreply at r-forge.r-project.org Fri Sep 13 17:57:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 17:57:55 +0200 (CEST) Subject: [Rcpp-commits] r4479 - pkg/RcppArmadillo/inst/include Message-ID: <20130913155755.A84C2185D16@r-forge.r-project.org> Author: romain Date: 2013-09-13 17:57:55 +0200 (Fri, 13 Sep 2013) New Revision: 4479 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h Log: version that does not use pointers Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 15:26:28 UTC (rev 4478) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 15:57:55 UTC (rev 4479) @@ -105,20 +105,15 @@ public: typedef const typename arma::Mat& const_reference ; - InputParameter( SEXP x_ ) : mat(x_) { - ptr = new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; - } + InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + inline operator const_reference(){ - return const_cast( *ptr ) ; + return mat ; } - ~InputParameter(){ - delete ptr ; - } - private: - Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > mat ; - arma::Mat* ptr ; + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; + arma::Mat mat ; } ; template @@ -126,20 +121,15 @@ public: typedef typename arma::Mat& reference ; - InputParameter( SEXP x_ ) : mat(x_) { - ptr = new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; - } + InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + inline operator reference(){ - return *ptr ; + return mat ; } - ~InputParameter(){ - delete ptr ; - } - private: - Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > mat ; - arma::Mat* ptr ; + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; + arma::Mat mat ; } ; } From noreply at r-forge.r-project.org Fri Sep 13 18:35:06 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 18:35:06 +0200 (CEST) Subject: [Rcpp-commits] r4480 - pkg/RcppArmadillo/inst/include Message-ID: <20130913163506.13577185D9C@r-forge.r-project.org> Author: romain Date: 2013-09-13 18:35:05 +0200 (Fri, 13 Sep 2013) New Revision: 4480 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h Log: reference passinhg for Row and Col Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 15:57:55 UTC (rev 4479) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-13 16:35:05 UTC (rev 4480) @@ -132,6 +132,32 @@ arma::Mat mat ; } ; + template + class ArmaVec_InputParameter { + public: + ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( v.begin(), v.size(), false ){} + + inline operator REF(){ + return vec ; + } + + private: + Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > v ; + VEC vec ; + } ; + + #define MAKE_INPUT_PARAMETER(TYPE,REF) \ + template \ + class InputParameter : public ArmaVec_InputParameter{ \ + public: \ + InputParameter( SEXP x) : ArmaVec_InputParameter(x){} \ + } ; + + MAKE_INPUT_PARAMETER(arma::Col, const arma::Col& ) + MAKE_INPUT_PARAMETER(arma::Col, arma::Col& ) + MAKE_INPUT_PARAMETER(arma::Row, const arma::Row& ) + MAKE_INPUT_PARAMETER(arma::Row, arma::Row& ) + #undef MAKE_INPUT_PARAMETER } #endif Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-13 15:57:55 UTC (rev 4479) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-13 16:35:05 UTC (rev 4480) @@ -96,12 +96,15 @@ } // namespace traits - template - class InputParameter< const arma::Mat& > ; + template class InputParameter< const arma::Mat& > ; + template class InputParameter< arma::Mat& > ; - template - class InputParameter< arma::Mat& > ; + template class InputParameter< const arma::Col& > ; + template class InputParameter< arma::Col& > ; + template class InputParameter< const arma::Row& > ; + template class InputParameter< arma::Row& > ; + } #endif From noreply at r-forge.r-project.org Sat Sep 14 13:57:22 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 13:57:22 +0200 (CEST) Subject: [Rcpp-commits] r4481 - in pkg/Rcpp: . inst/include/Rcpp/traits Message-ID: <20130914115722.AC910184D0D@r-forge.r-project.org> Author: edd Date: 2013-09-14 13:57:22 +0200 (Sat, 14 Sep 2013) New Revision: 4481 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h Log: trivial fill-in-the-gap for const double emacs whitespace adjustment for changelog Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-13 16:35:05 UTC (rev 4480) +++ pkg/Rcpp/ChangeLog 2013-09-14 11:57:22 UTC (rev 4481) @@ -1,26 +1,28 @@ -2013-09-13 Romain Francois +2013-09-13 Romain Francois - * src/api.cpp : added "long long" to the capabilities function. - * include/Rcpp/platform/compiler.h : demangling is definitely available - on all mac versions using gcc. No point is testing for OSX version. - * include/Rcpp/InputParameter.h : extra layer of abstraction to allow for - custom handling of references etc ... used in RcppArmadillo + * src/api.cpp : added "long long" to the capabilities function. + * include/Rcpp/platform/compiler.h : demangling is definitely + available on all mac versions using gcc. No point is testing for OSX + version. + * include/Rcpp/InputParameter.h : extra layer of abstraction to allow + for custom handling of references etc ... used in RcppArmadillo * src/attributes.cpp : using InputParameter * DESCRIPTION: bump to 0.10.4.4 - -2013-09-12 Romain Francois - * include/Rcpp/platform/compiler.h : patch submitted by Murray for better - support of long long type. - * include/Rcpp/platform/compiler.h : gcc 4.2.1 has tr1/unordered_map - and tr1/unordered_set. Previous test was for gcc 4.4.0 for some reason +2013-09-12 Romain Francois + * include/Rcpp/platform/compiler.h : patch submitted by Murray for + better support of long long type. + * include/Rcpp/platform/compiler.h : gcc 4.2.1 has tr1/unordered_map + and tr1/unordered_set. Previous test was for gcc 4.4.0 for some + reason + 2013-08-31 Dirk Eddelbuettel * inst/doc/*: Moved all vignettes to vignettes/* * vignettes/*: Minor updates to some vignettes -2013-08-22 Romain Francois +2013-08-22 Romain Francois * include/Rcpp/traits/is_primitive.h : new trait to identify if a type is primitive, this is a shortcut of using r_type_traits and @@ -42,7 +44,7 @@ where T is not a primitive * include/Rcpp/api/meat/export.h : implementation in meat because it needs as -2013-08-01 Romain Francois +2013-08-01 Romain Francois * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. * unitTests/runit.wstring.R: re-enable the wstring test suite. Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-13 16:35:05 UTC (rev 4480) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-14 11:57:22 UTC (rev 4481) @@ -34,6 +34,7 @@ template<> struct r_sexptype_traits{ enum{ rtype = INTSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = INTSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; +template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = LGLSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = STRSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = CPLXSXP } ; } ; Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-09-13 16:35:05 UTC (rev 4480) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-09-14 11:57:22 UTC (rev 4481) @@ -136,6 +136,7 @@ template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; +template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; From noreply at r-forge.r-project.org Sat Sep 14 14:00:58 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 14:00:58 +0200 (CEST) Subject: [Rcpp-commits] r4482 - pkg/RcppArmadillo Message-ID: <20130914120058.2370C184D0D@r-forge.r-project.org> Author: edd Date: 2013-09-14 14:00:57 +0200 (Sat, 14 Sep 2013) New Revision: 4482 Modified: pkg/RcppArmadillo/ChangeLog Log: emacs whitespace adjustment for changelog Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-14 11:57:22 UTC (rev 4481) +++ pkg/RcppArmadillo/ChangeLog 2013-09-14 12:00:57 UTC (rev 4482) @@ -1,27 +1,27 @@ -2013-09-13 Romain Francois +2013-09-13 Romain Francois * DESCRIPTION : require Rcpp 0.10.4.4 - * include/RcppArmadilloForward.h : declaration of specializations of InputParameter - for references and const reference to arma::Mat - * include/RcppArmadilloAs.h : definitions of the above - -2013-08-24 Romain Francois + * include/RcppArmadilloForward.h : declaration of specializations of + InputParameter for references and const reference to arma::Mat + * include/RcppArmadilloAs.h : definitions of the above - * include/RcppArmadilloExtensions/sample.h: added include guard, made - functions SampleReplace, etc ... templates to avoid the multiple definitions - problem +2013-08-24 Romain Francois -2013-08-21 Romain Francois + * include/RcppArmadilloExtensions/sample.h: added include guard, made + functions SampleReplace, etc ... templates to avoid the multiple + definitions problem +2013-08-21 Romain Francois + * include/RcppArmadilloWrap.h: Less data copies for wrap< SpMat > * include/RcppArmadilloAs.h: Less data copies for as< SpMat > -2013-08-20 Romain Francois +2013-08-20 Romain Francois * include/RcppArmadilloWrap.h: Handle wrap * include/RcppArmadilloWrap.h: cleaner implementation for wrap< SpMat > * include/RcppArmadilloAs.h: cleaner implementation for as< SpMat > - + 2013-08-17 Dirk Eddelbuettel * vignettes/RcppArmadillo-intro.Rnw: Converted from LaTeX minted From noreply at r-forge.r-project.org Sat Sep 14 14:06:17 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 14:06:17 +0200 (CEST) Subject: [Rcpp-commits] r4483 - pkg/RcppArmadillo/inst/include Message-ID: <20130914120617.A0893184D0D@r-forge.r-project.org> Author: edd Date: 2013-09-14 14:06:17 +0200 (Sat, 14 Sep 2013) New Revision: 4483 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h Log: emacs untabify and reindent Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-14 12:00:57 UTC (rev 4482) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-14 12:06:17 UTC (rev 4483) @@ -26,138 +26,138 @@ namespace Rcpp{ namespace traits { - template - class Exporter< arma::Col > : public IndexingExporter< arma::Col, T > { - public: - Exporter(SEXP x) : IndexingExporter< arma::Col, T >(x){} - }; + template + class Exporter< arma::Col > : public IndexingExporter< arma::Col, T > { + public: + Exporter(SEXP x) : IndexingExporter< arma::Col, T >(x){} + }; - template - class Exporter< arma::Row > : public IndexingExporter< arma::Row, T > { - public: - Exporter(SEXP x) : IndexingExporter< arma::Row, T >(x){} - }; + template + class Exporter< arma::Row > : public IndexingExporter< arma::Row, T > { + public: + Exporter(SEXP x) : IndexingExporter< arma::Row, T >(x){} + }; - template - class Exporter< arma::Mat > : public MatrixExporter< arma::Mat, T > { - public: - Exporter(SEXP x) : MatrixExporter< arma::Mat, T >(x){} - }; - - template - class Exporter< const arma::Mat& > { - public: - typedef typename Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > MATRIX ; - - Exporter(SEXP x) : mat(x) {} - - inline arma::Mat* get(){ - return new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; - } - - private: - MATRIX mat ; - }; - - template - class Exporter< arma::SpMat > { - public: - Exporter( SEXP x ) : mat(x){} - - arma::SpMat get(){ - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + template + class Exporter< arma::Mat > : public MatrixExporter< arma::Mat, T > { + public: + Exporter(SEXP x) : MatrixExporter< arma::Mat, T >(x){} + }; + + template + class Exporter< const arma::Mat& > { + public: + typedef typename Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > MATRIX ; + + Exporter(SEXP x) : mat(x) {} + + inline arma::Mat* get(){ + return new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; + } + + private: + MATRIX mat ; + }; + + template + class Exporter< arma::SpMat > { + public: + Exporter( SEXP x ) : mat(x){} + + arma::SpMat get(){ + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - IntegerVector dims = mat.slot("Dim"); - IntegerVector i = mat.slot("i") ; - IntegerVector p = mat.slot("p") ; - Vector x = mat.slot("x") ; - - arma::SpMat res(dims[0], dims[1]); - - // create space for values, and copy - arma::access::rw(res.values) = arma::memory::acquire_chunked(x.size() + 1); - arma::arrayops::copy(arma::access::rwp(res.values), x.begin(), x.size() + 1); - - // create space for row_indices, and copy - arma::access::rw(res.row_indices) = arma::memory::acquire_chunked(i.size() + 1); - std::copy( i.begin(), i.end(), arma::access::rwp(res.row_indices) ) ; - - // create space for col_ptrs, and copy - arma::access::rw(res.col_ptrs) = arma::memory::acquire(p.size() + 2); - std::copy(p.begin(), p.end(), arma::access::rwp(res.col_ptrs) ); - - // important: set the sentinel as well - arma::access::rwp(res.col_ptrs)[p.size()+1] = std::numeric_limits::max(); - - // set the number of non-zero elements - arma::access::rw(res.n_nonzero) = x.size(); - - return res; - } - - private: - S4 mat ; - } ; -} - - template + IntegerVector dims = mat.slot("Dim"); + IntegerVector i = mat.slot("i") ; + IntegerVector p = mat.slot("p") ; + Vector x = mat.slot("x") ; + + arma::SpMat res(dims[0], dims[1]); + + // create space for values, and copy + arma::access::rw(res.values) = arma::memory::acquire_chunked(x.size() + 1); + arma::arrayops::copy(arma::access::rwp(res.values), x.begin(), x.size() + 1); + + // create space for row_indices, and copy + arma::access::rw(res.row_indices) = arma::memory::acquire_chunked(i.size() + 1); + std::copy( i.begin(), i.end(), arma::access::rwp(res.row_indices) ) ; + + // create space for col_ptrs, and copy + arma::access::rw(res.col_ptrs) = arma::memory::acquire(p.size() + 2); + std::copy(p.begin(), p.end(), arma::access::rwp(res.col_ptrs) ); + + // important: set the sentinel as well + arma::access::rwp(res.col_ptrs)[p.size()+1] = std::numeric_limits::max(); + + // set the number of non-zero elements + arma::access::rw(res.n_nonzero) = x.size(); + + return res; + } + + private: + S4 mat ; + } ; +} + + template class InputParameter< const arma::Mat& > { - public: - typedef const typename arma::Mat& const_reference ; - - InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} - - inline operator const_reference(){ - return mat ; - } - - private: - Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; - arma::Mat mat ; + public: + typedef const typename arma::Mat& const_reference ; + + InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + + inline operator const_reference(){ + return mat ; + } + + private: + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; + arma::Mat mat ; } ; template class InputParameter< arma::Mat& > { - public: - typedef typename arma::Mat& reference ; - - InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} - - inline operator reference(){ - return mat ; - } - - private: - Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; - arma::Mat mat ; + public: + typedef typename arma::Mat& reference ; + + InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + + inline operator reference(){ + return mat ; + } + + private: + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; + arma::Mat mat ; } ; template class ArmaVec_InputParameter { - public: - ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( v.begin(), v.size(), false ){} - - inline operator REF(){ - return vec ; - } - - private: - Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > v ; - VEC vec ; + public: + ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( v.begin(), v.size(), false ){} + + inline operator REF(){ + return vec ; + } + + private: + Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > v ; + VEC vec ; } ; - #define MAKE_INPUT_PARAMETER(TYPE,REF) \ - template \ - class InputParameter : public ArmaVec_InputParameter{ \ - public: \ - InputParameter( SEXP x) : ArmaVec_InputParameter(x){} \ - } ; +#define MAKE_INPUT_PARAMETER(TYPE,REF) \ + template \ + class InputParameter : public ArmaVec_InputParameter{ \ + public: \ + InputParameter( SEXP x) : ArmaVec_InputParameter(x){} \ + } ; - MAKE_INPUT_PARAMETER(arma::Col, const arma::Col& ) - MAKE_INPUT_PARAMETER(arma::Col, arma::Col& ) - MAKE_INPUT_PARAMETER(arma::Row, const arma::Row& ) - MAKE_INPUT_PARAMETER(arma::Row, arma::Row& ) - #undef MAKE_INPUT_PARAMETER + MAKE_INPUT_PARAMETER(arma::Col, const arma::Col& ) + MAKE_INPUT_PARAMETER(arma::Col, arma::Col& ) + MAKE_INPUT_PARAMETER(arma::Row, const arma::Row& ) + MAKE_INPUT_PARAMETER(arma::Row, arma::Row& ) +#undef MAKE_INPUT_PARAMETER } #endif From noreply at r-forge.r-project.org Sat Sep 14 14:27:14 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 14:27:14 +0200 (CEST) Subject: [Rcpp-commits] r4484 - in pkg/Rcpp: . src Message-ID: <20130914122714.56BFC185D31@r-forge.r-project.org> Author: edd Date: 2013-09-14 14:27:14 +0200 (Sat, 14 Sep 2013) New Revision: 4484 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/src/attributes.cpp Log: need an extra space before closing '>' to avoid getting '>>' on (templated) arguments already ending in '>' Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-14 12:06:17 UTC (rev 4483) +++ pkg/Rcpp/ChangeLog 2013-09-14 12:27:14 UTC (rev 4484) @@ -1,3 +1,7 @@ +2013-09-14 Dirk Eddelbuettel + + * src/attributes.cpp (Rcpp): Precede closing '>' by space to avoid '>>' + 2013-09-13 Romain Francois * src/api.cpp : added "long long" to the capabilities function. Modified: pkg/Rcpp/src/attributes.cpp =================================================================== --- pkg/Rcpp/src/attributes.cpp 2013-09-14 12:06:17 UTC (rev 4483) +++ pkg/Rcpp/src/attributes.cpp 2013-09-14 12:27:14 UTC (rev 4484) @@ -2167,7 +2167,8 @@ for (size_t i = 0; i " << argument.name() + ostr << " Rcpp::InputParameter< " + << argument.type().full_name() << " > " << argument.name() << "(" << argument.name() << "SEXP );" << std::endl; } From noreply at r-forge.r-project.org Sat Sep 14 22:24:07 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 22:24:07 +0200 (CEST) Subject: [Rcpp-commits] r4485 - in pkg/Rcpp: . inst/include/Rcpp/platform Message-ID: <20130914202407.277E2181299@r-forge.r-project.org> Author: edd Date: 2013-09-14 22:24:06 +0200 (Sat, 14 Sep 2013) New Revision: 4485 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: Further refine #if test for 'long long' by conditioning __LP64__ on also using clang/llvm Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-14 12:27:14 UTC (rev 4484) +++ pkg/Rcpp/ChangeLog 2013-09-14 20:24:06 UTC (rev 4485) @@ -1,5 +1,8 @@ 2013-09-14 Dirk Eddelbuettel + * inst/include/Rcpp/platform/compiler.h: Further refine #if test for + 'long long' by conditioning __LP64__ on also using clang/llvm + * src/attributes.cpp (Rcpp): Precede closing '>' by space to avoid '>>' 2013-09-13 Romain Francois Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-14 12:27:14 UTC (rev 4484) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-14 20:24:06 UTC (rev 4485) @@ -178,7 +178,7 @@ #endif #ifdef __GNUC__ -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__LP64__) +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) #ifdef __LONG_LONG_MAX__ __extension__ typedef long long int rcpp_long_long_type; __extension__ typedef unsigned long long int rcpp_ulong_long_type; From noreply at r-forge.r-project.org Sun Sep 15 14:59:41 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Sep 2013 14:59:41 +0200 (CEST) Subject: [Rcpp-commits] r4486 - in pkg/Rcpp: . inst/include/Rcpp inst/include/Rcpp/macros src Message-ID: <20130915125941.BA8AC185065@r-forge.r-project.org> Author: romain Date: 2013-09-15 14:59:41 +0200 (Sun, 15 Sep 2013) New Revision: 4486 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/InputParameter.h pkg/Rcpp/inst/include/Rcpp/macros/module.h pkg/Rcpp/src/attributes.cpp Log: introduce traits::input_parameter so that we can have std::vector& again Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-14 20:24:06 UTC (rev 4485) +++ pkg/Rcpp/ChangeLog 2013-09-15 12:59:41 UTC (rev 4486) @@ -1,9 +1,19 @@ +2013-09-15 Romain Francois + + * include/Rcpp/InputParameter.h : added the traits::input_parameter trait + to add another layer of abstration. + * include/Rcpp/macros/module.h : taking advantage of input_parameter to + specialize how to work with module objects + * src/attributes.cpp : using traits::input_parameter instead of + InputParameter + 2013-09-14 Dirk Eddelbuettel + * src/attributes.cpp : Precede closing '>' by space to avoid '>>' * inst/include/Rcpp/platform/compiler.h: Further refine #if test for 'long long' by conditioning __LP64__ on also using clang/llvm - * src/attributes.cpp (Rcpp): Precede closing '>' by space to avoid '>>' + * src/attributes.cpp : Precede closing '>' by space to avoid '>>' 2013-09-13 Romain Francois Modified: pkg/Rcpp/inst/include/Rcpp/InputParameter.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/InputParameter.h 2013-09-14 20:24:06 UTC (rev 4485) +++ pkg/Rcpp/inst/include/Rcpp/InputParameter.h 2013-09-15 12:59:41 UTC (rev 4486) @@ -22,8 +22,10 @@ #ifndef Rcpp__InputParameter__h #define Rcpp__InputParameter__h -namespace Rcpp { +namespace Rcpp { + // default implementation used for pass by value and modules objects + // as<> is called on the conversion operator template class InputParameter { public: @@ -35,6 +37,48 @@ SEXP x ; } ; + // impl for references. It holds an object at the constructor and then + // returns a reference in the reference operator + template + class ReferenceInputParameter { + public: + typedef T& reference ; + ReferenceInputParameter(SEXP x_) : obj( as(x_) ){} + + inline operator reference() { return obj ; } + + private: + T obj ; + } ; + + // same for const references + template + class ConstReferenceInputParameter { + public: + typedef const T& const_reference ; + ConstReferenceInputParameter(SEXP x_) : obj( as(x_) ){} + + inline operator const_reference() { return obj ; } + + private: + T obj ; + } ; + + namespace traits{ + template + struct input_parameter { + typedef typename Rcpp::InputParameter type ; + } ; + template + struct input_parameter { + typedef typename Rcpp::ReferenceInputParameter type ; + } ; + template + struct input_parameter { + typedef typename Rcpp::ConstReferenceInputParameter type ; + } ; + } + } #endif Modified: pkg/Rcpp/inst/include/Rcpp/macros/module.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/macros/module.h 2013-09-14 20:24:06 UTC (rev 4485) +++ pkg/Rcpp/inst/include/Rcpp/macros/module.h 2013-09-15 12:59:41 UTC (rev 4486) @@ -44,6 +44,21 @@ template<> struct r_type_traits< const CLASS& >{ \ typedef r_type_module_object_const_reference_tag r_category ; \ } ; \ + template<> struct input_parameter< CLASS* >{ \ + typedef Rcpp::InputParameter type ; \ + } ; \ + template<> struct input_parameter< const CLASS* >{ \ + typedef Rcpp::InputParameter type ; \ + } ; \ + template<> struct input_parameter< CLASS >{ \ + typedef Rcpp::InputParameter type ; \ + } ; \ + template<> struct input_parameter< CLASS& >{ \ + typedef Rcpp::InputParameter type ; \ + } ; \ + template<> struct input_parameter< const CLASS& >{ \ + typedef Rcpp::InputParameter type ; \ + } ; \ }} #define RCPP_EXPOSED_WRAP(CLASS) namespace Rcpp{ namespace traits{ template<> struct wrap_type_traits< CLASS >{typedef wrap_type_module_object_tag wrap_category ; } ; }} Modified: pkg/Rcpp/src/attributes.cpp =================================================================== --- pkg/Rcpp/src/attributes.cpp 2013-09-14 20:24:06 UTC (rev 4485) +++ pkg/Rcpp/src/attributes.cpp 2013-09-15 12:59:41 UTC (rev 4486) @@ -2167,8 +2167,8 @@ for (size_t i = 0; i " << argument.name() + ostr << " Rcpp::traits::input_parameter< " + << argument.type().full_name() << " >::type " << argument.name() << "(" << argument.name() << "SEXP );" << std::endl; } From noreply at r-forge.r-project.org Sun Sep 15 15:01:18 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Sep 2013 15:01:18 +0200 (CEST) Subject: [Rcpp-commits] r4487 - in pkg/RcppArmadillo: . inst/include Message-ID: <20130915130118.E436118600F@r-forge.r-project.org> Author: romain Date: 2013-09-15 15:01:18 +0200 (Sun, 15 Sep 2013) New Revision: 4487 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h Log: adapt to Rcpp changes Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-15 12:59:41 UTC (rev 4486) +++ pkg/RcppArmadillo/ChangeLog 2013-09-15 13:01:18 UTC (rev 4487) @@ -1,3 +1,9 @@ +2013-09-15 Romain Francois + + * include/RcppArmadilloForward.h : declaration of specializations of + ConstReferenceInputParameter and ReferenceInputParameter + * include/RcppArmadilloAs.h : definitions of the above + 2013-09-13 Romain Francois * DESCRIPTION : require Rcpp 0.10.4.4 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-15 12:59:41 UTC (rev 4486) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-15 13:01:18 UTC (rev 4487) @@ -101,14 +101,14 @@ } template - class InputParameter< const arma::Mat& > { + class ConstReferenceInputParameter< arma::Mat > { public: typedef const typename arma::Mat& const_reference ; - InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + ConstReferenceInputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} inline operator const_reference(){ - return mat ; + return mat ; } private: @@ -117,11 +117,11 @@ } ; template - class InputParameter< arma::Mat& > { + class ReferenceInputParameter< arma::Mat > { public: typedef typename arma::Mat& reference ; - InputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + ReferenceInputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} inline operator reference(){ return mat ; @@ -146,17 +146,17 @@ VEC vec ; } ; -#define MAKE_INPUT_PARAMETER(TYPE,REF) \ +#define MAKE_INPUT_PARAMETER(INPUT_TYPE,TYPE,REF) \ template \ - class InputParameter : public ArmaVec_InputParameter{ \ + class INPUT_TYPE : public ArmaVec_InputParameter{ \ public: \ - InputParameter( SEXP x) : ArmaVec_InputParameter(x){} \ + INPUT_TYPE( SEXP x) : ArmaVec_InputParameter(x){} \ } ; - MAKE_INPUT_PARAMETER(arma::Col, const arma::Col& ) - MAKE_INPUT_PARAMETER(arma::Col, arma::Col& ) - MAKE_INPUT_PARAMETER(arma::Row, const arma::Row& ) - MAKE_INPUT_PARAMETER(arma::Row, arma::Row& ) + MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Col, const arma::Col& ) + MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Col, arma::Col& ) + MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Row, const arma::Row& ) + MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Row, arma::Row& ) #undef MAKE_INPUT_PARAMETER } Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-15 12:59:41 UTC (rev 4486) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-15 13:01:18 UTC (rev 4487) @@ -96,14 +96,14 @@ } // namespace traits - template class InputParameter< const arma::Mat& > ; - template class InputParameter< arma::Mat& > ; + template class ConstReferenceInputParameter< arma::Mat > ; + template class ReferenceInputParameter< arma::Mat > ; - template class InputParameter< const arma::Col& > ; - template class InputParameter< arma::Col& > ; + template class ConstReferenceInputParameter< arma::Col > ; + template class ReferenceInputParameter< arma::Col > ; - template class InputParameter< const arma::Row& > ; - template class InputParameter< arma::Row& > ; + template class ConstReferenceInputParameter< arma::Row > ; + template class ReferenceInputParameter< arma::Row > ; } From noreply at r-forge.r-project.org Sun Sep 15 21:42:23 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Sep 2013 21:42:23 +0200 (CEST) Subject: [Rcpp-commits] r4488 - in pkg/Rcpp: . inst/unitTests inst/unitTests/cpp Message-ID: <20130915194223.933B8184ECD@r-forge.r-project.org> Author: edd Date: 2013-09-15 21:42:23 +0200 (Sun, 15 Sep 2013) New Revision: 4488 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/unitTests/cpp/Vector.cpp pkg/Rcpp/inst/unitTests/runit.Vector.R Log: new tests for std::vector and std::vector conversions Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-15 13:01:18 UTC (rev 4487) +++ pkg/Rcpp/ChangeLog 2013-09-15 19:42:23 UTC (rev 4488) @@ -1,12 +1,18 @@ -2013-09-15 Romain Francois - - * include/Rcpp/InputParameter.h : added the traits::input_parameter trait - to add another layer of abstration. - * include/Rcpp/macros/module.h : taking advantage of input_parameter to - specialize how to work with module objects - * src/attributes.cpp : using traits::input_parameter instead of +2013-09-15 Dirk Eddelbuettel + + * inst/unitTests/cpp/Vector.cpp: New unit tests for std::vector + conversions, using both int and double arguments + * inst/unitTests/runit.Vector.R: R complement of these tests + +2013-09-15 Romain Francois + + * include/Rcpp/InputParameter.h : added the traits::input_parameter + trait to add another layer of abstration. + * include/Rcpp/macros/module.h : taking advantage of input_parameter + to specialize how to work with module objects + * src/attributes.cpp : using traits::input_parameter instead of InputParameter - + 2013-09-14 Dirk Eddelbuettel * src/attributes.cpp : Precede closing '>' by space to avoid '>>' Modified: pkg/Rcpp/inst/unitTests/cpp/Vector.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/Vector.cpp 2013-09-15 13:01:18 UTC (rev 4487) +++ pkg/Rcpp/inst/unitTests/cpp/Vector.cpp 2013-09-15 19:42:23 UTC (rev 4488) @@ -729,3 +729,42 @@ } #endif +// [[Rcpp::export]] +int stdVectorDouble(std::vector x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorDoubleConst(const std::vector x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorDoubleRef(std::vector & x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorDoubleConstRef(const std::vector & x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorInt(std::vector x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorIntConst(const std::vector x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorIntRef(std::vector & x) { + return x.size(); +} + +// [[Rcpp::export]] +int stdVectorIntConstRef(const std::vector & x) { + return x.size(); +} Modified: pkg/Rcpp/inst/unitTests/runit.Vector.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.Vector.R 2013-09-15 13:01:18 UTC (rev 4487) +++ pkg/Rcpp/inst/unitTests/runit.Vector.R 2013-09-15 19:42:23 UTC (rev 4488) @@ -589,9 +589,9 @@ test.CharacterVector.equality.operator <- function(){ res <- CharacterVectorEqualityOperator( letters, letters ) - checkEquals( res, - list( rep( TRUE, 26L ), rep( FALSE, 26L) ), - msg = 'CharacterVector element equality operator' ) + checkEquals( res, + list( rep( TRUE, 26L ), rep( FALSE, 26L) ), + msg = 'CharacterVector element equality operator' ) } test.List.rep.ctor <- function(){ @@ -640,3 +640,53 @@ } } + +test.std.vector.double <- function() { + fun <- stdVectorDouble + x <- seq(1.0, 5.0, by=1.0) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorDouble") +} + +test.std.vector.double.const <- function() { + fun <- stdVectorDoubleConst + x <- seq(1.0, 5.0, by=1.0) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorDoubleConst") +} + +test.std.vector.double.ref <- function() { + fun <- stdVectorDoubleRef + x <- seq(1.0, 5.0, by=1.0) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorDoubleRef") +} + +test.std.vector.double.const.ref <- function() { + fun <- stdVectorDoubleConstRef + x <- seq(1.0, 5.0, by=1.0) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorDoubleConstRef") +} + +test.std.vector.int <- function() { + fun <- stdVectorInt + x <- seq(1L, 5L, by=1L) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorInt") +} + +test.std.vector.int.const <- function() { + fun <- stdVectorIntConst + x <- seq(1L, 5L, by=1L) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorIntConst") +} + +test.std.vector.int.ref <- function() { + fun <- stdVectorIntRef + x <- seq(1L, 5L, by=1L) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorIntRef") +} + +test.std.vector.int.const.ref <- function() { + fun <- stdVectorIntConstRef + x <- seq(1L, 5L, by=1L) + checkEquals(fun(x), 5, msg = "automatic conversion of stdVectorIntConstRef") +} + + From noreply at r-forge.r-project.org Sun Sep 15 22:18:34 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Sep 2013 22:18:34 +0200 (CEST) Subject: [Rcpp-commits] r4489 - in pkg/Rcpp: . inst/include/Rcpp Message-ID: <20130915201834.AA25A186046@r-forge.r-project.org> Author: edd Date: 2013-09-15 22:18:34 +0200 (Sun, 15 Sep 2013) New Revision: 4489 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/InputParameter.h Log: Add 'const' case to complement 'plain', 'reference' and 'const reference' Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-15 19:42:23 UTC (rev 4488) +++ pkg/Rcpp/ChangeLog 2013-09-15 20:18:34 UTC (rev 4489) @@ -1,5 +1,7 @@ 2013-09-15 Dirk Eddelbuettel + * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case + * inst/unitTests/cpp/Vector.cpp: New unit tests for std::vector conversions, using both int and double arguments * inst/unitTests/runit.Vector.R: R complement of these tests Modified: pkg/Rcpp/inst/include/Rcpp/InputParameter.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/InputParameter.h 2013-09-15 19:42:23 UTC (rev 4488) +++ pkg/Rcpp/inst/include/Rcpp/InputParameter.h 2013-09-15 20:18:34 UTC (rev 4489) @@ -50,6 +50,19 @@ private: T obj ; } ; + + // same for const + template + class ConstInputParameter { + public: + typedef const T const_nonref ; + ConstInputParameter(SEXP x_) : obj( as(x_) ){} + + inline operator const_nonref() { return obj ; } + + private: + T obj ; + } ; // same for const references template @@ -74,6 +87,10 @@ typedef typename Rcpp::ReferenceInputParameter type ; } ; template + struct input_parameter { + typedef typename Rcpp::ConstInputParameter type ; + } ; + template struct input_parameter { typedef typename Rcpp::ConstReferenceInputParameter type ; } ; From noreply at r-forge.r-project.org Sun Sep 15 23:17:02 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Sep 2013 23:17:02 +0200 (CEST) Subject: [Rcpp-commits] r4490 - in pkg/RcppArmadillo: . inst/include inst/unitTests inst/unitTests/cpp vignettes Message-ID: <20130915211702.B5651186099@r-forge.r-project.org> Author: edd Date: 2013-09-15 23:17:02 +0200 (Sun, 15 Sep 2013) New Revision: 4490 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw Log: also add const case following Romain's commits for const ref and ref added unit tests for all three for both matrices and vectors Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/ChangeLog 2013-09-15 21:17:02 UTC (rev 4490) @@ -1,5 +1,12 @@ -2013-09-15 Romain Francois - +2013-09-15 Dirk Eddelbuettel + + * inst/include/RcppArmadilloAs.h: Also define ConstInputParameter + * inst/include/RcppArmadilloForward.h: Ditto for declaration + * inst/unitTests/runit.RcppArmadillo.R: New unit tests for these + * inst/unitTests/cpp/armadillo.cpp: C++ code for new unit tests + +2013-09-15 Romain Francois + * include/RcppArmadilloForward.h : declaration of specializations of ConstReferenceInputParameter and ReferenceInputParameter * include/RcppArmadilloAs.h : definitions of the above Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-15 21:17:02 UTC (rev 4490) @@ -131,6 +131,18 @@ Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; arma::Mat mat ; } ; + + template + class ConstInputParameter< arma::Mat > { + public: + typedef const typename arma::Mat const_nonref; + ConstInputParameter(SEXP x_) : m(x_), mat(m.begin(), m.nrow(), m.ncol(), false){} + inline operator const_nonref() { return mat ; } + private: + Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; + arma::Mat mat ; + }; + template class ArmaVec_InputParameter { @@ -155,8 +167,10 @@ MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Col, const arma::Col& ) MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Col, arma::Col& ) + MAKE_INPUT_PARAMETER(ConstInputParameter , arma::Col, const arma::Col ) MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Row, const arma::Row& ) MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Row, arma::Row& ) + MAKE_INPUT_PARAMETER(ConstInputParameter , arma::Row, const arma::Row ) #undef MAKE_INPUT_PARAMETER } Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-09-15 21:17:02 UTC (rev 4490) @@ -98,12 +98,15 @@ template class ConstReferenceInputParameter< arma::Mat > ; template class ReferenceInputParameter< arma::Mat > ; + template class ConstInputParameter< arma::Mat > ; template class ConstReferenceInputParameter< arma::Col > ; template class ReferenceInputParameter< arma::Col > ; + template class ConstInputParameter< arma::Col > ; template class ConstReferenceInputParameter< arma::Row > ; template class ReferenceInputParameter< arma::Row > ; + template class ConstInputParameter< arma::Row > ; } Modified: pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp =================================================================== --- pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp 2013-09-15 21:17:02 UTC (rev 4490) @@ -210,3 +210,45 @@ // checkException(fun(), msg="RTTI check on matrix constructor exception") // } + + +// [[Rcpp::export]] +int mat_plain(arma::mat x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int mat_const(const arma::mat x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int mat_ref(arma::mat & x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int mat_const_ref(const arma::mat & x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int vec_plain(arma::vec x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int vec_const(const arma::vec x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int vec_ref(arma::vec & x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int vec_const_ref(const arma::vec & x) { + return x.n_elem; +} + Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R =================================================================== --- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-09-15 21:17:02 UTC (rev 4490) @@ -160,3 +160,52 @@ ## checkException(fun(), msg="RTTI check on matrix constructor exception") ## } + +test.armadillo.mat.plain <- function() { + fx <- mat_plain + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Plain Matrix function signature" ) +} + +test.armadillo.mat.const <- function() { + fx <- mat_const + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Const Matrix function signature" ) +} + +test.armadillo.mat.ref <- function() { + fx <- mat_ref + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Reference Matrix function signature" ) +} + +test.armadillo.mat.const.ref <- function() { + fx <- mat_const_ref + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Const Reference Matrix function signature" ) +} + +test.armadillo.vec.plain <- function() { + fx <- vec_plain + m <- 1:9 + checkEquals(fx(m), 9, msg = "Plain Vector function signature" ) +} + +test.armadillo.vec.const <- function() { + fx <- vec_const + m <- 1:9 + checkEquals(fx(m), 9, msg = "Const Vector function signature" ) +} + +test.armadillo.vec.ref <- function() { + fx <- vec_ref + m <- 1:9 + checkEquals(fx(m), 9, msg = "Reference Vector function signature" ) +} + +test.armadillo.vec.const.ref <- function() { + fx <- vec_const_ref + m <- 1:9 + checkEquals(fx(m), 9, msg = "Const Reference Vector function signature" ) +} + Modified: pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw =================================================================== --- pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw 2013-09-15 20:18:34 UTC (rev 4489) +++ pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw 2013-09-15 21:17:02 UTC (rev 4490) @@ -18,8 +18,8 @@ \usepackage[colorlinks]{hyperref} \author{Dirk Eddelbuettel, Romain Fran\c{c}ois and Douglas Bates} -\title{RcppArmadillo : Unit testing results} -\date{\texttt{RcppArmadillo} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} +\title{\textbf{RcppArmadillo}: Unit testing results} +\date{\textbf{RcppArmadillo} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} \begin{document} \maketitle From noreply at r-forge.r-project.org Mon Sep 16 02:50:05 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 02:50:05 +0200 (CEST) Subject: [Rcpp-commits] r4491 - pkg/Rcpp Message-ID: <20130916005005.C32291860D2@r-forge.r-project.org> Author: edd Date: 2013-09-16 02:50:05 +0200 (Mon, 16 Sep 2013) New Revision: 4491 Modified: pkg/Rcpp/.Rbuildignore Log: do not install vignettes/jss.bst Modified: pkg/Rcpp/.Rbuildignore =================================================================== --- pkg/Rcpp/.Rbuildignore 2013-09-15 21:17:02 UTC (rev 4490) +++ pkg/Rcpp/.Rbuildignore 2013-09-16 00:50:05 UTC (rev 4491) @@ -4,6 +4,7 @@ inst/doc/man build inst/doc/jss.bst +vignettes/jss.bst ^.*\.Rproj$ ^\.Rproj\.user$ inst/include/Rcpp/preprocessor From noreply at r-forge.r-project.org Mon Sep 16 02:50:39 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 02:50:39 +0200 (CEST) Subject: [Rcpp-commits] r4492 - pkg/Rcpp/R Message-ID: <20130916005039.CC10A184AFD@r-forge.r-project.org> Author: edd Date: 2013-09-16 02:50:39 +0200 (Mon, 16 Sep 2013) New Revision: 4492 Modified: pkg/Rcpp/R/RcppLdpath.R Log: two base R functions we can access via :: instead of ::: Modified: pkg/Rcpp/R/RcppLdpath.R =================================================================== --- pkg/Rcpp/R/RcppLdpath.R 2013-09-16 00:50:05 UTC (rev 4491) +++ pkg/Rcpp/R/RcppLdpath.R 2013-09-16 00:50:39 UTC (rev 4492) @@ -17,7 +17,7 @@ ## make sure system.file returns an absolute path Rcpp.system.file <- function(...){ - tools:::file_path_as_absolute( base:::system.file( ..., package = "Rcpp" ) ) + tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) ) } ## identifies if the default linking on the platform should be static From noreply at r-forge.r-project.org Mon Sep 16 11:54:18 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 11:54:18 +0200 (CEST) Subject: [Rcpp-commits] r4493 - in pkg/Rcpp: . inst/include/Rcpp/api/meat inst/include/Rcpp/internal Message-ID: <20130916095419.09DBA184671@r-forge.r-project.org> Author: romain Date: 2013-09-16 11:54:18 +0200 (Mon, 16 Sep 2013) New Revision: 4493 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/api/meat/export.h pkg/Rcpp/inst/include/Rcpp/internal/Exporter.h Log: faster as< std::vector > Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-16 00:50:39 UTC (rev 4492) +++ pkg/Rcpp/ChangeLog 2013-09-16 09:54:18 UTC (rev 4493) @@ -1,3 +1,10 @@ +2013-09-16 Romain Francois + + * include/Rcpp/internal/Exporter.h : Specific handling of containers (std::vector, + std::deque, and std::list so that we use their faster range constructor when + we can, and so let the STL optimize how data is copied + * include/Rcpp/api/meat/export.h : Implementation of the above + 2013-09-15 Dirk Eddelbuettel * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/export.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/export.h 2013-09-16 00:50:39 UTC (rev 4492) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/export.h 2013-09-16 09:54:18 UTC (rev 4493) @@ -35,6 +35,38 @@ } // namespace internal + + namespace traits{ + + template < template class ContainerTemplate, typename T > class ContainerExporter { + public: + typedef ContainerTemplate > Container ; + const static int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; + + ContainerExporter( SEXP x ) : object(x){} + ~ContainerExporter(){} + + Container get(){ + if( TYPEOF(object) == RTYPE ){ + T* start = Rcpp::internal::r_vector_start(object) ; + return Container( start, start + Rf_length(object) ) ; + } + Container vec( ::Rf_length(object) ); + ::Rcpp::internal::export_range( object, vec.begin() ) ; + return vec ; + } + + private: + SEXP object ; + } ; + template < template class Container > struct container_exporter< Container, int >{ + typedef ContainerExporter< Container, int > type ; + } ; + template < template class Container > struct container_exporter< Container, double >{ + typedef ContainerExporter< Container, double > type ; + } ; + + } } // namespace Rcpp #endif Modified: pkg/Rcpp/inst/include/Rcpp/internal/Exporter.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/internal/Exporter.h 2013-09-16 00:50:39 UTC (rev 4492) +++ pkg/Rcpp/inst/include/Rcpp/internal/Exporter.h 2013-09-16 09:54:18 UTC (rev 4493) @@ -1,9 +1,8 @@ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- -/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // exporter.h: Rcpp R/C++ interface class library -- identify if a class has a nested iterator typedef // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -26,33 +25,33 @@ namespace Rcpp{ namespace traits{ - template class Exporter{ - public: - Exporter( SEXP x ) : t(x){} - inline T get(){ return t ; } - - private: - T t ; - } ; - - template class RangeExporter { - public: - typedef typename T::value_type r_export_type ; + template class Exporter{ + public: + Exporter( SEXP x ) : t(x){} + inline T get(){ return t ; } + + private: + T t ; + } ; + + template class RangeExporter { + public: + typedef typename T::value_type r_export_type ; + + RangeExporter( SEXP x ) : object(x){} + ~RangeExporter(){} + + T get(){ + T vec( ::Rf_length(object) ); + ::Rcpp::internal::export_range( object, vec.begin() ) ; + return vec ; + } + + private: + SEXP object ; + } ; - RangeExporter( SEXP x ) : object(x){} - ~RangeExporter(){} - - T get(){ - T vec( ::Rf_length(object) ); - ::Rcpp::internal::export_range( object, vec.begin() ) ; - return vec ; - } - - private: - SEXP object ; - } ; - - template class IndexingExporter { + template class IndexingExporter { public: typedef value_type r_export_type ; @@ -92,20 +91,26 @@ SEXP object ; } ; - - template class Exporter< std::vector > : public RangeExporter< std::vector > { + template < template class Container, typename T> + struct container_exporter{ + typedef RangeExporter< Container > > type ; + } ; + template < template class Container > struct container_exporter< Container, int > ; + template < template class Container > struct container_exporter< Container, double > ; + + template class Exporter< std::vector > : public container_exporter< std::vector, T>::type { public: - Exporter(SEXP x) : RangeExporter< std::vector >(x){} + Exporter(SEXP x) : container_exporter< std::vector, T>::type(x){} }; - template class Exporter< std::deque > : public RangeExporter< std::deque > { + template class Exporter< std::deque > : public container_exporter< std::deque, T>::type { public: - Exporter(SEXP x) : RangeExporter< std::deque >(x){} + Exporter(SEXP x) : container_exporter< std::deque, T>::type(x){} }; - template class Exporter< std::list > : public RangeExporter< std::list > { + template class Exporter< std::list > : public container_exporter< std::list, T>::type { public: - Exporter(SEXP x) : RangeExporter< std::list >(x){} + Exporter(SEXP x) : container_exporter< std::list, T>::type(x){} }; - + } // namespace traits } // namespace Rcpp #endif From noreply at r-forge.r-project.org Mon Sep 16 14:06:42 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 14:06:42 +0200 (CEST) Subject: [Rcpp-commits] r4494 - in pkg/Rcpp: . R inst Message-ID: <20130916120642.3A643183F49@r-forge.r-project.org> Author: jjallaire Date: 2013-09-16 14:06:41 +0200 (Mon, 16 Sep 2013) New Revision: 4494 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/R/Attributes.R pkg/Rcpp/inst/NEWS.Rd Log: Remove calls to non-exported functions from the tools package Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-16 09:54:18 UTC (rev 4493) +++ pkg/Rcpp/ChangeLog 2013-09-16 12:06:41 UTC (rev 4494) @@ -1,3 +1,7 @@ +2013-09-16 JJ Allaire + + * R/Attributes.R : Remove calls to non-exported functions from the tools package + 2013-09-16 Romain Francois * include/Rcpp/internal/Exporter.h : Specific handling of containers (std::vector, Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-16 09:54:18 UTC (rev 4493) +++ pkg/Rcpp/R/Attributes.R 2013-09-16 12:06:41 UTC (rev 4494) @@ -309,13 +309,12 @@ descFile <- file.path(pkgdir,"DESCRIPTION") if (!file.exists(descFile)) stop("pkgdir must refer to the directory containing an R package") - - pkgInfo <- tools:::.split_description(tools:::.read_description(descFile)) - pkgname <- as.character(pkgInfo$DESCRIPTION["Package"]) - depends <- unique(names(pkgInfo$Depends)) - if (is.null(depends)) - depends <- character() - + pkgDesc <- read.dcf(descFile)[1,] + pkgname = .readPkgDescField(pkgDesc, "Package") + depends <- .readPkgDescField(pkgDesc, "Depends", character()) + depends <- unique(.splitDepends(depends)) + depends <- depends[depends != "R"] + # determine source directory srcDir <- file.path(pkgdir, "src") if (!file.exists(srcDir)) @@ -330,7 +329,7 @@ cppFiles <- list.files(srcDir, pattern=glob2rx("*.c*")) # derive base names (will be used for modules) - cppFileBasenames <- tools:::file_path_sans_ext(cppFiles) + cppFileBasenames <- tools::file_path_sans_ext(cppFiles) # expend them to their full paths cppFiles <- file.path(srcDir, cppFiles) @@ -338,7 +337,7 @@ # generate the includes list based on LinkingTo. Specify plugins-only # because we only need as/wrap declarations - linkingTo <- as.character(pkgInfo$DESCRIPTION["LinkingTo"]) + linkingTo <- .readPkgDescField(pkgDesc, "LinkingTo") includes <- .linkingToIncludes(linkingTo, TRUE) # if a master include file is defined for the package then include it @@ -450,7 +449,25 @@ } } +# Split the depends field of a package description +.splitDepends <- function(x) { + if (!length(x)) + return(character()) + x <- unlist(strsplit(x, ",")) + x <- sub("[[:space:]]+$", "", x) + x <- unique(sub("^[[:space:]]*(.*)", "\\1", x)) + sub("^([[:alnum:].]+).*$", "\\1", x) +} +# read a field from a named package description character vector +.readPkgDescField <- function(pkgDesc, name, default = NULL) { + if (name %in% names(pkgDesc)) + pkgDesc[[name]] + else + default +} + + # Get the inline plugin for the specified package (return NULL if none found) .getInlinePlugin <- function(package) { tryCatch(get("inlineCxxPlugin", asNamespace(package)), Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-16 09:54:18 UTC (rev 4493) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-16 12:06:41 UTC (rev 4494) @@ -47,6 +47,7 @@ For users, it means that for the parameters of function exported by modules, we can now use references, pointers and const versions of them. The file \code{Module.cpp} file has an example. + \item{No longer call non-exported functions from the tools package} } \item Changes in Modules: \itemize{ From noreply at r-forge.r-project.org Mon Sep 16 15:20:11 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 15:20:11 +0200 (CEST) Subject: [Rcpp-commits] r4495 - in pkg/Rcpp: . inst/include/Rcpp/vector Message-ID: <20130916132011.C0BF3185606@r-forge.r-project.org> Author: romain Date: 2013-09-16 15:20:11 +0200 (Mon, 16 Sep 2013) New Revision: 4495 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/inst/include/Rcpp/vector/Vector.h Log: added Vector(const char*) ctor Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-16 12:06:41 UTC (rev 4494) +++ pkg/Rcpp/ChangeLog 2013-09-16 13:20:11 UTC (rev 4495) @@ -8,7 +8,9 @@ std::deque, and std::list so that we use their faster range constructor when we can, and so let the STL optimize how data is copied * include/Rcpp/api/meat/export.h : Implementation of the above - + * include/Rcpp/vector/Vector.h : added Vector( const char* ) ctor + * DESCRIPTION : bump to 0.10.4.5 (for RcppExtras) + 2013-09-15 Dirk Eddelbuettel * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-09-16 12:06:41 UTC (rev 4494) +++ pkg/Rcpp/DESCRIPTION 2013-09-16 13:20:11 UTC (rev 4495) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.4.4 +Version: 0.10.4.5 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2013-09-16 12:06:41 UTC (rev 4494) +++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2013-09-16 13:20:11 UTC (rev 4495) @@ -87,6 +87,11 @@ RCPP_DEBUG_2( "Vector<%d>( const std::string& = %s )", RTYPE, st.c_str() ) update_vector(); } + Vector( const char* st ) : RObject( internal::vector_from_string(st) ){ + RCPP_DEBUG_2( "Vector<%d>( const std::string& = %s )", RTYPE, st.c_str() ) + update_vector(); + } + Vector( const int& siz, stored_type (*gen)(void) ) : RObject(Rf_allocVector( RTYPE, siz)) { RCPP_DEBUG_2( "Vector<%d>( const int& siz = %s, stored_type (*gen)(void) )", RTYPE, siz ) update_vector() ; From noreply at r-forge.r-project.org Mon Sep 16 17:02:22 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 16 Sep 2013 17:02:22 +0200 (CEST) Subject: [Rcpp-commits] r4496 - pkg/Rcpp/R Message-ID: <20130916150222.1A00F1855D9@r-forge.r-project.org> Author: edd Date: 2013-09-16 17:02:21 +0200 (Mon, 16 Sep 2013) New Revision: 4496 Modified: pkg/Rcpp/R/Module.R Log: per R CMD check, replace methods:::getClass with a :: variant Modified: pkg/Rcpp/R/Module.R =================================================================== --- pkg/Rcpp/R/Module.R 2013-09-16 13:20:11 UTC (rev 4495) +++ pkg/Rcpp/R/Module.R 2013-09-16 15:02:21 UTC (rev 4496) @@ -239,7 +239,7 @@ ) rm( .self, .refClassDef ) - classDef <- methods:::getClass(clname) + classDef <- methods::getClass(clname) ## non-public (static) fields in class representation ## Should these become real fields? fields <- classDef at fieldPrototypes From noreply at r-forge.r-project.org Tue Sep 17 16:18:38 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 17 Sep 2013 16:18:38 +0200 (CEST) Subject: [Rcpp-commits] r4497 - in pkg/Rcpp: . R inst man Message-ID: <20130917141838.43E76184FA8@r-forge.r-project.org> Author: edd Date: 2013-09-17 16:18:37 +0200 (Tue, 17 Sep 2013) New Revision: 4497 Added: pkg/Rcpp/man/RcppLdFlags.Rd Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/NAMESPACE pkg/Rcpp/R/Attributes.R pkg/Rcpp/R/SHLIB.R pkg/Rcpp/R/inline.R pkg/Rcpp/inst/NEWS.Rd Log: The function RcppLdFlags, used to build packages using Rcpp, is now exported. Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/ChangeLog 2013-09-17 14:18:37 UTC (rev 4497) @@ -1,3 +1,11 @@ +2013-09-17 Dirk Eddelbuettel + + * NAMESPACE: Export RcppLdFlags which is often used to build Rcpp + * man/RcppLdFlags.Rd: Added required manual page + * R/Attributes.R: Call RcppLdFlags() via '::' instead of ':::' + * R/SHLIB.R: Ditto + * R/inline.R: Ditto + 2013-09-16 JJ Allaire * R/Attributes.R : Remove calls to non-exported functions from the tools package Modified: pkg/Rcpp/NAMESPACE =================================================================== --- pkg/Rcpp/NAMESPACE 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/NAMESPACE 2013-09-17 14:18:37 UTC (rev 4497) @@ -1,22 +1,31 @@ + useDynLib(Rcpp, .registration = TRUE) -import( methods ) -importFrom( utils, capture.output, assignInNamespace, .DollarNames, prompt, packageDescription ) +import(methods) +importFrom(utils, capture.output, assignInNamespace, .DollarNames, prompt, packageDescription) -exportClasses( Module, "C++Field", - "C++OverloadedMethods", - "C++Constructor", - "C++Class", "C++Object", "C++Function" - ) +exportClasses(Module, "C++Field", + "C++OverloadedMethods", + "C++Constructor", + "C++Class", "C++Object", "C++Function") -S3method( .DollarNames, "C++Object" ) -S3method( .DollarNames, "Module" ) -exportMethods( prompt, show, .DollarNames, initialize, "formals<-" ) +S3method(.DollarNames, "C++Object") +S3method(.DollarNames, "Module") +exportMethods(prompt, show, .DollarNames, initialize, "formals<-") -export( - Module, Rcpp.package.skeleton, populate, loadRcppModules, setRcppClass, - loadModule, cppFunction, evalCpp, sourceCpp, compileAttributes, registerPlugin -) +export(Module, + Rcpp.package.skeleton, + populate, + loadRcppModules, + setRcppClass, + loadModule, + cppFunction, + evalCpp, + sourceCpp, + compileAttributes, + registerPlugin, + RcppLdFlags + ) exportClass(RcppClass) Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/R/Attributes.R 2013-09-17 14:18:37 UTC (rev 4497) @@ -312,9 +312,9 @@ pkgDesc <- read.dcf(descFile)[1,] pkgname = .readPkgDescField(pkgDesc, "Package") depends <- .readPkgDescField(pkgDesc, "Depends", character()) - depends <- unique(.splitDepends(depends)) + depends <- unique(.splitDepends(depends)) depends <- depends[depends != "R"] - + # determine source directory srcDir <- file.path(pkgdir, "src") if (!file.exists(srcDir)) @@ -451,7 +451,7 @@ # Split the depends field of a package description .splitDepends <- function(x) { - if (!length(x)) + if (!length(x)) return(character()) x <- unlist(strsplit(x, ",")) x <- sub("[[:space:]]+$", "", x) @@ -566,7 +566,7 @@ # we are using a plugin -- confirm that the plugin includes the Rcpp # PKG_LIBS and if it doesn't then add them pkgLibs <- buildEnv$PKG_LIBS - rcppLibs <- Rcpp:::RcppLdFlags() + rcppLibs <- Rcpp::RcppLdFlags() if (is.null(pkgLibs) || !grepl(rcppLibs, pkgLibs, fixed = TRUE)) buildEnv$PKG_LIBS <- paste(pkgLibs, rcppLibs) } Modified: pkg/Rcpp/R/SHLIB.R =================================================================== --- pkg/Rcpp/R/SHLIB.R 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/R/SHLIB.R 2013-09-17 14:18:37 UTC (rev 4497) @@ -14,10 +14,10 @@ # # You should have received a copy of the GNU General Public License # along with Rcpp. If not, see . - -SHLIB.maker <- function(env = - list( - PKG_LIBS = Rcpp:::RcppLdFlags(), + +SHLIB.maker <- function(env = + list( + PKG_LIBS = Rcpp::RcppLdFlags(), PKG_CPPFLAGS = Rcpp:::RcppCxxFlags() ) ){ @@ -26,7 +26,7 @@ R <- file.path( R.home(component = "bin"), "R" ) system( sprintf( "%s CMD SHLIB %s", R, cmd ) ) } -} - +} + SHLIB <- SHLIB.maker() Modified: pkg/Rcpp/R/inline.R =================================================================== --- pkg/Rcpp/R/inline.R 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/R/inline.R 2013-09-17 14:18:37 UTC (rev 4497) @@ -42,7 +42,7 @@ ", include.before, include.after ) list( - env = list( PKG_LIBS = paste( libs, Rcpp:::RcppLdFlags() ) ), + env = list( PKG_LIBS = paste( libs, Rcpp::RcppLdFlags() ) ), includes = includes, LinkingTo = LinkingTo , body = function( x ){ Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-16 15:02:21 UTC (rev 4496) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-17 14:18:37 UTC (rev 4497) @@ -34,6 +34,8 @@ if you expose a class \code{Foo} via modules, then you can wrap \code{vector}, ... An example is included in the \code{wrap} unit test file + \item \code{RcppLdFlags()}, often used in \code{Makevars} files of + packages using \pkg{Rcpp}, is now exported from the package namespace. } \item Changes in Attributes: \itemize{ Added: pkg/Rcpp/man/RcppLdFlags.Rd =================================================================== --- pkg/Rcpp/man/RcppLdFlags.Rd (rev 0) +++ pkg/Rcpp/man/RcppLdFlags.Rd 2013-09-17 14:18:37 UTC (rev 4497) @@ -0,0 +1,41 @@ +\name{RcppLdFlags} +\alias{RcppLdFlags} +\title{Provide Rcpp Linker Flags} +\description{ + \code{RcppLdFlags} returns the required flags and options for the the + system linker. This allows portable use of \pkg{Rcpp} as package + location as well as operating-system specific details are abstracted + away behind the interface of this function. + + It is commonly called from the files \code{Makevars} (or + \code{Makevars.win}) rather than in an interactive session. +} +\usage{ +RcppLdFlags(static=staticLinking()) +} +\arguments{ + \item{static}{A boolean determining use of static (as opposed to + dynamic) linking; defaults to using the \code{staticLinking()} + function which defaults to \code{FALSE} on Linux, and \code{TRUE} + if the operating system is different from Linux.} +} +\value{ + A character vector suitable by use by the system linker in order to + create a library based on \pkg{Rcpp}. +} +\details{ + This function is not meant to used interactively, and is intended + solely for use by the build tools. +} +\references{ + Dirk Eddelbuettel and Romain Francois (2011). \pkg{Rcpp}: Seamless R + and C++ Integration. \emph{Journal of Statistical Software}, + \bold{40(8)}, 1-18. URL http://www.jstatsoft.org/v40/i08/ and + available as \code{vignette("Rcpp-introduction")}. +} +\seealso{ + The vignette \sQuote{Rcpp-package} has more details. +} +\author{Dirk Eddelbuettel and Romain Francois} +\keyword{programming} +\keyword{interface} From noreply at r-forge.r-project.org Tue Sep 17 21:38:25 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 17 Sep 2013 21:38:25 +0200 (CEST) Subject: [Rcpp-commits] r4498 - in pkg/Rcpp: . vignettes Message-ID: <20130917193825.5A361183F77@r-forge.r-project.org> Author: edd Date: 2013-09-17 21:38:24 +0200 (Tue, 17 Sep 2013) New Revision: 4498 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw pkg/Rcpp/vignettes/Rcpp-attributes.Rnw pkg/Rcpp/vignettes/Rcpp-extending.Rnw pkg/Rcpp/vignettes/Rcpp-modules.Rnw pkg/Rcpp/vignettes/Rcpp-package.Rnw pkg/Rcpp/vignettes/Rcpp-quickref.Rnw pkg/Rcpp/vignettes/Rcpp-sugar.Rnw Log: Add %\VignetteEngine{highlight::highlight} to vignettes Still have issue with two vignettes at this point Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/ChangeLog 2013-09-17 19:38:24 UTC (rev 4498) @@ -6,6 +6,14 @@ * R/SHLIB.R: Ditto * R/inline.R: Ditto + * vignettes/Rcpp-FAQ.Rnw: Add %\VignetteEngine{highlight::highlight} + * vignettes/Rcpp-attributes.Rnw: Idem + * vignettes/Rcpp-extending.Rnw: Idem + * vignettes/Rcpp-modules.Rnw: Idem + * vignettes/Rcpp-package.Rnw: Idem + * vignettes/Rcpp-quickref.Rnw: Idem + * vignettes/Rcpp-sugar.Rnw: Idem + 2013-09-16 JJ Allaire * R/Attributes.R : Remove calls to non-exported functions from the tools package Modified: pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-FAQ} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} Modified: pkg/Rcpp/vignettes/Rcpp-attributes.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[11pt]{article} %\VignetteIndexEntry{Rcpp-attributes} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{1.25in}{1.25in}{1.25in}{1.25in} Modified: pkg/Rcpp/vignettes/Rcpp-extending.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-extending.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-extending.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-extending} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} Modified: pkg/Rcpp/vignettes/Rcpp-modules.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-modules} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-package} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} \usepackage{color,alltt} Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[8pt,twocolumn,a4paper]{article} %\VignetteIndexEntry{Rcpp-quickref} +%\VignetteEngine{highlight::highlight} \setlength{\hoffset}{-0.8in} \setlength{\voffset}{-0.8in} Modified: pkg/Rcpp/vignettes/Rcpp-sugar.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-sugar.Rnw 2013-09-17 14:18:37 UTC (rev 4497) +++ pkg/Rcpp/vignettes/Rcpp-sugar.Rnw 2013-09-17 19:38:24 UTC (rev 4498) @@ -1,5 +1,6 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-sugar} +%\VignetteEngine{highlight::highlight} \usepackage[USletter]{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} From noreply at r-forge.r-project.org Tue Sep 17 23:27:17 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 17 Sep 2013 23:27:17 +0200 (CEST) Subject: [Rcpp-commits] r4499 - in pkg/Rcpp: . R Message-ID: <20130917212718.0A9BD180AB3@r-forge.r-project.org> Author: jjallaire Date: 2013-09-17 23:27:17 +0200 (Tue, 17 Sep 2013) New Revision: 4499 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/R/Attributes.R Log: Call inlineCxxPlugin and Rcpp.plugin.maker without qualification rather than with '...' Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-17 19:38:24 UTC (rev 4498) +++ pkg/Rcpp/ChangeLog 2013-09-17 21:27:17 UTC (rev 4499) @@ -1,3 +1,7 @@ +2013-09-17 JJ Allaire + + * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without qualification rather than with '...' + 2013-09-17 Dirk Eddelbuettel * NAMESPACE: Export RcppLdFlags which is often used to build Rcpp Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-17 19:38:24 UTC (rev 4498) +++ pkg/Rcpp/R/Attributes.R 2013-09-17 21:27:17 UTC (rev 4499) @@ -561,7 +561,7 @@ # if there is no buildEnv from a plugin then use the Rcpp plugin if (length(buildEnv) == 0) { - buildEnv <- Rcpp:::inlineCxxPlugin()$env + buildEnv <- inlineCxxPlugin()$env } else { # we are using a plugin -- confirm that the plugin includes the Rcpp # PKG_LIBS and if it doesn't then add them @@ -795,7 +795,7 @@ # Rcpp.plugin.maker. If the plugin$includes has this suffix we know # it's an Rcpp plugin token <- "include_after_token" - stockRcppPlugin <- Rcpp:::Rcpp.plugin.maker(include.after=token) + stockRcppPlugin <- Rcpp.plugin.maker(include.after=token) includes <- stockRcppPlugin()$includes suffix <- strsplit(includes, token)[[1]][[2]] From noreply at r-forge.r-project.org Wed Sep 18 04:33:27 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 04:33:27 +0200 (CEST) Subject: [Rcpp-commits] r4500 - in pkg/Rcpp: . vignettes Message-ID: <20130918023327.2CDD918577A@r-forge.r-project.org> Author: edd Date: 2013-09-18 04:33:25 +0200 (Wed, 18 Sep 2013) New Revision: 4500 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/vignettes/Rcpp-package.Rnw Log: changes to vignette to allow building under R-devel also finalises switched updated highlight package does no longer build embedded demo package (as the unitTests already do anyway) Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-17 21:27:17 UTC (rev 4499) +++ pkg/Rcpp/ChangeLog 2013-09-18 02:33:25 UTC (rev 4500) @@ -1,12 +1,13 @@ 2013-09-17 JJ Allaire - * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without qualification rather than with '...' + * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without + qualification rather than with '...' 2013-09-17 Dirk Eddelbuettel * NAMESPACE: Export RcppLdFlags which is often used to build Rcpp * man/RcppLdFlags.Rd: Added required manual page - * R/Attributes.R: Call RcppLdFlags() via '::' instead of ':::' + * R/Attributes.R: Call RcppLdFlags() via '::' instead of ':::' * R/SHLIB.R: Ditto * R/inline.R: Ditto @@ -17,20 +18,25 @@ * vignettes/Rcpp-package.Rnw: Idem * vignettes/Rcpp-quickref.Rnw: Idem * vignettes/Rcpp-sugar.Rnw: Idem - -2013-09-16 JJ Allaire + * vignettes/Rcpp-package.Rnw: Altered to make use of highlight + package; also no longer build embedded demo package (which upsets R + CMD check under R-devel) + +2013-09-16 JJ Allaire + * R/Attributes.R : Remove calls to non-exported functions from the tools package -2013-09-16 Romain Francois +2013-09-16 Romain Francois - * include/Rcpp/internal/Exporter.h : Specific handling of containers (std::vector, - std::deque, and std::list so that we use their faster range constructor when - we can, and so let the STL optimize how data is copied + * include/Rcpp/internal/Exporter.h : Specific handling of containers + (std::vector, std::deque, and std::list so that we use their faster + range constructor when we can, and so let the STL optimize how data + is copied * include/Rcpp/api/meat/export.h : Implementation of the above * include/Rcpp/vector/Vector.h : added Vector( const char* ) ctor * DESCRIPTION : bump to 0.10.4.5 (for RcppExtras) - + 2013-09-15 Dirk Eddelbuettel * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-17 21:27:17 UTC (rev 4499) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 02:33:25 UTC (rev 4500) @@ -27,7 +27,7 @@ \newcommand{\hlboxbacktick}{ \hlnormalsizeboxbacktick} \newcommand{\hlboxunderscore}{ \hlnormalsizeboxunderscore} -<>= +<>= prettyVersion <- packageDescription("Rcpp")$Version prettyDate <- format(Sys.Date(), "%B %e, %Y") @ @@ -36,29 +36,31 @@ \title{Writing a package that uses \pkg{Rcpp} } \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} -<>= +<>= require(Rcpp) require(highlight) -link <- function( f, package, text = f, root = "http://finzi.psych.upenn.edu/R/library/" ){ - h <- if( missing(package) ) { - as.character( help( f ) ) - } else { - as.character( help( f, package = paste( package, sep = "" ) ) ) - } - if( ! length(h) ){ - sprintf( "\\\\textbf{%s}", f ) - } else { - rx <- "^.*/([^/]*?)/help/(.*?)$" - package <- sub( rx, "\\1", h, perl = TRUE ) - page <- sub( rx, "\\2", h, perl = TRUE ) - sprintf( "\\\\href{%s%s/html/%s.html}{\\\\texttt{%s}}", root, package, page, text ) - } +link <- function( f, package, text = f, root = "http://finzi.psych.upenn.edu/R/library/") { + h <- if( missing(package) ) { + as.character( help( f ) ) + } else { + as.character( help( f, package = paste( package, sep = "" ) ) ) + } + if( ! length(h) ){ + sprintf( "\\\\textbf{%s}", f ) + } else { + rx <- "^.*/([^/]*?)/help/(.*?)$" + package <- sub( rx, "\\1", h, perl = TRUE ) + page <- sub( rx, "\\2", h, perl = TRUE ) + sprintf( "\\\\href{%s%s/html/%s.html}{\\\\texttt{%s}}", root, package, page, text ) + } } -linkS4class <- function( cl, package, text = cl, root = "http://finzi.psych.upenn.edu/R/library/" ){ - link( sprintf("%s-class", cl), package, text, root ) +linkS4class <- function(cl, package, text=cl, root="http://finzi.psych.upenn.edu/R/library/") { + link( sprintf("%s-class", cl), package, text, root ) } @ + + \begin{document} \maketitle @@ -116,58 +118,34 @@ aims to create by invoking the function. An illustration of a call using an argument \texttt{mypackage} is provided below. -<>= -here <- getwd() -gendir <- tempfile() -dir.create( gendir ) -setwd( gendir ) -Rcpp.package.skeleton( "mypackage" ) -dir.create( tlib <- tempfile() ) -system( sprintf( 'R CMD INSTALL --library="%s" mypackage ', tlib ) ) -require( "mypackage", lib.loc = tlib ) -setwd(here) +<>= +Rcpp.package.skeleton("mypackage") @ - -% <<>>= -% Rcpp.package.skeleton( "mypackage" ) -% writeLines( system( "tree" , intern = TRUE ) ) -% @ \begin{Hchunk} -\begin{Hinput} -\ttfamily\noindent -\hlprompt{\usebox{\hlboxgreaterthan}{\ }}\hlfunctioncall{Rcpp.package.skeleton}\hlkeyword{(}{\ }\hlstring{"mypackage"}{\ }\hlkeyword{)}\mbox{} -\normalfont +\begin{verbatim} +$ ls -1R mypackage/ +mypackage/: +DESCRIPTION +man +NAMESPACE +R +Read-and-delete-me +src -\end{Hinput} +mypackage/man: +mypackage-package.Rd +rcpp_hello_world.Rd -\begin{Hinput} -\ttfamily\noindent -\hlprompt{\usebox{\hlboxgreaterthan}{\ }}\hlfunctioncall{writeLines}\hlkeyword{(}{\ }\hlfunctioncall{system}\hlkeyword{(}{\ }\hlstring{"tree"}\hlkeyword{,}{\ }\hlargument{intern}{\ }\hlargument{=}{\ }\hlnumber{TRUE}{\ }\hlkeyword{)}{\ }\hlkeyword{)}\mbox{} -\normalfont -\end{Hinput} +mypackage/R: +rcpp_hello_world.R -\begin{Houtput} -\ttfamily\noindent -.\hspace*{\fill}\\ -\hlstd{}\usebox{\hlboxbacktick}--{\ }mypackage\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|--{\ }DESCRIPTION\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|--{\ }NAMESPACE\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|--{\ }R\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|{\ }{\ }{\ }\usebox{\hlboxbacktick}--{\ }rcpp\usebox{\hlboxunderscore}hello\usebox{\hlboxunderscore}world.R\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|--{\ }Read-and-delete-me\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|--{\ }man\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|{\ }{\ }{\ }|--{\ }mypackage-package.Rd\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }|{\ }{\ }{\ }\usebox{\hlboxbacktick}--{\ }rcpp\usebox{\hlboxunderscore}hello\usebox{\hlboxunderscore}world.Rd\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }\usebox{\hlboxbacktick}--{\ }src\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }{\ }{\ }{\ }{\ }|--{\ }Makevars\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }{\ }{\ }{\ }{\ }|--{\ }Makevars.win\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }{\ }{\ }{\ }{\ }|--{\ }rcpp\usebox{\hlboxunderscore}hello\usebox{\hlboxunderscore}world.cpp\hspace*{\fill}\\ -\hlstd{}{\ }{\ }{\ }{\ }{\ }{\ }{\ }{\ }\usebox{\hlboxbacktick}--{\ }rcpp\usebox{\hlboxunderscore}hello\usebox{\hlboxunderscore}world.h\hspace*{\fill}\\ -\hlstd{}\hspace*{\fill}\\ -\hlstd{}4{\ }directories,{\ }10{\ }files\hspace*{\fill}\\ -\hlstd{}\mbox{} -\normalfont -\end{Houtput} +mypackage/src: +Makevars +Makevars.win +rcpp_hello_world.cpp +rcpp_hello_world.h +$ +\end{verbatim} \end{Hchunk} Using \Sexpr{link("Rcpp.package.skeleton")} is by far the simplest approach @@ -182,11 +160,10 @@ invoke the \proglang{C++} function \texttt{rcpp\_hello\_world} from the package \texttt{mypackage}. -<>= -highlight( - file.path( gendir, "mypackage", "R", "rcpp_hello_world.R" ), - renderer = renderer_latex( doc = FALSE ) - ) +<>= +rcpp_hello_world <- function(){ + .Call( "rcpp_hello_world", PACKAGE = "mypackage" ) +} @ \pkg{Rcpp} uses the \Sexpr{link(".Call")} calling convention as it allows @@ -204,32 +181,52 @@ The \proglang{C++} function is declared in the \texttt{rcpp\_hello\_world.h} header file: -<>= -external_highlight( - file.path( gendir, "mypackage", "src", "rcpp_hello_world.h" ), - type = "LATEX", - doc = FALSE - ) +<>= +#ifndef _mypackage_RCPP_HELLO_WORLD_H +#define _mypackage_RCPP_HELLO_WORLD_H + +#include + +/* + * note : RcppExport is an alias to `extern "C"` defined by Rcpp. + * + * It gives C calling convention to the rcpp_hello_world function so that + * it can be called from .Call in R. Otherwise, the C++ compiler mangles the + * name of the function and .Call can't find it. + * + * It is only useful to use RcppExport when the function is intended to be called + * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672 + * on Rcpp-devel for a misuse of RcppExport + */ +RcppExport SEXP rcpp_hello_world() ; + +#endif @ The header includes the \texttt{Rcpp.h} file, which is the only file that needs to be included to use \pkg{Rcpp}. The function is then implemented in the \texttt{rcpp\_hello\_world.cpp} file -<>= -external_highlight( - file.path( gendir, "mypackage", "src", "rcpp_hello_world.cpp" ), - type = "LATEX", - doc = FALSE -) +<>= +#include "rcpp_hello_world.h" + +SEXP rcpp_hello_world(){ + using namespace Rcpp ; + + CharacterVector x = CharacterVector::create( "foo", "bar" ) ; + NumericVector y = NumericVector::create( 0.0, 1.0 ) ; + List z = List::create( x, y ) ; + + return z ; +} @ The function creates an \proglang{R} list that contains a \Sexpr{link("character")} vector and a \Sexpr{link("numeric")} vector using \pkg{Rcpp} classes. At the \proglang{R} level, we will therefore receive a list of -length two containing these two vectors: +length two containing these two vectors. -<<>>= +<>= rcpp_hello_world( ) @ @@ -238,14 +235,21 @@ The skeleton generates an appropriate \texttt{DESCRIPTION} file, using both \texttt{Depends:} and \texttt{LinkingTo} for \pkg{Rcpp}: -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "DESCRIPTION" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +Package: mypackage +Type: Package +Title: What the package does (short line) +Version: 1.0 +Date: 2013-09-17 +Author: Who wrote it +Maintainer: Who to complain to +Description: More about what it does (maybe more than one line) +License: What Licence is it under ? +Depends: Rcpp (>= 0.10.4.5) +LinkingTo: Rcpp +\end{verbatim} +\end{Hchunk} \Sexpr{link("Rcpp.package.skeleton")} adds the three last lines to the \texttt{DESCRIPTION} file generated by \Sexpr{link("package.skeleton")}. @@ -264,39 +268,57 @@ \texttt{Makevars} and \texttt{Makevars.win} files. \pkg{Rcpp} provides the unexported function \texttt{Rcpp:::LdFlags()} to ease the process: -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "src", "Makevars" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +## Use the R_HOME indirection to support installations of multiple R version +PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` +## As an alternative, one can also add this code in a file 'configure' +## +## PKG_LIBS=`${R_HOME}/bin/Rscript -e "Rcpp:::LdFlags()"` +## +## sed -e "s|@PKG_LIBS@|${PKG_LIBS}|" \ +## src/Makevars.in > src/Makevars +## +## which together with the following file 'src/Makevars.in' +## +## PKG_LIBS = @PKG_LIBS@ +## +## can be used to create src/Makevars dynamically. This scheme is more +## powerful and can be expanded to also check for and link with other +## libraries. It should be complemented by a file 'cleanup' +## +## rm src/Makevars +## +## which removes the autogenerated file src/Makevars. +## +## Of course, autoconf can also be used to write configure files. This is +## done by a number of packages, but recommended only for more advanced users +## comfortable with autoconf and its related tools. +\end{verbatim} +\end{Hchunk} + + The \texttt{Makevars.win} is the equivalent, targeting windows. -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "src", "Makevars.win" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +## Use the R_HOME indirection to support installations of multiple R version +PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") +\end{verbatim} +\end{Hchunk} \subsection{\texttt{NAMESPACE}} The \Sexpr{link("Rcpp.package.skeleton")} function also creates a file \texttt{NAMESPACE}. -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "NAMESPACE" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +useDynLib(mypackage) +exportPattern("^[[:alpha:]]+") +\end{verbatim} +\end{Hchunk} This file serves two purposes. First, it ensure that the dynamic library contained in the package we are creating via @@ -319,29 +341,75 @@ The help file \texttt{mypackage-package.Rd} can be used to describe the new package. -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "man", "mypackage-package.Rd" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +\name{mypackage-package} +\alias{mypackage-package} +\alias{mypackage} +\docType{package} +\title{ +What the package does (short line) +} +\description{ +More about what it does (maybe more than one line) +~~ A concise (1-5 lines) description of the package ~~ +} +\details{ +\tabular{ll}{ +Package: \tab mypackage\cr +Type: \tab Package\cr +Version: \tab 1.0\cr +Date: \tab 2013-09-17\cr +License: \tab What license is it under?\cr +} +~~ An overview of how to use the package, including the most important functions ~~ +} +\author{ +Who wrote it +Maintainer: Who to complain to +} +\references{ +~~ Literature or other references for background information ~~ +} +~~ Optionally other standard keywords, one per line, from file KEYWORDS in the R documentation directory ~~ +\keyword{ package } +\seealso{ +~~ Optional links to other man pages, e.g. ~~ +~~ \code{\link[:-package]{}} ~~ +} +\examples{ +%% ~~ simple examples of the most important functions ~~ +} +\end{verbatim} +\end{Hchunk} \subsubsection{\texttt{rcpp\_hello\_world.Rd}} The help file \texttt{rcpp\_hello\_world.Rd} serves as documentation for the example \proglang{R} function. -<>= -local({ - tf <- sprintf( "%s.make", tempfile() ) - file.copy( file.path( gendir, "mypackage", "man", "rcpp_hello_world.Rd" ), tf ) - external_highlight( tf, type = "LATEX", doc = FALSE ) - unlink( tf ) -}) -@ +\begin{Hchunk} +\begin{verbatim} +\name{rcpp_hello_world} +\alias{rcpp_hello_world} +\docType{package} +\title{ +Simple function using Rcpp +} +\description{ +Simple function using Rcpp +} +\usage{ +rcpp_hello_world() +} +\examples{ +\dontrun{ +rcpp_hello_world() +} +} +\end{verbatim} +\end{Hchunk} \section{Further examples} From noreply at r-forge.r-project.org Wed Sep 18 04:34:00 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 04:34:00 +0200 (CEST) Subject: [Rcpp-commits] r4501 - in pkg/Rcpp: inst/doc vignettes Message-ID: <20130918023400.A272018577A@r-forge.r-project.org> Author: edd Date: 2013-09-18 04:34:00 +0200 (Wed, 18 Sep 2013) New Revision: 4501 Added: pkg/Rcpp/vignettes/rcpp.index.html Removed: pkg/Rcpp/inst/doc/rcpp.index.html Modified: pkg/Rcpp/vignettes/.install_extras Log: moved one more file from inst/doc/ to vignettes/ Deleted: pkg/Rcpp/inst/doc/rcpp.index.html =================================================================== --- pkg/Rcpp/inst/doc/rcpp.index.html 2013-09-18 02:33:25 UTC (rev 4500) +++ pkg/Rcpp/inst/doc/rcpp.index.html 2013-09-18 02:34:00 UTC (rev 4501) @@ -1,45 +0,0 @@ - -R: Rcpp vignettes - - -

Rcpp Vignettes

- - -

Rcpp Online Documentation

- - - -

Rcpp Development

- - - -

Related packages

- - - - - - Modified: pkg/Rcpp/vignettes/.install_extras =================================================================== --- pkg/Rcpp/vignettes/.install_extras 2013-09-18 02:33:25 UTC (rev 4500) +++ pkg/Rcpp/vignettes/.install_extras 2013-09-18 02:34:00 UTC (rev 4501) @@ -1 +1,2 @@ Rcpp.bib +rcpp.index.html Copied: pkg/Rcpp/vignettes/rcpp.index.html (from rev 4499, pkg/Rcpp/inst/doc/rcpp.index.html) =================================================================== --- pkg/Rcpp/vignettes/rcpp.index.html (rev 0) +++ pkg/Rcpp/vignettes/rcpp.index.html 2013-09-18 02:34:00 UTC (rev 4501) @@ -0,0 +1,45 @@ + +R: Rcpp vignettes + + +

Rcpp Vignettes

+ + +

Rcpp Online Documentation

+ + + +

Rcpp Development

+ + + +

Related packages

+ + + + + + From noreply at r-forge.r-project.org Wed Sep 18 09:22:15 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 09:22:15 +0200 (CEST) Subject: [Rcpp-commits] r4502 - pkg/Rcpp/vignettes Message-ID: <20130918072215.D94CA184BE6@r-forge.r-project.org> Author: romain Date: 2013-09-18 09:22:15 +0200 (Wed, 18 Sep 2013) New Revision: 4502 Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw Log: editor was confused with quotes Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 02:34:00 UTC (rev 4501) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 07:22:15 UTC (rev 4502) @@ -192,7 +192,7 @@ * * It gives C calling convention to the rcpp_hello_world function so that * it can be called from .Call in R. Otherwise, the C++ compiler mangles the - * name of the function and .Call can't find it. + * name of the function and .Call cannot find it. * * It is only useful to use RcppExport when the function is intended to be called * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672 From noreply at r-forge.r-project.org Wed Sep 18 09:40:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 09:40:08 +0200 (CEST) Subject: [Rcpp-commits] r4503 - pkg/Rcpp/vignettes Message-ID: <20130918074008.DBD18184BE6@r-forge.r-project.org> Author: romain Date: 2013-09-18 09:40:08 +0200 (Wed, 18 Sep 2013) New Revision: 4503 Modified: pkg/Rcpp/vignettes/ pkg/Rcpp/vignettes/Rcpp-package.Rnw pkg/Rcpp/vignettes/Rcpp.bib Log: update highlight version Property changes on: pkg/Rcpp/vignettes ___________________________________________________________________ Added: svn:ignore + *.aux *.bbl *.blg *.aux *.out *.pdf *.tex Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 07:22:15 UTC (rev 4502) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 07:40:08 UTC (rev 4503) @@ -19,14 +19,6 @@ \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} -%% defined as a stop-gap measure til interaction with highlight is sorted out -\newcommand{\hlboxlessthan}{ \hlnormalsizeboxlessthan} -\newcommand{\hlboxgreaterthan}{\hlnormalsizeboxgreaterthan} -\newcommand{\hlboxopenbrace}{ \hlnormalsizeboxopenbrace} -\newcommand{\hlboxclosebrace}{ \hlnormalsizeboxclosebrace} -\newcommand{\hlboxbacktick}{ \hlnormalsizeboxbacktick} -\newcommand{\hlboxunderscore}{ \hlnormalsizeboxunderscore} - <>= prettyVersion <- packageDescription("Rcpp")$Version prettyDate <- format(Sys.Date(), "%B %e, %Y") Modified: pkg/Rcpp/vignettes/Rcpp.bib =================================================================== --- pkg/Rcpp/vignettes/Rcpp.bib 2013-09-18 07:22:15 UTC (rev 4502) +++ pkg/Rcpp/vignettes/Rcpp.bib 2013-09-18 07:40:08 UTC (rev 4503) @@ -251,7 +251,7 @@ title = {highlight: Syntax highlighter}, author = {Romain Fran\c{c}ois}, year = 2013, - note = {R package with version 0.4.1}, + note = {R package with version 0.4.3}, url = CRAN # "package=highlight" } From noreply at r-forge.r-project.org Wed Sep 18 09:40:40 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 09:40:40 +0200 (CEST) Subject: [Rcpp-commits] r4504 - pkg/Rcpp/vignettes Message-ID: <20130918074040.4BD25184BE6@r-forge.r-project.org> Author: romain Date: 2013-09-18 09:40:39 +0200 (Wed, 18 Sep 2013) New Revision: 4504 Modified: pkg/Rcpp/vignettes/ Log: setting svn:ignore Property changes on: pkg/Rcpp/vignettes ___________________________________________________________________ Modified: svn:ignore - *.aux *.bbl *.blg *.aux *.out *.pdf *.tex + *.aux *.bbl *.blg *.aux *.out *.pdf *.tex *.log From noreply at r-forge.r-project.org Wed Sep 18 10:03:45 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 10:03:45 +0200 (CEST) Subject: [Rcpp-commits] r4505 - in pkg/Rcpp: . R inst/skeleton man Message-ID: <20130918080346.0BAB1184D71@r-forge.r-project.org> Author: romain Date: 2013-09-18 10:03:41 +0200 (Wed, 18 Sep 2013) New Revision: 4505 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/R/Rcpp.package.skeleton.R pkg/Rcpp/inst/skeleton/rcpp_hello_world.h pkg/Rcpp/man/Rcpp.package.skeleton.Rd Log: set attributes to TRUE by default in Rcpp.package.skeleton, we should encourage people to use them Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 07:40:39 UTC (rev 4504) +++ pkg/Rcpp/ChangeLog 2013-09-18 08:03:41 UTC (rev 4505) @@ -1,7 +1,7 @@ 2013-09-17 JJ Allaire * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without - qualification rather than with '...' + qualification rather than with ':::' 2013-09-17 Dirk Eddelbuettel Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R =================================================================== --- pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 07:40:39 UTC (rev 4504) +++ pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 08:03:41 UTC (rev 4505) @@ -22,7 +22,7 @@ path = ".", force = FALSE, namespace = TRUE, code_files = character(), cpp_files = character(), example_code = TRUE, - attributes = FALSE, + attributes = TRUE, module = FALSE, author = "Who wrote it", maintainer = if(missing( author)) "Who to complain to" else author, @@ -32,7 +32,9 @@ if (!is.character(cpp_files)) stop("'cpp_files' must be a character vector") - + # set example_code if attributes is set + if( isTRUE(attributes) ) + example_code <- TRUE env <- parent.frame(1) if( !length(list) ){ @@ -115,6 +117,20 @@ } close( ns ) } + + # update the package description help page + package_help_page <- file.path( root, "man", sprintf( "%s-package.Rd" ) ) + if( file.exists(package_help_page) ){ + lines <- readLines(package_help_page) + lines <- gsub( "What license is it under?", license, fixed = TRUE ) + lines <- gsub( "Who to complain to ", + sprintf( "%s <%s>", maintainer, email), + fixed = TRUE + ) + ) + lines <- gsub( "Who wrote it", author, fixed = TRUE ) + writeLines( lines, package_help_page ) + } # lay things out in the src directory src <- file.path( root, "src") Modified: pkg/Rcpp/inst/skeleton/rcpp_hello_world.h =================================================================== --- pkg/Rcpp/inst/skeleton/rcpp_hello_world.h 2013-09-18 07:40:39 UTC (rev 4504) +++ pkg/Rcpp/inst/skeleton/rcpp_hello_world.h 2013-09-18 08:03:41 UTC (rev 4505) @@ -8,7 +8,7 @@ * * It gives C calling convention to the rcpp_hello_world function so that * it can be called from .Call in R. Otherwise, the C++ compiler mangles the - * name of the function and .Call can't find it. + * name of the function and .Call cannot find it. * * It is only useful to use RcppExport when the function is intended to be called * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672 Modified: pkg/Rcpp/man/Rcpp.package.skeleton.Rd =================================================================== --- pkg/Rcpp/man/Rcpp.package.skeleton.Rd 2013-09-18 07:40:39 UTC (rev 4504) +++ pkg/Rcpp/man/Rcpp.package.skeleton.Rd 2013-09-18 08:03:41 UTC (rev 4505) @@ -14,7 +14,7 @@ Rcpp.package.skeleton(name = "anRpackage", list = character(), environment = .GlobalEnv, path = ".", force = FALSE, namespace = TRUE, code_files = character(), cpp_files = character(), - example_code = TRUE, attributes = FALSE, module = FALSE, + example_code = TRUE, attributes = TRUE, module = FALSE, author = "Who wrote it", maintainer = if(missing( author)) "Who to complain to" else author, email = "yourfault at somewhere.net", @@ -64,7 +64,9 @@ If the \code{attributes} argument is \code{TRUE}, then rather than generate the example files as described above, a single \samp{rcpp_hello_world.cpp} - file is created in the \samp{src} directory and it's attributes are compiled. + file is created in the \samp{src} directory and it's attributes are + compiled using the \code{\link{compileAttributes}} function, so files + \samp{RcppExports.R} and \samp{RcppExports.cpp} are generated as well. If the \code{module} argument is \code{TRUE}, a sample Rcpp module will be generated as well. From noreply at r-forge.r-project.org Wed Sep 18 10:08:52 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 10:08:52 +0200 (CEST) Subject: [Rcpp-commits] r4506 - pkg/Rcpp/R Message-ID: <20130918080852.C1234184D71@r-forge.r-project.org> Author: romain Date: 2013-09-18 10:08:52 +0200 (Wed, 18 Sep 2013) New Revision: 4506 Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R Log: ooops Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R =================================================================== --- pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 08:03:41 UTC (rev 4505) +++ pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 08:08:52 UTC (rev 4506) @@ -127,7 +127,6 @@ sprintf( "%s <%s>", maintainer, email), fixed = TRUE ) - ) lines <- gsub( "Who wrote it", author, fixed = TRUE ) writeLines( lines, package_help_page ) } From noreply at r-forge.r-project.org Wed Sep 18 10:11:46 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 10:11:46 +0200 (CEST) Subject: [Rcpp-commits] r4507 - pkg/Rcpp/R Message-ID: <20130918081146.97A721813D4@r-forge.r-project.org> Author: romain Date: 2013-09-18 10:11:46 +0200 (Wed, 18 Sep 2013) New Revision: 4507 Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R Log: oops again Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R =================================================================== --- pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 08:08:52 UTC (rev 4506) +++ pkg/Rcpp/R/Rcpp.package.skeleton.R 2013-09-18 08:11:46 UTC (rev 4507) @@ -119,15 +119,16 @@ } # update the package description help page - package_help_page <- file.path( root, "man", sprintf( "%s-package.Rd" ) ) + package_help_page <- file.path( root, "man", sprintf( "%s-package.Rd", name ) ) if( file.exists(package_help_page) ){ lines <- readLines(package_help_page) - lines <- gsub( "What license is it under?", license, fixed = TRUE ) + lines <- gsub( "What license is it under?", license, lines, fixed = TRUE ) lines <- gsub( "Who to complain to ", - sprintf( "%s <%s>", maintainer, email), + sprintf( "%s <%s>", maintainer, email), + lines, fixed = TRUE ) - lines <- gsub( "Who wrote it", author, fixed = TRUE ) + lines <- gsub( "Who wrote it", author, lines, fixed = TRUE ) writeLines( lines, package_help_page ) } From noreply at r-forge.r-project.org Wed Sep 18 10:47:26 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 10:47:26 +0200 (CEST) Subject: [Rcpp-commits] r4508 - in pkg/Rcpp: . vignettes Message-ID: <20130918084726.434401852B5@r-forge.r-project.org> Author: romain Date: 2013-09-18 10:47:26 +0200 (Wed, 18 Sep 2013) New Revision: 4508 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/vignettes/Rcpp-package.Rnw Log: updating the package vignett Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 08:11:46 UTC (rev 4507) +++ pkg/Rcpp/ChangeLog 2013-09-18 08:47:26 UTC (rev 4508) @@ -1,3 +1,10 @@ +2013-09-16 Romain Francois + + * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE + by default. + * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is + what we should encourage people to use. + 2013-09-17 JJ Allaire * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 08:11:46 UTC (rev 4507) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-18 08:47:26 UTC (rev 4508) @@ -116,26 +116,25 @@ \begin{Hchunk} \begin{verbatim} $ ls -1R mypackage/ -mypackage/: DESCRIPTION -man NAMESPACE R Read-and-delete-me +man src +mypackage/R: +RcppExports.R + mypackage/man: mypackage-package.Rd rcpp_hello_world.Rd -mypackage/R: -rcpp_hello_world.R - mypackage/src: Makevars Makevars.win +RcppExports.cpp rcpp_hello_world.cpp -rcpp_hello_world.h $ \end{verbatim} \end{Hchunk} @@ -145,83 +144,88 @@ package, and it also includes the different components needed for using \pkg{Rcpp} that we discuss in the following sections. -\subsection{\proglang{R} code} +\subsection{\proglang{C++} code} -The skeleton contains an example \proglang{R} function -\texttt{rcpp\_hello\_world} that uses the \Sexpr{link(".Call")} interface to -invoke the \proglang{C++} function \texttt{rcpp\_hello\_world} from the -package \texttt{mypackage}. +If the \texttt{attributes} argument is set to +\texttt{TRUE}\footnote{Setting \texttt{attributes} to \texttt{TRUE} is the default. This document +does not cover the behavior of \texttt{Rcpp.package.skeleton} when \texttt{attributes} is set +to \texttt{FALSE} as we try to encourage package developpers to use +attributes. }, +the following \proglang{C++} file is included in the \texttt{src/} directory: -<>= -rcpp_hello_world <- function(){ - .Call( "rcpp_hello_world", PACKAGE = "mypackage" ) +<>= +#include +using namespace Rcpp; + +// [[Rcpp::export]] +List rcpp_hello_world() { + + CharacterVector x = CharacterVector::create( "foo", "bar" ) ; + NumericVector y = NumericVector::create( 0.0, 1.0 ) ; + List z = List::create( x, y ) ; + + return z ; } @ -\pkg{Rcpp} uses the \Sexpr{link(".Call")} calling convention as it allows -transport of actual \proglang{R} objects back and forth between the -\proglang{R} side and the \proglang{C++} side. \proglang{R} objects -(\texttt{SEXP}) can be conveniently manipulated using the \pkg{Rcpp} API. +The file defines the simple \texttt{rcpp\_hello\_world} function that +uses a few \pkg{Rcpp} classes and returns a \texttt{List}. -Note that in this example, no arguments were passed from \proglang{R} down to -the \proglang{C++} layer. Doing so is straightforward (and one of the key -features of \pkg{Rcpp}) but not central to our discussion of the package -creation mechanics. +This function is preceded by the \texttt{Rcpp::export} attribute to automatically +handle argument conversion because \proglang{R} has to be taught how to +e.g. handle the \texttt{List} class. -\subsection{\proglang{C++} code} +\Sexpr{link("Rcpp.package.skeleton")} then invokes \Sexpr{link("compileAttributes")} +on the package, which generates the \texttt{RcppExports.cpp} file: -The \proglang{C++} function is declared in the \texttt{rcpp\_hello\_world.h} -header file: - <>= -#ifndef _mypackage_RCPP_HELLO_WORLD_H -#define _mypackage_RCPP_HELLO_WORLD_H +// This file was generated by Rcpp::compileAttributes +// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include -/* - * note : RcppExport is an alias to `extern "C"` defined by Rcpp. - * - * It gives C calling convention to the rcpp_hello_world function so that - * it can be called from .Call in R. Otherwise, the C++ compiler mangles the - * name of the function and .Call cannot find it. - * - * It is only useful to use RcppExport when the function is intended to be called - * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672 - * on Rcpp-devel for a misuse of RcppExport - */ -RcppExport SEXP rcpp_hello_world() ; +using namespace Rcpp; -#endif +// rcpp_hello_world +List rcpp_hello_world(); +RcppExport SEXP mypackage_rcpp_hello_world() { +BEGIN_RCPP + SEXP __sexp_result; + { + Rcpp::RNGScope __rngScope; + List __result = rcpp_hello_world(); + PROTECT(__sexp_result = Rcpp::wrap(__result)); + } + UNPROTECT(1); + return __sexp_result; +END_RCPP +} @ -The header includes the \texttt{Rcpp.h} file, which is the only file that -needs to be included to use \pkg{Rcpp}. The function is then implemented in -the \texttt{rcpp\_hello\_world.cpp} file +This file defines a function with the appropriate calling convention, suitable for +\Sexpr{link(".Call")}. It needs to be regenerated each time functions +exposed by attributes are modified. This is the task of the +\Sexpr{link("compileAttributes")} function. A discussion on attributes is +beyond the scope of this document and more information is available +in the attributes vignette \citep{CRAN:Rcpp:Attributes}. -<>= -#include "rcpp_hello_world.h" +\subsection{\proglang{R} code} -SEXP rcpp_hello_world(){ - using namespace Rcpp ; +The \Sexpr{link("compileAttributes")} also generates \proglang{R} code +that uses the \proglang{C++} function. - CharacterVector x = CharacterVector::create( "foo", "bar" ) ; - NumericVector y = NumericVector::create( 0.0, 1.0 ) ; - List z = List::create( x, y ) ; +<>= +# This file was generated by Rcpp::compileAttributes +# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - return z ; +rcpp_hello_world <- function() { + .Call('mypackage_rcpp_hello_world', PACKAGE = 'mypackage') } @ -The function creates an \proglang{R} list that contains a -\Sexpr{link("character")} vector and a \Sexpr{link("numeric")} vector using \pkg{Rcpp} -classes. At the \proglang{R} level, we will therefore receive a list of -length two containing these two vectors. +This is also a generated file so it should not be modified manually, rather +regenerated as needed by \Sexpr{link("compileAttributes")}. -<>= -rcpp_hello_world( ) -@ - \subsection{\texttt{DESCRIPTION}} The skeleton generates an appropriate \texttt{DESCRIPTION} file, using @@ -317,7 +321,7 @@ \Sexpr{link("Rcpp.package.skeleton")} will be loaded and thereby made available to the newly created \proglang{R} package. Second, it declares which functions should be globally visible from the namespace of this -package. As a reasonable default, we export all functions. +package. As a reasonable default, we export all functions. \subsection{Help files} @@ -403,19 +407,22 @@ \end{verbatim} \end{Hchunk} +\section{Using modules} +This document does not cover the use of the \texttt{module} argument +of \Sexpr{link("Rcpp.package.skeleton")}. It is covered +in the modules vignette \citep{CRAN:Rcpp:Modules}. + \section{Further examples} The canonical example of a package that uses \pkg{Rcpp} is the \pkg{RcppExamples} \citep{CRAN:RcppExamples} package. \pkg{RcppExamples} -contains various examples of using \pkg{Rcpp} using both the extended -(``new'') API and the older (``classic'') API. Hence, the \pkg{RcppExamples} +contains various examples of using \pkg{Rcpp}. Hence, the \pkg{RcppExamples} package is provided as a template for employing \pkg{Rcpp} in packages. Other CRAN packages using the \pkg{Rcpp} package are \pkg{RcppArmadillo} -\citep{CRAN:RcppArmadillo}, \pkg{highlight} \citep{CRAN:highlight}, -and \pkg{minqa} \citep{CRAN:minqa} all of which follow precisely the guidelines -of this document. Several other packages follow older (but still supported +\citep{CRAN:RcppArmadillo}, +and \pkg{minqa} \citep{CRAN:minqa}. Several other packages follow older (but still supported and appropriate) instructions. They can serve examples on how to get data to and from \proglang{C++} routines, but should not be considered templates for how to connect to \pkg{Rcpp}. The full list of packages using \pkg{Rcpp} can From noreply at r-forge.r-project.org Wed Sep 18 11:57:18 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 11:57:18 +0200 (CEST) Subject: [Rcpp-commits] r4509 - in pkg/Rcpp: . R inst man Message-ID: <20130918095718.19EAD183F21@r-forge.r-project.org> Author: jjallaire Date: 2013-09-18 11:57:17 +0200 (Wed, 18 Sep 2013) New Revision: 4509 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/R/Attributes.R pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/man/pluginsAttribute.Rd Log: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 08:47:26 UTC (rev 4508) +++ pkg/Rcpp/ChangeLog 2013-09-18 09:57:17 UTC (rev 4509) @@ -1,3 +1,7 @@ +2013-09-18 JJ Allaire + + * R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute + 2013-09-16 Romain Francois * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-18 08:47:26 UTC (rev 4508) +++ pkg/Rcpp/R/Attributes.R 2013-09-18 09:57:17 UTC (rev 4509) @@ -474,20 +474,13 @@ error = function(e) NULL) } -# Lookup a plugin (first in our package then in the inline package) +# Lookup a plugin .findPlugin <- function(pluginName) { - # lookup in our plugins + plugin <- .plugins[[pluginName]] - - # if necessary lookup in the inline package if (is.null(plugin)) - if (length(find.package("inline", quiet=TRUE)) > 0) - plugin <- inline:::plugins[[pluginName]] - - # error if plugin not found - if (is.null(plugin)) stop("Inline plugin '", pluginName, "' could not be found ", - "within either the Rcpp or inline package. You should be ", + "within the Rcpp package. You should be ", "sure to call registerPlugin before using a plugin.") return(plugin) Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-18 08:47:26 UTC (rev 4508) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-18 09:57:17 UTC (rev 4509) @@ -50,6 +50,8 @@ we can now use references, pointers and const versions of them. The file \code{Module.cpp} file has an example. \item{No longer call non-exported functions from the tools package} + \item{No longer search the inline package as a fallback when loading + plugins for the the \code{Rcpp::plugins} attribute}. } \item Changes in Modules: \itemize{ Modified: pkg/Rcpp/man/pluginsAttribute.Rd =================================================================== --- pkg/Rcpp/man/pluginsAttribute.Rd 2013-09-18 08:47:26 UTC (rev 4508) +++ pkg/Rcpp/man/pluginsAttribute.Rd 2013-09-18 09:57:17 UTC (rev 4509) @@ -21,9 +21,6 @@ Plugins must be registered using the \code{\link{registerPlugin}} function. -If a plugin is not found within the \pkg{Rcpp} package then the -\pkg{inline} package will also be searched for a matching plugin. - When included within a \code{\link{sourceCpp}} translation unit, the configuration-related fields of the plugin (e.g. \code{env} and \code{LinkingTo}) are utilized, however the code-generation fields From noreply at r-forge.r-project.org Wed Sep 18 12:36:17 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 12:36:17 +0200 (CEST) Subject: [Rcpp-commits] r4510 - in pkg/RcppExamples: . R inst man src Message-ID: <20130918103617.A478E1847CC@r-forge.r-project.org> Author: romain Date: 2013-09-18 12:36:17 +0200 (Wed, 18 Sep 2013) New Revision: 4510 Added: pkg/RcppExamples/R/RcppExports.R pkg/RcppExamples/R/RcppListExample.R pkg/RcppExamples/man/RcppListExample.Rd pkg/RcppExamples/man/RcppNumericVectorExample.Rd pkg/RcppExamples/man/RcppRNGsExample.Rd pkg/RcppExamples/src/DataFrameExample.cpp pkg/RcppExamples/src/DateExample.cpp pkg/RcppExamples/src/ListExample.cpp pkg/RcppExamples/src/MatrixExample.cpp pkg/RcppExamples/src/NumericVectorExample.cpp pkg/RcppExamples/src/RNGs.cpp pkg/RcppExamples/src/RcppExports.cpp pkg/RcppExamples/src/StringVectorExample.cpp Removed: pkg/RcppExamples/R/RcppParamsExample.R pkg/RcppExamples/man/RcppDate.Rd pkg/RcppExamples/man/RcppParams.Rd pkg/RcppExamples/man/RcppRNGs.Rd pkg/RcppExamples/man/RcppResultSet.Rd pkg/RcppExamples/man/RcppVector.Rd pkg/RcppExamples/src/RcppDataFrame.cpp pkg/RcppExamples/src/RcppRNGs.cpp pkg/RcppExamples/src/newRcppDateExample.cpp pkg/RcppExamples/src/newRcppMatrixExample.cpp pkg/RcppExamples/src/newRcppParamsExample.cpp pkg/RcppExamples/src/newRcppStringVectorExample.cpp pkg/RcppExamples/src/newRcppVectorExample.cpp Modified: pkg/RcppExamples/DESCRIPTION pkg/RcppExamples/NAMESPACE pkg/RcppExamples/R/RcppDataFrame.R pkg/RcppExamples/R/RcppDateExample.R pkg/RcppExamples/R/RcppMatrixExample.R pkg/RcppExamples/R/RcppRNGs.R pkg/RcppExamples/R/RcppStringVectorExample.R pkg/RcppExamples/R/RcppVectorExample.R pkg/RcppExamples/inst/NEWS.Rd pkg/RcppExamples/man/RcppDataFrame.Rd Log: update the package so that it uses attributes Modified: pkg/RcppExamples/DESCRIPTION =================================================================== --- pkg/RcppExamples/DESCRIPTION 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/DESCRIPTION 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,6 +1,6 @@ Package: RcppExamples Title: Examples using Rcpp to interface R and C++ -Version: 0.1.6 +Version: 0.1.6.1 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois Maintainer: Dirk Eddelbuettel @@ -11,7 +11,7 @@ Note that the documentation in this package currently does not cover all the features in the package. It is not even close. On the other hand, the site http://gallery.rcpp.org is regrouping a number of examples for Rcpp. -Depends: R (>= 2.11.0), Rcpp (>= 0.9.9) +Depends: R (>= 2.15.1), Rcpp (>= 0.10.4.5) LinkingTo: Rcpp Suggests: RUnit URL: http://dirk.eddelbuettel.com/code/rcpp.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/Rcpp Modified: pkg/RcppExamples/NAMESPACE =================================================================== --- pkg/RcppExamples/NAMESPACE 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/NAMESPACE 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,13 +1,11 @@ useDynLib(RcppExamples) -export(#RcppExample, - #print.RcppExample, - RcppDataFrame, +export(RcppDataFrame, RcppDateExample, - RcppParamsExample, - RcppVectorExample, + RcppListExample, + RcppNumericVectorExample, RcppMatrixExample, - RcppRNGs, + RcppRNGsExample, RcppStringVectorExample ) Modified: pkg/RcppExamples/R/RcppDataFrame.R =================================================================== --- pkg/RcppExamples/R/RcppDataFrame.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppDataFrame.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,22 +1,21 @@ - -## RcppDataFrame.R: Rcpp R/C++ interface class library DataFrame example +## RcppDataFrame.R: DataFrame example ## -## Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2011 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . RcppDataFrame <- function() { @@ -30,8 +29,8 @@ print(D) ## Make the call... - val <- .Call("RcppDataFrame", D, PACKAGE="RcppExamples") - + val <- DataFrameExample(D) + cat("\nAfter call, original and new data frames:\n") print(val) Modified: pkg/RcppExamples/R/RcppDateExample.R =================================================================== --- pkg/RcppExamples/R/RcppDateExample.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppDateExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,23 +1,23 @@ -## RcppDateExample.R: Rcpp R/C++ interface class library RcppDate example +## RcppDateExample.R: RcppDate example ## ## Copyright (C) 2008 Dirk Eddelbuettel -## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . RcppDateExample <- function(dv, dtv) { @@ -33,7 +33,7 @@ } ## Make the call... - val <- .Call("newRcppDateExample", dv, dtv, PACKAGE="RcppExamples") + val <- DateExample( dv, dtv ) val } Added: pkg/RcppExamples/R/RcppExports.R =================================================================== --- pkg/RcppExamples/R/RcppExports.R (rev 0) +++ pkg/RcppExamples/R/RcppExports.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -0,0 +1,27 @@ +# This file was generated by Rcpp::compileAttributes +# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 + +DataFrameExample <- function(DF) { + .Call('RcppExamples_DataFrameExample', PACKAGE = 'RcppExamples', DF) +} + +DateExample <- function(dv, dtv) { + .Call('RcppExamples_DateExample', PACKAGE = 'RcppExamples', dv, dtv) +} + +ListExamples <- function(rparam) { + .Call('RcppExamples_ListExamples', PACKAGE = 'RcppExamples', rparam) +} + +newRcppMatrixExample <- function(orig) { + .Call('RcppExamples_newRcppMatrixExample', PACKAGE = 'RcppExamples', orig) +} + +NumericVectorExample <- function(orig) { + .Call('RcppExamples_NumericVectorExample', PACKAGE = 'RcppExamples', orig) +} + +RcppRNGs <- function(n) { + .Call('RcppExamples_RcppRNGs', PACKAGE = 'RcppExamples', n) +} + Copied: pkg/RcppExamples/R/RcppListExample.R (from rev 4501, pkg/RcppExamples/R/RcppParamsExample.R) =================================================================== --- pkg/RcppExamples/R/RcppListExample.R (rev 0) +++ pkg/RcppExamples/R/RcppListExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -0,0 +1,37 @@ + +## RcppListExample.R: RcppParams example +## +## Copyright (C) 2008 Dirk Eddelbuettel +## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois +## +## This file is part of RcppExamples. +## +## RcppExamples is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 2 of the License, or +## (at your option) any later version. +## +## RcppExamples is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with RcppExamples. If not, see . + +RcppListExample <- function(params) { + + ## Check that params is properly set. + if (missing(params)) { + cat("\nIn R, setting default argument for params\n") + params <- list(method='BFGS', + tolerance=1.0e-8, + maxIter=1000, + startDate=as.Date('2006-7-15')) + } + + ## Make the call... + val <- ListExamples( params) + val +} + Modified: pkg/RcppExamples/R/RcppMatrixExample.R =================================================================== --- pkg/RcppExamples/R/RcppMatrixExample.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppMatrixExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,23 +1,23 @@ -## RcppMatrixExample.R: Rcpp R/C++ interface class library RcppMatrix example +## RcppMatrixExample.R: RcppMatrix example ## ## Copyright (C) 2008 Dirk Eddelbuettel -## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . RcppMatrixExample <- function(mat=matrix(seq(1,9)^2, ncol=3)) { ## Make the call... Deleted: pkg/RcppExamples/R/RcppParamsExample.R =================================================================== --- pkg/RcppExamples/R/RcppParamsExample.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppParamsExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,37 +0,0 @@ - -## RcppParamsExample.R: Rcpp R/C++ interface class library RcppParams example -## -## Copyright (C) 2008 Dirk Eddelbuettel -## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois -## -## This file is part of Rcpp. -## -## Rcpp is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 2 of the License, or -## (at your option) any later version. -## -## Rcpp is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . - -RcppParamsExample <- function(params) { - - ## Check that params is properly set. - if (missing(params)) { - cat("\nIn R, setting default argument for params\n") - params <- list(method='BFGS', - tolerance=1.0e-8, - maxIter=1000, - startDate=as.Date('2006-7-15')) - } - - ## Make the call... - val <- .Call("newRcppParamsExample", params, PACKAGE="RcppExamples") - val -} - Modified: pkg/RcppExamples/R/RcppRNGs.R =================================================================== --- pkg/RcppExamples/R/RcppRNGs.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppRNGs.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,25 +1,25 @@ -## RcppRNGs.R: Rcpp R/C++ interface class library RNGs example +## RcppRNGs.R: RNGs example ## -## Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . -RcppRNGs <- function(n) { +RcppRNGsExample <- function(n) { ## Make the call... - df <- .Call("RcppRNGs", n, PACKAGE="RcppExamples") + df <- RcppRNGs( n ) df } Modified: pkg/RcppExamples/R/RcppStringVectorExample.R =================================================================== --- pkg/RcppExamples/R/RcppStringVectorExample.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppStringVectorExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -2,22 +2,22 @@ ## RcppStringVectorExample.R: Rcpp R/C++ interface class library ## ## Copyright (C) 2008 Dirk Eddelbuettel -## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . RcppStringVectorExample <- function(vec=c("Tick", "Tack", "Tock")) { ## Make the call... Modified: pkg/RcppExamples/R/RcppVectorExample.R =================================================================== --- pkg/RcppExamples/R/RcppVectorExample.R 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/R/RcppVectorExample.R 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,27 +1,27 @@ -## RcppVectorExample.R: Rcpp R/C++ interface class library RcppVector example +## RcppVectorExample.R: RcppVector example ## ## Copyright (C) 2008 Dirk Eddelbuettel -## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois ## -## This file is part of Rcpp. +## This file is part of RcppExamples. ## -## Rcpp is free software: you can redistribute it and/or modify it +## RcppExamples is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## -## Rcpp is distributed in the hope that it will be useful, but +## RcppExamples is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Rcpp. If not, see . +## along with RcppExamples. If not, see . -RcppVectorExample <- function(vec=seq(1,9)^2) { +RcppNumericVectorExample <- function(vec=seq(1,9)^2) { ## Make the call... - val <- .Call("newRcppVectorExample", vec, PACKAGE="RcppExamples") + val <- NumericVectorExample(vec) val } Modified: pkg/RcppExamples/inst/NEWS.Rd =================================================================== --- pkg/RcppExamples/inst/NEWS.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/inst/NEWS.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -2,6 +2,13 @@ \title{News for Package 'RcppExamples'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppExamples version 0.1.7 (future)}{ + \itemize{ + \item Using attributes everywhere. This package's purpose is to show + our recommended way to use Rcpp. This is it. + } +} + \section{Changes in RcppExamples version 0.1.6 (2013-01-15)}{ \itemize{ \item Moved \code{NEWS.Rd} from top-level directory to correct Modified: pkg/RcppExamples/man/RcppDataFrame.Rd =================================================================== --- pkg/RcppExamples/man/RcppDataFrame.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/man/RcppDataFrame.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -17,7 +17,7 @@ \preformatted{% // construct the data.frame object - Rcpp::DataFrame DF = Rcpp::DataFrame(Dsexp); + Rcpp::DataFrame DF(Dsexp); // and access each column by name Rcpp::IntegerVector a = DF["a"]; Deleted: pkg/RcppExamples/man/RcppDate.Rd =================================================================== --- pkg/RcppExamples/man/RcppDate.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/man/RcppDate.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,97 +0,0 @@ -\name{RcppDate} -\alias{RcppDate} -\alias{RcppDatetime} -\alias{RcppDateVector} -\alias{RcppDatetimeVector} -\alias{RcppDateExample} -\title{C++ classes for interfacing date and datetime R objects} -\description{ - \code{RcppDate}, \code{RcppDatetime}, \code{RcppDateVector} and - \code{RcppDatetimeVector} are C++ classes defined in their respective - headers files. They are part of the 'classic' Rcpp API. These classes - pass scalars and vectors of \R objects of types \code{Date} and - \code{POSIXct}, respectively, to C++ via the \code{.Call()} function - interface. - - Member functions are provided to query the dimension of the vector or - matrix object, convert it in a corresponding \code{C} representation. - - \R objects of type \code{Date}, and hence the \code{RcppDate} and - \code{RcppDateVector} objects, are internally represented as an - integer counting days since the epoch, i.e. January 1, - 1970. Similarly, \R objects of type \code{POSIXct} and the - \code{RcppDatetime} and \code{RcppDatetimeVector} objects, are - internally represented as seconds since the epoch. However, \R - extends the POSIX standard by using a double leading to microsecond - precision in timestamps. This is fully supported by \code{Rcpp} as - well. - - The new API currently has the classes \code{Rcpp::Date}, \code{Rcpp::Datetime}, - \code{Rcpp::DateVector} and \code{Rcpp::DatetimeVector} which are preferred - for new developments, but currently less documented. -} -\details{ - Usage of the \code{RcppDate}, \code{RcppDatetime} (and their vector - extensions) in \code{C++} is fully defined in the respective header - files \code{RcppDate.h} and \code{RcppDatetime.h}. - - As example, consider a call from \R to \code{C++} such as - - \preformatted{ - # an R example passing one type of each class to a function - # someFunction in package somePackage - val <- .Call("someFunction", - Sys.Date(), # current date - Sys.time(), # current timestamp - as.Date("2000-02-25") - + 0:5, # date vector - ISOdatetime(1999,12,31,23,59,0) - + (0:5)*0.250, # datetime vector - PACKAGE="somePackage") - } - - At the \code{C++} level, the corresponding code to assign these parameter to - \code{C++} objects is can be as follows:: - \preformatted{% - SEXP someFunction(SEXP ds, SEXP dts, - SEXP dvs, SEXP dtvs) { - - RcppDate d(ds); - RcppDatetime dt(dts); - RcppDateVector dv(dvs); - RcppDatetimeVector dtv(dtvs); - } - } - - Standard accessor functions are defined, see \code{RcppDate.h} and - \code{RcppDatetime.h} for details. - - Objects of these types can also be returned via \code{RcppResultSet}. - -} -\references{ - \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. -} -\seealso{ - \code{RcppResultSet}. -} -\author{Dominick Samperi wrote the initial versions of Rcpp (and - RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some - additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain - Francois have been extending Rcpp since 2009. -} -\examples{ - -# set up date and datetime vectors -dvec <- Sys.Date() + -2:2 -dtvec <- Sys.time() + (-2:2)*0.5 - -# call the underlying C++ function -result <- RcppDateExample(dvec, dtvec) - -# inspect returned object -result -} -\keyword{programming} -\keyword{interface} - Copied: pkg/RcppExamples/man/RcppListExample.Rd (from rev 4501, pkg/RcppExamples/man/RcppParams.Rd) =================================================================== --- pkg/RcppExamples/man/RcppListExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppListExample.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -0,0 +1,45 @@ +\name{RcppListExample} +\alias{RcppListExample} +\title{Examples of uses of List} +\description{ + \code{List} is an \code{Rcpp} class that can be used to manipulate R lists. +} +\arguments{ + \item{params}{A heterogeneous list specifying \code{method} (string), + \code{tolerance} (double), \code{maxIter} (int) and \code{startDate} + (Date in R, RcppDate in C++).} +} +\value{ + \code{RcppListExample} returns a list containing: + \item{method}{string input paramter} + \item{tolerance}{double input paramter} + \item{maxIter}{int input parameter} + \item{startDate}{Date type with starting date} + \item{params}{input parameter list (this is redundant because we + returned the input parameters above)} +} +\references{ + \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. +} +\author{Dominick Samperi wrote the initial versions of Rcpp (and + RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some + additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain + Francois have been extending Rcpp since 2009. +} +\examples{ + +# set up some value +params <- list(method='BFGS', + tolerance=1.0e-5, + maxIter=100, + startDate=as.Date('2006-7-15')) + +# call the underlying C++ function +result <- RcppListExample(params) + +# inspect returned object +result + +} +\keyword{programming} +\keyword{interface} Added: pkg/RcppExamples/man/RcppNumericVectorExample.Rd =================================================================== --- pkg/RcppExamples/man/RcppNumericVectorExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppNumericVectorExample.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -0,0 +1,33 @@ +\name{RcppNumericVectorExample} +\alias{RcppNumericVectorExample} +\title{Rcpp NumericVector example} +\description{ + Example on how to use a NumericVector and manipulate it with the STL. +} +\details{ + \preformatted{% + NumericVector orig ; // from R + NumericVector vec(orig.size()); // create a target vector of the same size + + // we could query size via + // int n = vec.size(); + // and loop over the vector, but using the STL is so much nicer + // so we use a STL transform() algorithm on each element + std::transform(orig.begin(), orig.end(), vec.begin(), sqrt_double ); + + List result = List::create( + Named( "result" ) = vec, + Named( "original" ) = orig + ) ; + return result ; + } + + As shown in the example section, provided the seed is reset, the exact + same draws can be obtained in R itself -- which is important for reproducibility. +} +\author{Dirk Eddelbuettel and Romain Francois} +\examples{ + RcppNumericVectorExample( seq(1,9)^2 ) +} +\keyword{programming} +\keyword{interface} Deleted: pkg/RcppExamples/man/RcppParams.Rd =================================================================== --- pkg/RcppExamples/man/RcppParams.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/man/RcppParams.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,95 +0,0 @@ -\name{RcppParams} -\alias{RcppParams} -\alias{RcppParamsExample} -\title{C++ class for receiving (scalar) parameters from R} -\description{ - \code{RcppParams} is a C++ class defined in \code{Rcpp.h} that receive - any number of scalar parameters of types in a single named list object - from \R through the \code{.Call()} function. - - The parameters can be of different types that are limited to the \R - types \code{numeric}, \code{integer}, \code{character}, \code{logical} - or \code{Date}. These types are mapped into, respectively, the - corresponding C++ types \code{double}, \code{int}, \code{string}, - \code{bool} and \code{Date} (a custom class defined by \code{Rcpp}. - - \code{RcppParams} is part of the old Rcpp API, and should be replace by - \code{Rcpp::List} which is more flexible and can be used for both inputs and - outputs. \code{RcppParams} is retained for backwards compatibility, but - should be avoided in new projects and replaced in old projects. -} -\arguments{ - \item{params}{A heterogeneous list specifying \code{method} (string), - \code{tolerance} (double), \code{maxIter} (int) and \code{startDate} - (Date in R, RcppDate in C++).} -} -\value{ - \code{RcppExample} returns a list containing: - \item{method}{string input paramter} - \item{tolerance}{double input paramter} - \item{maxIter}{int input parameter} - \item{startDate}{Date type with starting date} - \item{params}{input parameter list (this is redundant because we - returned the input parameters above)} -} -\details{ - Usage of \code{RcppParams} from \R via \code{.Call()} is as follows: - \preformatted{% - # an R example passing one type of each class to a function - # someFunction in package somePackage - val <- .Call("someFunction", - list(pie=3.1415, magicanswer=42, sometext="foo", - yesno=true, today=Sys.date()), - PACKAGE="somePackage") - } - - At the C++ level, the corresponding code to assign these parameter to - C++ objects is - \preformatted{% - SEXP someFunction(SEXP params) { - RcppParams par(params); - double p = par.getDoubleValue("pie"); - int magic = par.getIntValue("magicanswer"); - string txt = par.getStringValue("sometext"); - bool yn = par.getBoolValue("yesno"); - RcppDate d = par.getDateValue("today"); - // some calculations ... - // some return values ... - } - } - As the lookup is driven by the names givem at the \R level, order is - not important. It is however important that the types match. Errors - are typically caught and an exception is thrown. - - The class member function \code{checkNames} can be used to verify that the - \code{SEXP} object passed to the function contains a given set of - named object. -} -\references{ - \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. -} -\seealso{ - \code{RcppExample}. -} -\author{Dominick Samperi wrote the initial versions of Rcpp (and - RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some - additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain - Francois have been extending Rcpp since 2009. -} -\examples{ - -# set up some value -params <- list(method='BFGS', - tolerance=1.0e-5, - maxIter=100, - startDate=as.Date('2006-7-15')) - -# call the underlying C++ function -result <- RcppParamsExample(params) - -# inspect returned object -result - -} -\keyword{programming} -\keyword{interface} Deleted: pkg/RcppExamples/man/RcppRNGs.Rd =================================================================== --- pkg/RcppExamples/man/RcppRNGs.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/man/RcppRNGs.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,47 +0,0 @@ -\name{RcppRNGs} -\alias{RcppRNGs} -\title{Rcpp RNGs example} -\description{ - Rcpp sugar provides numerous p/q/d/r functions for numerous distributions. - - This example shows (in the corresponding C++ code) how to draw from - three different distributions and returns a data frame. -} -\details{ - The various header file, and the Rcpp sugar vignette, provide full - documentation for Rcpp sugar. - - The C++ source file corresponding to the this function does the - following (inside of a \code{try/catch} block): - - \preformatted{% - Rcpp::RNGScope scope; // needed when RNGs are drawn - - int n = Rcpp::as(ns); // length vector - Rcpp::NumericVector rn = Rcpp::rnorm(n); - Rcpp::NumericVector rt = Rcpp::rt(n, 1.0); - Rcpp::NumericVector rp = Rcpp::rpois(n, 1.0); - - // create a new data frame to return drawns - Rcpp::DataFrame NDF = - Rcpp::DataFrame::create(Rcpp::Named("rnorm") =rn, - Rcpp::Named("rt") =rt, - Rcpp::Named("rpois") =rp); - - // and return old and new in list - return(NDF); - } - - As shown in the example section, provided the seed is reset, the exact - same draws can be obtained in R itself -- which is important for reproducibility. -} -\author{Dirk Eddelbuettel and Romain Francois} -\examples{ - set.seed(42) - X <- RcppRNGs(10) - set.seed(42) - Y <- data.frame(rnorm=rnorm(10),rt=rt(10,1),rpois=rpois(10,1)) - all.equal(X,Y) -} -\keyword{programming} -\keyword{interface} Copied: pkg/RcppExamples/man/RcppRNGsExample.Rd (from rev 4501, pkg/RcppExamples/man/RcppRNGs.Rd) =================================================================== --- pkg/RcppExamples/man/RcppRNGsExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppRNGsExample.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -0,0 +1,47 @@ +\name{RcppRNGsExample} +\alias{RcppRNGsExample} +\title{Rcpp RNGs example} +\description{ + Rcpp sugar provides numerous p/q/d/r functions for numerous distributions. + + This example shows (in the corresponding C++ code) how to draw from + three different distributions and returns a data frame. +} +\details{ + The various header file, and the Rcpp sugar vignette, provide full + documentation for Rcpp sugar. + + The C++ source file corresponding to the this function does the + following (inside of a \code{try/catch} block): + + \preformatted{% + Rcpp::RNGScope scope; // needed when RNGs are drawn + + int n = Rcpp::as(ns); // length vector + Rcpp::NumericVector rn = Rcpp::rnorm(n); + Rcpp::NumericVector rt = Rcpp::rt(n, 1.0); + Rcpp::NumericVector rp = Rcpp::rpois(n, 1.0); + + // create a new data frame to return drawns + Rcpp::DataFrame NDF = + Rcpp::DataFrame::create(Rcpp::Named("rnorm") =rn, + Rcpp::Named("rt") =rt, + Rcpp::Named("rpois") =rp); + + // and return old and new in list + return(NDF); + } + + As shown in the example section, provided the seed is reset, the exact + same draws can be obtained in R itself -- which is important for reproducibility. +} +\author{Dirk Eddelbuettel and Romain Francois} +\examples{ + set.seed(42) + X <- RcppRNGsExample(10L) + set.seed(42) + Y <- data.frame(rnorm=rnorm(10),rt=rt(10,1),rpois=rpois(10,1)) + all.equal(X,Y) +} +\keyword{programming} +\keyword{interface} Deleted: pkg/RcppExamples/man/RcppResultSet.Rd =================================================================== --- pkg/RcppExamples/man/RcppResultSet.Rd 2013-09-18 09:57:17 UTC (rev 4509) +++ pkg/RcppExamples/man/RcppResultSet.Rd 2013-09-18 10:36:17 UTC (rev 4510) @@ -1,95 +0,0 @@ -\name{RcppResultSet} -\alias{RcppResultSet} -\title{C++ class for sending C++ objects back to R} -\description{ - \code{RcppResultSet} is a C++ class defined in \code{RcppResultSet.h} that can - assign any number of C++ objects to \R in a single named list object - as the \code{SEXP} return value of a \code{.Call()} function call. It - is part of the classic API. - - The C++ objects can be of different types that are limited to - types \code{double}, \code{int}, \code{string}, vectors of - \code{double} or \code{int} (with explicit dimensions), - matrices of \code{double} or \code{int} (with explicit dimensions), - STL vectors of \code{double}, \code{int} or \code{string}, STL - \sQuote{vector of vectors} of types \code{double} or \code{int} (all - with implicit dimensions), the internal types \code{RcppDate}, \code{RcppDateVector}, - \code{RcppStringVector}, \code{RcppVector} of types \code{double} or - \code{int}, \code{RcppMatrix} of types \code{double} or \code{int} - as well \code{RcppFrame}, a type that can be converted into a - \code{data.frame}, and the \R type \code{SEXP}. - - Where applicable, the \code{C++} types are automatically converted to the - corresponding \R types structures around types \code{numeric}, - \code{integer}, or \code{character}. The \code{C++} code can all be - retrieved in \R as elements of a named list object. - - The new API has more generic templated functions. -} -\details{ [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4510 From noreply at r-forge.r-project.org Wed Sep 18 15:12:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 15:12:31 +0200 (CEST) Subject: [Rcpp-commits] r4511 - pkg/RcppExamples Message-ID: <20130918131231.5F6A2183B43@r-forge.r-project.org> Author: edd Date: 2013-09-18 15:12:31 +0200 (Wed, 18 Sep 2013) New Revision: 4511 Modified: pkg/RcppExamples/ChangeLog Log: added entry for flood of changes made earlier by Romain Modified: pkg/RcppExamples/ChangeLog =================================================================== --- pkg/RcppExamples/ChangeLog 2013-09-18 10:36:17 UTC (rev 4510) +++ pkg/RcppExamples/ChangeLog 2013-09-18 13:12:31 UTC (rev 4511) @@ -1,3 +1,9 @@ +2010-12-03 Romain Francois + + * R/*: Updated to reflect newer Rcpp features + * src/*: Idem + * man/*: Corresponding documentation + 2013-01-15 Dirk Eddelbuettel * DESCRIPTION (Version): New version 0.1.6 From noreply at r-forge.r-project.org Wed Sep 18 16:35:49 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 16:35:49 +0200 (CEST) Subject: [Rcpp-commits] r4512 - in pkg/Rcpp: . inst/include/Rcpp Message-ID: <20130918143549.A2E181847CC@r-forge.r-project.org> Author: romain Date: 2013-09-18 16:35:49 +0200 (Wed, 18 Sep 2013) New Revision: 4512 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/TODO pkg/Rcpp/inst/include/Rcpp/as.h Log: as specialization Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 13:12:31 UTC (rev 4511) +++ pkg/Rcpp/ChangeLog 2013-09-18 14:35:49 UTC (rev 4512) @@ -2,12 +2,13 @@ * R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute -2013-09-16 Romain Francois +2013-09-18 Romain Francois * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE by default. * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is what we should encourage people to use. + * include/Rcpp/as.h: add as specialization 2013-09-17 JJ Allaire Modified: pkg/Rcpp/TODO =================================================================== --- pkg/Rcpp/TODO 2013-09-18 13:12:31 UTC (rev 4511) +++ pkg/Rcpp/TODO 2013-09-18 14:35:49 UTC (rev 4512) @@ -10,9 +10,6 @@ o DataFrame::create(Named("a")=b, Named("b")=b) fails with NumericVectors - o Single char variables do not seem to covered correctly by as<>() - and wrap() (cf http://stackoverflow.com/questions/16535899/) - Documentation o Finish the quickref vignette Modified: pkg/Rcpp/inst/include/Rcpp/as.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/as.h 2013-09-18 13:12:31 UTC (rev 4511) +++ pkg/Rcpp/inst/include/Rcpp/as.h 2013-09-18 14:35:49 UTC (rev 4512) @@ -145,6 +145,10 @@ return internal::as( m_sexp, typename traits::r_type_traits::r_category() ) ; } + template <> inline char as( SEXP m_sexp ){ + return internal::check_single_string(m_sexp)[0] ; + } + template inline typename traits::remove_const_and_reference::type bare_as( SEXP m_sexp ){ return as< typename traits::remove_const_and_reference::type >( m_sexp ) ; From noreply at r-forge.r-project.org Wed Sep 18 17:14:05 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 17:14:05 +0200 (CEST) Subject: [Rcpp-commits] r4513 - in pkg/Rcpp: . inst/include/Rcpp/sugar/functions inst/unitTests inst/unitTests/cpp Message-ID: <20130918151405.9F168184468@r-forge.r-project.org> Author: romain Date: 2013-09-18 17:14:05 +0200 (Wed, 18 Sep 2013) New Revision: 4513 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/TODO pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h pkg/Rcpp/inst/unitTests/cpp/sugar.cpp pkg/Rcpp/inst/unitTests/runit.sugar.R Log: one less TODO item Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 14:35:49 UTC (rev 4512) +++ pkg/Rcpp/ChangeLog 2013-09-18 15:14:05 UTC (rev 4513) @@ -9,7 +9,12 @@ * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is what we should encourage people to use. * include/Rcpp/as.h: add as specialization - + * include/Rcpp/sugar/functions/diff.h : rework the implementation of diff + so that it works even when we don't know the previous value + * unitTests/runit.sugar.R : + * unitTests/cpp/sugar.cpp : + * TODO : 2 less items + 2013-09-17 JJ Allaire * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without Modified: pkg/Rcpp/TODO =================================================================== --- pkg/Rcpp/TODO 2013-09-18 14:35:49 UTC (rev 4512) +++ pkg/Rcpp/TODO 2013-09-18 15:14:05 UTC (rev 4513) @@ -42,9 +42,6 @@ maybe we should use LazyVector like in outer to somehow cache the result when it is judged expensive to calculate - o The current impl of "diff" might cause problems (e.g. with - ifelse) due to laziness, it is probably best to not make it lazy - o crossprod o Vector * Matrix, Matrix * Matrix Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h 2013-09-18 14:35:49 UTC (rev 4512) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h 2013-09-18 15:14:05 UTC (rev 4513) @@ -1,8 +1,8 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // diff.h: Rcpp R/C++ interface class library -- diff // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -24,42 +24,50 @@ namespace Rcpp{ namespace sugar{ - - // NOTE: caching the previous value so that we only have to fetch the - // value once only works because we process the object from left to - // right + +// NOTE: caching the previous value so that we only have to fetch the +// value once only works because we process the object from left to +// right template class Diff : public Rcpp::VectorBase< RTYPE, LHS_NA , Diff > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; - Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs_[0]), was_na(false) { - was_na = traits::is_na(previous) ; - } + Diff( const LHS_TYPE& lhs_ ) : + lhs(lhs_), + previous(lhs_[0]), + previous_index(0), + was_na(traits::is_na(previous)) + {} inline STORAGE operator[]( int i ) const { - STORAGE y = lhs[i+1] ; - if( was_na ){ - previous = y ; - was_na = traits::is_na(y) ; - return previous ; // NA - } - if( traits::is_na(y) ) { - was_na = true ; - previous = y ; - return previous ; // NA - } - STORAGE res = y - previous ; - previous = y ; - was_na = false ; - return res ; + STORAGE y = lhs[i+1] ; + if( previous_index != i ){ + // we don't know the previous value, we need to get it. + set_previous(i, lhs[i] ) ; // record the current value + } + if( was_na || traits::is_na(y) ) { + set_previous(i+1, y ) ; + return traits::get_na() ; // NA + } + STORAGE res = y - previous ; + set_previous( i+1, y) ; + return res ; + } + + inline void set_previous(int i, STORAGE value){ + previous = value ; + was_na = is_na(previous) ; + previous_index = i ; } + inline int size() const { return lhs.size() - 1 ; } private: const LHS_TYPE& lhs ; mutable STORAGE previous ; + mutable int previous_index ; mutable bool was_na ; } ; @@ -68,12 +76,14 @@ public: typedef typename Rcpp::VectorBase LHS_TYPE ; - Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs_[0]) {} + Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs_[0]), previous_index(0) {} inline double operator[]( int i ) const { double y = lhs[i+1] ; + if( previous_index != i ) previous = lhs[i] ; double res = y - previous ; previous = y ; + previous_index = i+1 ; return res ; } inline int size() const { return lhs.size() - 1 ; } @@ -81,6 +91,7 @@ private: const LHS_TYPE& lhs ; mutable double previous ; + mutable int previous_index ; } ; template @@ -89,12 +100,14 @@ typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; - Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_) {} + Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs[0]), previous_index(0) {} inline STORAGE operator[]( int i ) const { STORAGE y = lhs[i+1] ; + if( previous_index != i ) previous = lhs[i] ; STORAGE diff = y - previous ; previous = y ; + previous_index = i+1 ; return y - previous ; } inline int size() const { return lhs.size() - 1 ; } @@ -102,6 +115,7 @@ private: const LHS_TYPE& lhs ; mutable STORAGE previous ; + mutable int previous_index ; } ; } // sugar Modified: pkg/Rcpp/inst/unitTests/cpp/sugar.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/sugar.cpp 2013-09-18 14:35:49 UTC (rev 4512) +++ pkg/Rcpp/inst/unitTests/cpp/sugar.cpp 2013-09-18 15:14:05 UTC (rev 4513) @@ -145,6 +145,12 @@ } // [[Rcpp::export]] +NumericVector runit_diff_ifelse( LogicalVector pred, NumericVector xx, NumericVector yy){ + NumericVector res = ifelse( pred, diff(xx), diff(yy) ); + return res ; +} + +// [[Rcpp::export]] List runit_exp( NumericVector xx, IntegerVector yy ){ return List::create( exp(xx), exp(yy) ) ; } Modified: pkg/Rcpp/inst/unitTests/runit.sugar.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.sugar.R 2013-09-18 14:35:49 UTC (rev 4512) +++ pkg/Rcpp/inst/unitTests/runit.sugar.R 2013-09-18 15:14:05 UTC (rev 4513) @@ -211,9 +211,11 @@ } test.sugar.diff <- function( ){ - fx <- runit_diff - x <- rnorm( 100 ) - checkEquals( fx(x) , diff(x) ) + x <- rnorm( 100 ) + checkEquals( runit_diff(x) , diff(x) ) + y <- rnorm(100) + pred <- sample( c(T,F), 99, replace = TRUE ) + checkEquals( runit_diff_ifelse(pred, x, y ), ifelse( pred, diff(x), diff(y) ) ) } test.sugar.exp <- function( ){ From noreply at r-forge.r-project.org Wed Sep 18 17:49:12 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 17:49:12 +0200 (CEST) Subject: [Rcpp-commits] r4514 - in pkg/Rcpp: . inst/include/Rcpp/sugar/functions Message-ID: <20130918154912.9FCF3184EB7@r-forge.r-project.org> Author: romain Date: 2013-09-18 17:49:12 +0200 (Wed, 18 Sep 2013) New Revision: 4514 Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/max.h pkg/Rcpp/inst/include/Rcpp/sugar/functions/min.h pkg/Rcpp/inst/include/Rcpp/sugar/functions/range.h Removed: pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/TODO pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h Log: factor out min, max and range in their own file and classes Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-18 15:14:05 UTC (rev 4513) +++ pkg/Rcpp/ChangeLog 2013-09-18 15:49:12 UTC (rev 4514) @@ -13,7 +13,10 @@ so that it works even when we don't know the previous value * unitTests/runit.sugar.R : * unitTests/cpp/sugar.cpp : - * TODO : 2 less items + * include/Rcpp/sugar/functions/range.h : factored out of minmax.h + * include/Rcpp/sugar/functions/min.h : factored out of minmax.h + * include/Rcpp/sugar/functions/max.h : factored out of minmax.h + * TODO : 3 less items 2013-09-17 JJ Allaire Modified: pkg/Rcpp/TODO =================================================================== --- pkg/Rcpp/TODO 2013-09-18 15:14:05 UTC (rev 4513) +++ pkg/Rcpp/TODO 2013-09-18 15:49:12 UTC (rev 4514) @@ -50,11 +50,6 @@ o operator/ needs to handle the case of division by 0 - o min, max with specialization of the binary operators, so that we can do - things like this lazily: - - min( x ) < 4 - o matrix functions : apply o for character vectors: nchar, grepl, sub, gsub Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h 2013-09-18 15:14:05 UTC (rev 4513) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h 2013-09-18 15:49:12 UTC (rev 4514) @@ -46,7 +46,9 @@ #include #include #include -#include +#include +#include +#include #include #include #include Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/max.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/max.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/max.h 2013-09-18 15:49:12 UTC (rev 4514) @@ -0,0 +1,87 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// +// max.h: Rcpp R/C++ interface class library -- max +// +// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of Rcpp. +// +// Rcpp is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Rcpp is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Rcpp. If not, see . + +#ifndef Rcpp__sugar__max_h +#define Rcpp__sugar__max_h + +namespace Rcpp{ +namespace sugar{ + + template + class Max { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Max( const T& obj_) : obj(obj_) {} + + operator STORAGE() { + max_ = obj[0] ; + if( Rcpp::traits::is_na( max_ ) ) return max_ ; + + int n = obj.size() ; + for( int i=1; i( current ) ) return current; + if( current > max_ ) max_ = current ; + } + return max_ ; + } + + private: + const T& obj ; + STORAGE min_, max_, current ; + } ; + + // version for NA = false + template + class Max { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Max( const T& obj_) : obj(obj_) {} + + operator STORAGE() { + max_ = obj[0] ; + + int n = obj.size() ; + for( int i=1; i max_ ) max_ = current ; + } + return max_ ; + } + + private: + const T& obj ; + STORAGE max_, current ; + } ; + + +} // sugar + +template +sugar::Max max( const VectorBase& x){ + return sugar::Max(x.get_ref()) ; +} + +} // Rcpp + +#endif Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/min.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/min.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/min.h 2013-09-18 15:49:12 UTC (rev 4514) @@ -0,0 +1,86 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// +// Min.h: Rcpp R/C++ interface class library -- min +// +// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of Rcpp. +// +// Rcpp is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Rcpp is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Rcpp. If not, see . + +#ifndef Rcpp__sugar__min_h +#define Rcpp__sugar__min_h + +namespace Rcpp{ +namespace sugar{ + + template + class Min { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Min( const T& obj_) : obj(obj_) {} + + operator STORAGE() { + min_ = obj[0] ; + if( Rcpp::traits::is_na( min_ ) ) return min_ ; + + int n = obj.size() ; + for( int i=1; i( current ) ) return current; + if( current < min_ ) min_ = current ; + } + return min_ ; + } + + const T& obj ; + STORAGE min_, max_, current ; + } ; + + // version for NA = false + template + class Min { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Min( const T& obj_) : obj(obj_) {} + + operator STORAGE() { + min_ = obj[0] ; + + int n = obj.size() ; + for( int i=1; i +sugar::Min min( const VectorBase& x){ + return sugar::Min(x.get_ref()) ; +} + +} // Rcpp + +#endif Deleted: pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h 2013-09-18 15:14:05 UTC (rev 4513) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h 2013-09-18 15:49:12 UTC (rev 4514) @@ -1,148 +0,0 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- -// -// minmax.h: Rcpp R/C++ interface class library -- min, mx, range -// -// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois -// -// This file is part of Rcpp. -// -// Rcpp is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Rcpp is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Rcpp. If not, see . - -#ifndef Rcpp__sugar__minmax_h -#define Rcpp__sugar__minmax_h - -namespace Rcpp{ -namespace sugar{ - - template - class MinMax { - public: - typedef typename Rcpp::traits::storage_type::type STORAGE ; - - MinMax( const T& obj_) : obj(obj_) {} - - STORAGE min() { - min_ = obj[0] ; - if( Rcpp::traits::is_na( min_ ) ) return min_ ; - - int n = obj.size() ; - for( int i=1; i( current ) ) return current; - if( current < min_ ) min_ = current ; - } - return min_ ; - } - STORAGE max() { - max_ = obj[0] ; - if( Rcpp::traits::is_na( max_ ) ) return max_ ; - - int n = obj.size() ; - for( int i=1; i( current ) ) return current; - if( current > max_ ) max_ = current ; - } - return max_ ; - } - Vector range(){ - min_ = max_ = obj[0] ; - if( Rcpp::traits::is_na( min_ ) ) return Vector::create( min_, max_ ) ; - - int n = obj.size() ; - for( int i=1; i( current ) ) return Vector::create( min_, max_ ) ; - if( current < min_ ) min_ = current ; - if( current > max_ ) max_ = current ; - - } - return Vector::create( min_, max_ ) ; - } - - - private: - const T& obj ; - STORAGE min_, max_, current ; - } ; - - // version for NA = false - template - class MinMax { - public: - typedef typename Rcpp::traits::storage_type::type STORAGE ; - - MinMax( const T& obj_) : obj(obj_) {} - - STORAGE min() { - min_ = obj[0] ; - - int n = obj.size() ; - for( int i=1; i max_ ) max_ = current ; - } - return max_ ; - } - Vector range(){ - min_ = max_ = obj[0] ; - - int n = obj.size() ; - for( int i=1; i max_ ) max_ = current ; - } - return Vector::create( min_, max_ ) ; - } - - - private: - const T& obj ; - STORAGE min_, max_, current ; - } ; - - -} // sugar - - -template -typename traits::storage_type::type min( const VectorBase& x){ - sugar::MinMax obj(x.get_ref()) ; - return obj.min() ; -} -template -typename traits::storage_type::type max( const VectorBase& x){ - sugar::MinMax obj(x.get_ref()) ; - return obj.max() ; -} -template -Vector range( const VectorBase& x){ - sugar::MinMax obj(x.get_ref()) ; - return obj.range() ; -} - -} // Rcpp - -#endif Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/range.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/range.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/range.h 2013-09-18 15:49:12 UTC (rev 4514) @@ -0,0 +1,92 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// +// range.h: Rcpp R/C++ interface class library -- range +// +// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of Rcpp. +// +// Rcpp is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Rcpp is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Rcpp. If not, see . + +#ifndef Rcpp__sugar__range_h +#define Rcpp__sugar__range_h + +namespace Rcpp{ +namespace sugar{ + + template + class Range { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Range( const T& obj_) : obj(obj_) {} + + operator Vector(){ + min_ = max_ = obj[0] ; + if( Rcpp::traits::is_na( min_ ) ) return Vector::create( min_, max_ ) ; + + int n = obj.size() ; + for( int i=1; i( current ) ) return Vector::create( min_, max_ ) ; + if( current < min_ ) min_ = current ; + if( current > max_ ) max_ = current ; + + } + return Vector::create( min_, max_ ) ; + } + + + private: + const T& obj ; + STORAGE min_, max_, current ; + } ; + + // version for NA = false + template + class Range { + public: + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + Range( const T& obj_) : obj(obj_) {} + + operator Vector(){ + min_ = max_ = obj[0] ; + + int n = obj.size() ; + for( int i=1; i max_ ) max_ = current ; + } + return Vector::create( min_, max_ ) ; + } + + + private: + const T& obj ; + STORAGE min_, max_, current ; + } ; + + +} // sugar + +template +sugar::Range range( const VectorBase& x){ + return sugar::Range(x.get_ref()) ; +} + +} // Rcpp + +#endif From noreply at r-forge.r-project.org Wed Sep 18 17:59:16 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 17:59:16 +0200 (CEST) Subject: [Rcpp-commits] r4515 - pkg/Rcpp/vignettes Message-ID: <20130918155916.2AD3A185ABE@r-forge.r-project.org> Author: romain Date: 2013-09-18 17:59:15 +0200 (Wed, 18 Sep 2013) New Revision: 4515 Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw Log: boxes were spanning the entire textwidth Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-18 15:49:12 UTC (rev 4514) +++ pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-18 15:59:15 UTC (rev 4515) @@ -30,17 +30,16 @@ \title{\pkg{Rcpp} Quick Reference Guide} \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} -% \newsavebox{\highlightbox} -% \renewenvironment{Hchunk}% -% {% -% \vspace{0.5em}\noindent\begin{lrbox}{\highlightbox}% -% \begin{minipage}[b]{.42\textwidth}% -% }% -% {% -% \end{minipage}% -% \end{lrbox}% -% \fcolorbox{highlightBorder}{highlightBg}{\usebox{\highlightbox}}% -% \vspace{0.5em}}% +\renewenvironment{Hchunk}% +{% +\vspace{0.5em}\noindent\begin{lrbox}{\highlightbox}% +\begin{minipage}[b]{.42\textwidth}% +}% +{% +\end{minipage}% +\end{lrbox}% +\fcolorbox{highlightBorder}{highlightBg}{\usebox{\highlightbox}}% +\vspace{0.5em}}% \begin{document} \maketitle From noreply at r-forge.r-project.org Wed Sep 18 22:18:46 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 18 Sep 2013 22:18:46 +0200 (CEST) Subject: [Rcpp-commits] r4516 - in pkg/RcppExamples: R man src Message-ID: <20130918201846.61F7F185EB5@r-forge.r-project.org> Author: romain Date: 2013-09-18 22:18:46 +0200 (Wed, 18 Sep 2013) New Revision: 4516 Added: pkg/RcppExamples/man/RcppDateExample.Rd pkg/RcppExamples/man/RcppMatrixExample.Rd pkg/RcppExamples/man/RcppStringVectorExample.Rd Modified: pkg/RcppExamples/R/RcppExports.R pkg/RcppExamples/R/RcppMatrixExample.R pkg/RcppExamples/R/RcppStringVectorExample.R pkg/RcppExamples/src/MatrixExample.cpp pkg/RcppExamples/src/RcppExports.cpp pkg/RcppExamples/src/StringVectorExample.cpp Log: second part of the 'flood', passing R CMD check Modified: pkg/RcppExamples/R/RcppExports.R =================================================================== --- pkg/RcppExamples/R/RcppExports.R 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/R/RcppExports.R 2013-09-18 20:18:46 UTC (rev 4516) @@ -13,8 +13,8 @@ .Call('RcppExamples_ListExamples', PACKAGE = 'RcppExamples', rparam) } -newRcppMatrixExample <- function(orig) { - .Call('RcppExamples_newRcppMatrixExample', PACKAGE = 'RcppExamples', orig) +MatrixExample <- function(orig) { + .Call('RcppExamples_MatrixExample', PACKAGE = 'RcppExamples', orig) } NumericVectorExample <- function(orig) { @@ -25,3 +25,7 @@ .Call('RcppExamples_RcppRNGs', PACKAGE = 'RcppExamples', n) } +StringVectorExample <- function(orig) { + .Call('RcppExamples_StringVectorExample', PACKAGE = 'RcppExamples', orig) +} + Modified: pkg/RcppExamples/R/RcppMatrixExample.R =================================================================== --- pkg/RcppExamples/R/RcppMatrixExample.R 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/R/RcppMatrixExample.R 2013-09-18 20:18:46 UTC (rev 4516) @@ -21,6 +21,6 @@ RcppMatrixExample <- function(mat=matrix(seq(1,9)^2, ncol=3)) { ## Make the call... - val <- .Call("newRcppMatrixExample", mat, PACKAGE="RcppExamples") + val <- MatrixExample( mat ) val } Modified: pkg/RcppExamples/R/RcppStringVectorExample.R =================================================================== --- pkg/RcppExamples/R/RcppStringVectorExample.R 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/R/RcppStringVectorExample.R 2013-09-18 20:18:46 UTC (rev 4516) @@ -21,6 +21,6 @@ RcppStringVectorExample <- function(vec=c("Tick", "Tack", "Tock")) { ## Make the call... - val <- .Call("newRcppStringVectorExample", vec, PACKAGE="RcppExamples") + val <- StringVectorExample( vec ) val } Added: pkg/RcppExamples/man/RcppDateExample.Rd =================================================================== --- pkg/RcppExamples/man/RcppDateExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppDateExample.Rd 2013-09-18 20:18:46 UTC (rev 4516) @@ -0,0 +1,62 @@ +\name{RcppDateExample} +\alias{RcppDateExample} +\title{C++ classes for interfacing date and datetime R objects} +\description{ + Rcpp has the classes \code{Rcpp::Date}, \code{Rcpp::Datetime}, + \code{Rcpp::DateVector} and \code{Rcpp::DatetimeVector}. +} +\details{ + + In the \code{C++} code for the \code{RcppDateExample.cpp} file: + + \preformatted{% + // [[Rcpp::export]] + List DateExample(DateVector dv, DatetimeVector dtv) { + Function formatDate("format.Date"); + Function formatDatetime("format.POSIXct"); + + Rprintf("\nIn C++, seeing the following date value\n"); + for (int i=0; i(formatDate(wrap(dv[i]))) << std::endl; + dv[i] = dv[i] + 7; // shift a week + } + Rprintf("\nIn C++, seeing the following datetime value\n"); + for (int i=0; i(formatDatetime(wrap(dtv[i]))) << std::endl; + dtv[i] = dtv[i] + 0.250; // shift 250 millisec + } + + // Build result set to be returned as a list to R. + List result = List::create( + Named("date", dv), + Named("datetime", dtv) + ); + + return result ; + } + + } +} +\references{ + \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. +} +\author{Dominick Samperi wrote the initial versions of Rcpp (and + RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some + additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain + Francois have been extending Rcpp since 2009. +} +\examples{ + +# set up date and datetime vectors +dvec <- Sys.Date() + -2:2 +dtvec <- Sys.time() + (-2:2)*0.5 + +# call the underlying C++ function +result <- RcppDateExample(dvec, dtvec) + +# inspect returned object +result +} +\keyword{programming} +\keyword{interface} + Added: pkg/RcppExamples/man/RcppMatrixExample.Rd =================================================================== --- pkg/RcppExamples/man/RcppMatrixExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppMatrixExample.Rd 2013-09-18 20:18:46 UTC (rev 4516) @@ -0,0 +1,55 @@ +\name{RcppMatrixExample} +\alias{RcppMatrixExample} +\title{Example of using Rcpp NumericMatrix} +\description{ + The \code{NumericMatrix} class represents numeric matrices +} +\details{ + + The \code{C++} code presented in the \code{MatrixExample.cpp} file: + + \preformatted{% + #include + #include + + /* suncc needs help to disambiguate between sqrt( float ) and sqrt(double) */ + inline static double sqrt_double( double x ){ return ::sqrt( x ) ; } + + using namespace Rcpp; + + // [[Rcpp::export]] + List MatrixExample(NumericMatrix orig) { + NumericMatrix mat(orig.nrow(), orig.ncol()); + + // we could query size via + // int n = mat.nrow(), k=mat.ncol(); + // and loop over the elements, but using the STL is so much nicer + // so we use a STL transform() algorithm on each element + std::transform(orig.begin(), orig.end(), mat.begin(), sqrt_double ); + + List result = List::create( + Named( "result" ) = mat, + Named( "original" ) = orig + ); + return result ; + } + + } +} +\references{ + \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. +} +\author{Dominick Samperi wrote the initial versions of Rcpp (and + RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some + additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain + Francois have been extending Rcpp since 2009. +} +\examples{ + +M <- matrix( (1:16)^2, 4 ) +RcppMatrixExample( M ) + +} +\keyword{programming} +\keyword{interface} + Added: pkg/RcppExamples/man/RcppStringVectorExample.Rd =================================================================== --- pkg/RcppExamples/man/RcppStringVectorExample.Rd (rev 0) +++ pkg/RcppExamples/man/RcppStringVectorExample.Rd 2013-09-18 20:18:46 UTC (rev 4516) @@ -0,0 +1,46 @@ +\name{RcppStringVectorExample} +\alias{RcppStringVectorExample} +\title{Example of using Rcpp StringVector (aka CharacterVector) } +\description{ + The \code{StringVector} (aka \code{CharacterVector} + class represents character vectors. +} +\details{ + + The \code{C++} code presented in the \code{StringVectorExample.cpp} file: + + \preformatted{% + #include + using namespace Rcpp ; + + // [[Rcpp::export]] + List StringVectorExample(StringVector orig) { + StringVector vec(orig.size()); + + std::transform(orig.begin(), orig.end(), vec.begin(), + make_string_transformer(tolower)); + + List result = List::create( + Named( "result" ) = vec, + Named( "original" ) = orig + ); + return result ; + } + + } +} +\references{ + \emph{Writing R Extensions}, available at \url{http:www.r-project.org}. +} +\author{Dominick Samperi wrote the initial versions of Rcpp (and + RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some + additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain + Francois have been extending Rcpp since 2009. +} +\examples{ + +RcppStringVectorExample( c("Tick", "Tack", "Tock") ) + +} +\keyword{programming} +\keyword{interface} Modified: pkg/RcppExamples/src/MatrixExample.cpp =================================================================== --- pkg/RcppExamples/src/MatrixExample.cpp 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/src/MatrixExample.cpp 2013-09-18 20:18:46 UTC (rev 4516) @@ -28,7 +28,7 @@ using namespace Rcpp; // [[Rcpp::export]] -List newRcppMatrixExample(NumericMatrix orig) { +List MatrixExample(NumericMatrix orig) { NumericMatrix mat(orig.nrow(), orig.ncol()); // we could query size via @@ -44,5 +44,3 @@ return result ; } - - Modified: pkg/RcppExamples/src/RcppExports.cpp =================================================================== --- pkg/RcppExamples/src/RcppExports.cpp 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/src/RcppExports.cpp 2013-09-18 20:18:46 UTC (rev 4516) @@ -51,15 +51,15 @@ return __sexp_result; END_RCPP } -// newRcppMatrixExample -List newRcppMatrixExample(NumericMatrix orig); -RcppExport SEXP RcppExamples_newRcppMatrixExample(SEXP origSEXP) { +// MatrixExample +List MatrixExample(NumericMatrix orig); +RcppExport SEXP RcppExamples_MatrixExample(SEXP origSEXP) { BEGIN_RCPP SEXP __sexp_result; { Rcpp::RNGScope __rngScope; Rcpp::traits::input_parameter< NumericMatrix >::type orig(origSEXP ); - List __result = newRcppMatrixExample(orig); + List __result = MatrixExample(orig); PROTECT(__sexp_result = Rcpp::wrap(__result)); } UNPROTECT(1); @@ -96,3 +96,18 @@ return __sexp_result; END_RCPP } +// StringVectorExample +List StringVectorExample(StringVector orig); +RcppExport SEXP RcppExamples_StringVectorExample(SEXP origSEXP) { +BEGIN_RCPP + SEXP __sexp_result; + { + Rcpp::RNGScope __rngScope; + Rcpp::traits::input_parameter< StringVector >::type orig(origSEXP ); + List __result = StringVectorExample(orig); + PROTECT(__sexp_result = Rcpp::wrap(__result)); + } + UNPROTECT(1); + return __sexp_result; +END_RCPP +} Modified: pkg/RcppExamples/src/StringVectorExample.cpp =================================================================== --- pkg/RcppExamples/src/StringVectorExample.cpp 2013-09-18 15:59:15 UTC (rev 4515) +++ pkg/RcppExamples/src/StringVectorExample.cpp 2013-09-18 20:18:46 UTC (rev 4516) @@ -20,21 +20,19 @@ // along with RcppExamples. If not, see . #include +using namespace Rcpp ; -RcppExport SEXP newRcppStringVectorExample(SEXP strvec) { -BEGIN_RCPP +// [[Rcpp::export]] +List StringVectorExample(StringVector orig) { + StringVector vec(orig.size()); - Rcpp::StringVector orig(strvec); // creates Rcpp string vector from SEXP - Rcpp::StringVector vec(orig.size()); - std::transform(orig.begin(), orig.end(), vec.begin(), - Rcpp::make_string_transformer(tolower)); + make_string_transformer(tolower)); - return Rcpp::List::create(Rcpp::Named( "result" ) = vec, - Rcpp::Named( "original" ) = orig); - -END_RCPP + List result = List::create( + Named( "result" ) = vec, + Named( "original" ) = orig + ); + return result ; } - - From noreply at r-forge.r-project.org Thu Sep 19 03:41:11 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 03:41:11 +0200 (CEST) Subject: [Rcpp-commits] r4517 - pkg/RcppExamples Message-ID: <20130919014111.61229185C13@r-forge.r-project.org> Author: edd Date: 2013-09-19 03:41:10 +0200 (Thu, 19 Sep 2013) New Revision: 4517 Modified: pkg/RcppExamples/ChangeLog Log: correct date for last changelog entry (happens when you don't C-x 4 a with Emacs...) Modified: pkg/RcppExamples/ChangeLog =================================================================== --- pkg/RcppExamples/ChangeLog 2013-09-18 20:18:46 UTC (rev 4516) +++ pkg/RcppExamples/ChangeLog 2013-09-19 01:41:10 UTC (rev 4517) @@ -1,4 +1,4 @@ -2010-12-03 Romain Francois +2013-09-17 Romain Francois * R/*: Updated to reflect newer Rcpp features * src/*: Idem From noreply at r-forge.r-project.org Thu Sep 19 09:08:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 09:08:31 +0200 (CEST) Subject: [Rcpp-commits] r4518 - in pkg/Rcpp: . inst/include/Rcpp/traits Message-ID: <20130919070831.8ADE91856AF@r-forge.r-project.org> Author: romain Date: 2013-09-19 09:08:31 +0200 (Thu, 19 Sep 2013) New Revision: 4518 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h Log: unsigned int -> double to handle unsigned int > INT_MAX Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 01:41:10 UTC (rev 4517) +++ pkg/Rcpp/ChangeLog 2013-09-19 07:08:31 UTC (rev 4518) @@ -1,3 +1,8 @@ +2013-09-19 Romain Francois + + * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP + long standing feature request from Murray. + 2013-09-18 JJ Allaire * R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute @@ -5408,3 +5413,4 @@ * inst/doc/RcppAPI.{Rnw,pdf}: Added footnote onto titlepage about how this document has not (yet) been updated along with the channges made + Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-19 01:41:10 UTC (rev 4517) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-19 07:08:31 UTC (rev 4518) @@ -3,7 +3,7 @@ // // r_sexptype_traits.h: Rcpp R/C++ interface class library -- traits to help wrap // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -40,7 +40,8 @@ template<> struct r_sexptype_traits{ enum{ rtype = CPLXSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = RAWSXP } ; } ; -template<> struct r_sexptype_traits{ enum{ rtype = INTSXP } ; } ; + +template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; /* long are represented as numeric vectors which allows more precision From noreply at r-forge.r-project.org Thu Sep 19 10:01:51 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 10:01:51 +0200 (CEST) Subject: [Rcpp-commits] r4519 - in pkg/Rcpp: . R inst man Message-ID: <20130919080151.9A949184D20@r-forge.r-project.org> Author: romain Date: 2013-09-19 10:01:51 +0200 (Thu, 19 Sep 2013) New Revision: 4519 Added: pkg/Rcpp/man/demangle.Rd Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/NAMESPACE pkg/Rcpp/R/Attributes.R pkg/Rcpp/inst/NEWS.Rd Log: new demangle function Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 07:08:31 UTC (rev 4518) +++ pkg/Rcpp/ChangeLog 2013-09-19 08:01:51 UTC (rev 4519) @@ -2,6 +2,8 @@ * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP long standing feature request from Murray. + * R/Attributes.R : Added the helper demangle function + * man/demangle.Rd : Documentation for demangle 2013-09-18 JJ Allaire Modified: pkg/Rcpp/NAMESPACE =================================================================== --- pkg/Rcpp/NAMESPACE 2013-09-19 07:08:31 UTC (rev 4518) +++ pkg/Rcpp/NAMESPACE 2013-09-19 08:01:51 UTC (rev 4519) @@ -24,7 +24,8 @@ sourceCpp, compileAttributes, registerPlugin, - RcppLdFlags + RcppLdFlags, + demangle ) exportClass(RcppClass) Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-19 07:08:31 UTC (rev 4518) +++ pkg/Rcpp/R/Attributes.R 2013-09-19 08:01:51 UTC (rev 4519) @@ -252,6 +252,19 @@ } } +# demangling a type +demangle <- function( type = "int", ... ){ + code <- sprintf( ' + String demangle_this_type(){ + typedef %s type ; + return DEMANGLE(type) ; + }', type ) + dots <- list( code, ... ) + dots[["env"]] <- environment() + do.call( cppFunction, dots ) + demangle_this_type() +} + # Evaluate a simple c++ expression evalCpp <- function(code, depends = character(), Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-19 07:08:31 UTC (rev 4518) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-19 08:01:51 UTC (rev 4519) @@ -4,9 +4,13 @@ \section{Changes in Rcpp version 0.10.5 (future)}{ \itemize{ + \item Changes in R code: + \itemize{ + \item New R function \code{demangle} that calls the \code{DEMANGLE} macro. + } \item Changes in Rcpp API: \itemize{ - \item Add \code{#defined(__sun)} to lists of operating systems to + \item Add \code{defined(__sun)} to lists of operating systems to test for when checking for lack of \code{backtrace()} needed for stack traces. \item \code{as}, \code{as}, \code{as} and Added: pkg/Rcpp/man/demangle.Rd =================================================================== --- pkg/Rcpp/man/demangle.Rd (rev 0) +++ pkg/Rcpp/man/demangle.Rd 2013-09-19 08:01:51 UTC (rev 4519) @@ -0,0 +1,56 @@ +\name{demangle} +\alias{demangle} +\title{ +demanging c++ types +} +\description{ + This uses the compiler functionality (if available) to demangle type. If the compiler + cannot demangle, then it will return its argument as is +} +\usage{ + demangle(type = "int", ...) +} +\arguments{ + \item{type}{The type we want to demangle} + \item{\dots}{Further argument for \code{\link{cppFunction}} } +} +\details{ + The following function is compiled and invoked: + + \preformatted{% + String demangle_this_type(){ + typedef %s type ; + return DEMANGLE(type) ; + } + } + + \code{DEMANGLE} is a macro in \samp{Rcpp} that does the work. +} +\value{ + The demangled type, as a string. +} +\references{ + See this \href{http://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html}{chapter} + from the GNU C++ library manual. +} +\author{ + Romain Francois +} +\note{ + We only know how to demangle with gcc. If you know how to demangle types + with your compiler, let us know. +} +\seealso{ + \code{\link{cppFunction}} is used to compile the function \code{demangle} creates. +} +\examples{ +\dontrun{ + demangle( "int64_t" ) + demangle( "uint64_t" ) + + demangle( "NumericVector" ) + demangle( "std::map" ) +} +} +\keyword{programming} + From noreply at r-forge.r-project.org Thu Sep 19 11:08:54 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 11:08:54 +0200 (CEST) Subject: [Rcpp-commits] r4520 - in pkg/Rcpp: . R inst man Message-ID: <20130919090854.895E1184C3F@r-forge.r-project.org> Author: romain Date: 2013-09-19 11:08:54 +0200 (Thu, 19 Sep 2013) New Revision: 4520 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/NAMESPACE pkg/Rcpp/R/Attributes.R pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/man/demangle.Rd Log: added sizeof R function Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 08:01:51 UTC (rev 4519) +++ pkg/Rcpp/ChangeLog 2013-09-19 09:08:54 UTC (rev 4520) @@ -2,8 +2,8 @@ * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP long standing feature request from Murray. - * R/Attributes.R : Added the helper demangle function - * man/demangle.Rd : Documentation for demangle + * R/Attributes.R : Added the helper demangle and sizeof functions + * man/demangle.Rd : Documentation for demangle and sizeof 2013-09-18 JJ Allaire Modified: pkg/Rcpp/NAMESPACE =================================================================== --- pkg/Rcpp/NAMESPACE 2013-09-19 08:01:51 UTC (rev 4519) +++ pkg/Rcpp/NAMESPACE 2013-09-19 09:08:54 UTC (rev 4520) @@ -25,9 +25,9 @@ compileAttributes, registerPlugin, RcppLdFlags, - demangle + demangle, sizeof ) - +S3method( print, bytes ) exportClass(RcppClass) Modified: pkg/Rcpp/R/Attributes.R =================================================================== --- pkg/Rcpp/R/Attributes.R 2013-09-19 08:01:51 UTC (rev 4519) +++ pkg/Rcpp/R/Attributes.R 2013-09-19 09:08:54 UTC (rev 4520) @@ -252,19 +252,32 @@ } } -# demangling a type -demangle <- function( type = "int", ... ){ - code <- sprintf( ' - String demangle_this_type(){ - typedef %s type ; - return DEMANGLE(type) ; - }', type ) - dots <- list( code, ... ) - dots[["env"]] <- environment() - do.call( cppFunction, dots ) - demangle_this_type() +.type_manipulate <- function( what = "DEMANGLE", class = NULL ) { + function( type = "int", ... ){ + code <- sprintf( ' + SEXP manipulate_this_type(){ + typedef %s type ; + return wrap( %s(type) ) ; + }', type, what ) + dots <- list( code, ... ) + dots[["env"]] <- environment() + manipulate_this_type <- do.call( cppFunction, dots ) + res <- manipulate_this_type() + if( ! is.null(class) ){ + class(res) <- class + } + res + } } +demangle <- .type_manipulate( "DEMANGLE" ) +sizeof <- .type_manipulate( "sizeof", "bytes" ) + +print.bytes <- function( x, ...){ + writeLines( sprintf( "%d bytes (%d bits)", x, 8 * x ) ) + invisible( x ) +} + # Evaluate a simple c++ expression evalCpp <- function(code, depends = character(), Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-19 08:01:51 UTC (rev 4519) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-19 09:08:54 UTC (rev 4520) @@ -6,7 +6,10 @@ \itemize{ \item Changes in R code: \itemize{ - \item New R function \code{demangle} that calls the \code{DEMANGLE} macro. + \item New R function \code{demangle} that calls the \code{DEMANGLE} macro. + \item New R function \code{sizeof} to query the byte size of a type. This + returns an object of S3 class \code{bytes} that has a \code{print} method + showing bytes and bits. } \item Changes in Rcpp API: \itemize{ Modified: pkg/Rcpp/man/demangle.Rd =================================================================== --- pkg/Rcpp/man/demangle.Rd 2013-09-19 08:01:51 UTC (rev 4519) +++ pkg/Rcpp/man/demangle.Rd 2013-09-19 09:08:54 UTC (rev 4520) @@ -1,14 +1,16 @@ \name{demangle} \alias{demangle} +\alias{sizeof} +\alias{print.bytes} \title{ -demanging c++ types +c++ type information } \description{ - This uses the compiler functionality (if available) to demangle type. If the compiler - cannot demangle, then it will return its argument as is + \code{demangle} gives the demangled type, \code{sizeof} its size (in bytes). } \usage{ demangle(type = "int", ...) + sizeof(type = "int", ...) } \arguments{ \item{type}{The type we want to demangle} @@ -18,10 +20,15 @@ The following function is compiled and invoked: \preformatted{% - String demangle_this_type(){ + SEXP demangle_this_type(){ typedef %s type ; - return DEMANGLE(type) ; - } + return wrap( DEMANGLE(type) ) ; + } + + SEXP sizeof_this_type(){ + typedef %s type ; + return wrap( sizeof(type) ) ; + } } \code{DEMANGLE} is a macro in \samp{Rcpp} that does the work. @@ -50,6 +57,10 @@ demangle( "NumericVector" ) demangle( "std::map" ) + + sizeof( "long" ) + sizeof( "long long" ) + } } \keyword{programming} From noreply at r-forge.r-project.org Thu Sep 19 17:16:41 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 17:16:41 +0200 (CEST) Subject: [Rcpp-commits] r4521 - in pkg/Rcpp: . inst inst/include/Rcpp/platform Message-ID: <20130919151642.0ED4F185D9D@r-forge.r-project.org> Author: romain Date: 2013-09-19 17:16:41 +0200 (Thu, 19 Sep 2013) New Revision: 4521 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/platform/compiler.h Log: less restritive support for long long Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 09:08:54 UTC (rev 4520) +++ pkg/Rcpp/ChangeLog 2013-09-19 15:16:41 UTC (rev 4521) @@ -4,6 +4,9 @@ long standing feature request from Murray. * R/Attributes.R : Added the helper demangle and sizeof functions * man/demangle.Rd : Documentation for demangle and sizeof + * include/Rcpp/platform/compiler.h : less restritive support of long long + types. But still behind a test for gcc and a test for the availability + of the type, and the __extension__. -pedantic does not warn about it 2013-09-18 JJ Allaire Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-19 09:08:54 UTC (rev 4520) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-19 15:16:41 UTC (rev 4521) @@ -43,6 +43,12 @@ file \item \code{RcppLdFlags()}, often used in \code{Makevars} files of packages using \pkg{Rcpp}, is now exported from the package namespace. + \item Less restritive support for \code{long long}. If we are using a gcc + compatible compiler and the long long type is available (i.e. the + \code{__LONG_LONG_MAX__} is defined, then we have typedefs + \code{rcpp_long_long_type} and \code{rcpp_ulong_long_type} that are defined + behind a gcc \code{__extension__}. This way, we can create useful + features supporting long long, while having \code{-pedantic} not warn about it. } \item Changes in Attributes: \itemize{ Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-19 09:08:54 UTC (rev 4520) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-19 15:16:41 UTC (rev 4521) @@ -177,14 +177,34 @@ #define RCPP_HAS_DEMANGLING #endif -#ifdef __GNUC__ -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) -#ifdef __LONG_LONG_MAX__ +// long long and unssigned long long support. +// +// given the current restriction of what might go to CRAN +// we can only use long long if we are running a gcc compatible (e.g. clang) +// compiler and the type is actually available (hence the test for __LONG_LONG_MAX__) +// even then, we cannot use long long as is, we first have to "hide" it +// behind the __extension__ so that -pedantic stops giving warnings about +// compliance with C++98 +// +// client code may use the facilities we provide for long long (wrap, etc ...) +// but not using long long directly, because then it is not CRAN proof. +// So client code must use the rcpp_long_long_type and rcpp_ulong_long_type +// types +// +// e.g. code like this is not good: +// +// long long x = 2 ; +// +// but code like this is CRAN proof +// +// rcpp_long_long_type x = 2 ; +// +// Note that if you don't distribute your code to CRAN and you don't use the +// -pedantic option, then you can use long long +#if defined(__GNUC__) && defined(__LONG_LONG_MAX__) __extension__ typedef long long int rcpp_long_long_type; __extension__ typedef unsigned long long int rcpp_ulong_long_type; #define RCPP_HAS_LONG_LONG_TYPES #endif -#endif -#endif #endif From noreply at r-forge.r-project.org Thu Sep 19 19:07:36 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 19 Sep 2013 19:07:36 +0200 (CEST) Subject: [Rcpp-commits] r4522 - pkg/Rcpp/vignettes Message-ID: <20130919170736.27C73185299@r-forge.r-project.org> Author: romain Date: 2013-09-19 19:07:35 +0200 (Thu, 19 Sep 2013) New Revision: 4522 Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw Log: vignette fixing Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-19 15:16:41 UTC (rev 4521) +++ pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-19 17:07:35 UTC (rev 4522) @@ -30,15 +30,18 @@ \title{\pkg{Rcpp} Quick Reference Guide} \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} +\newsavebox{\quickrefbox} +\definecolor{quickrefBg}{rgb}{0.949019607843137,0.949019607843137,0.949019607843137} +\definecolor{quickrefBorder}{rgb}{0,0,0} \renewenvironment{Hchunk}% {% -\vspace{0.5em}\noindent\begin{lrbox}{\highlightbox}% +\vspace{0.5em}\noindent\begin{lrbox}{\quickrefbox}% \begin{minipage}[b]{.42\textwidth}% }% {% \end{minipage}% \end{lrbox}% -\fcolorbox{highlightBorder}{highlightBg}{\usebox{\highlightbox}}% +\fcolorbox{quickrefBorder}{quickrefBg}{\usebox{\quickrefbox}}% \vspace{0.5em}}% \begin{document} From noreply at r-forge.r-project.org Fri Sep 20 01:02:24 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 20 Sep 2013 01:02:24 +0200 (CEST) Subject: [Rcpp-commits] r4523 - in pkg/Rcpp: . inst/include inst/include/Rcpp inst/include/Rcpp/platform inst/include/Rcpp/traits Message-ID: <20130919230224.4498B185F00@r-forge.r-project.org> Author: romain Date: 2013-09-20 01:02:23 +0200 (Fri, 20 Sep 2013) New Revision: 4523 Added: pkg/Rcpp/inst/include/Rcpp/longlong.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/platform/compiler.h pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h pkg/Rcpp/inst/include/RcppCommon.h Log: isolate handling of long long in a separate file. We might choose not to include this file by default Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/ChangeLog 2013-09-19 23:02:23 UTC (rev 4523) @@ -1,3 +1,8 @@ +2013-09-20 Romain Francois + + * include/Rcpp/longlong.h: isolate all handling of long long + in a separate file which we might choose not to include by default + 2013-09-19 Romain Francois * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP Added: pkg/Rcpp/inst/include/Rcpp/longlong.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/longlong.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/longlong.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -0,0 +1,75 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- +// +// longlong.h: Rcpp R/C++ interface class library -- long long support +// +// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of Rcpp. +// +// Rcpp is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Rcpp is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Rcpp. If not, see . + +#ifndef RCPP_LONG_LONG_H +#define RCPP_LONG_LONG_H + +// long long and unssigned long long support. +// +// given the current restriction of what might go to CRAN +// we can only use long long if we are running a gcc compatible (e.g. clang) +// compiler and the type is actually available (hence the test for __LONG_LONG_MAX__) +// even then, we cannot use long long as is, we first have to "hide" it +// behind the __extension__ so that -pedantic stops giving warnings about +// compliance with C++98 +// +// client code may use the facilities we provide for long long (wrap, etc ...) +// but not using long long directly, because then it is not CRAN proof. +// So client code must use the rcpp_long_long_type and rcpp_ulong_long_type +// types +// +// e.g. code like this is not good: +// +// long long x = 2 ; +// +// but code like this is CRAN proof +// +// rcpp_long_long_type x = 2 ; +// +// Note that if you don't distribute your code to CRAN and you don't use the +// -pedantic option, then you can use long long +#if defined(__GNUC__) && defined(__LONG_LONG_MAX__) + __extension__ typedef long long int rcpp_long_long_type; + __extension__ typedef unsigned long long int rcpp_ulong_long_type; + #define RCPP_HAS_LONG_LONG_TYPES +#endif + +#if defined(RCPP_HAS_LONG_LONG_TYPES) + +namespace Rcpp{ +namespace traits{ + + template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; + template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; + + template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; + + template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; + template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; +} +} +#endif + + +#endif Modified: pkg/Rcpp/inst/include/Rcpp/platform/compiler.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/inst/include/Rcpp/platform/compiler.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -177,34 +177,4 @@ #define RCPP_HAS_DEMANGLING #endif -// long long and unssigned long long support. -// -// given the current restriction of what might go to CRAN -// we can only use long long if we are running a gcc compatible (e.g. clang) -// compiler and the type is actually available (hence the test for __LONG_LONG_MAX__) -// even then, we cannot use long long as is, we first have to "hide" it -// behind the __extension__ so that -pedantic stops giving warnings about -// compliance with C++98 -// -// client code may use the facilities we provide for long long (wrap, etc ...) -// but not using long long directly, because then it is not CRAN proof. -// So client code must use the rcpp_long_long_type and rcpp_ulong_long_type -// types -// -// e.g. code like this is not good: -// -// long long x = 2 ; -// -// but code like this is CRAN proof -// -// rcpp_long_long_type x = 2 ; -// -// Note that if you don't distribute your code to CRAN and you don't use the -// -pedantic option, then you can use long long -#if defined(__GNUC__) && defined(__LONG_LONG_MAX__) - __extension__ typedef long long int rcpp_long_long_type; - __extension__ typedef unsigned long long int rcpp_ulong_long_type; - #define RCPP_HAS_LONG_LONG_TYPES #endif - -#endif Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -59,17 +59,10 @@ template<> struct r_sexptype_traits{ enum{ rtype = INTSXP } ; } ; template<> struct r_sexptype_traits{ enum{ rtype = INTSXP } ; } ; -/* long long int */ -#ifdef RCPP_HAS_LONG_LONG_TYPES -template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; -template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; -#endif - /* std::complex */ template<> struct r_sexptype_traits< std::complex >{ enum{ rtype = CPLXSXP } ; } ; template<> struct r_sexptype_traits< std::complex >{ enum{ rtype = CPLXSXP } ; } ; - /** * Indicates if a primitive type needs a static_cast */ Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -178,14 +178,6 @@ template<> struct r_type_traits< std::complex >{ typedef r_type_primitive_tag r_category ; } ; template<> struct r_type_traits< std::pair > >{ typedef r_type_primitive_tag r_category ; } ; -/* long long int */ -#ifdef RCPP_HAS_LONG_LONG_TYPES -template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; -template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; -template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; -template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; -#endif - } // traits } // Rcpp Modified: pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -91,11 +91,6 @@ template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; -#ifdef RCPP_HAS_LONG_LONG_TYPES -template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; -template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; -#endif - template struct wrap_type_traits< Rcpp::object > { typedef wrap_type_module_object_pointer_tag wrap_category; } ; Modified: pkg/Rcpp/inst/include/RcppCommon.h =================================================================== --- pkg/Rcpp/inst/include/RcppCommon.h 2013-09-19 17:07:35 UTC (rev 4522) +++ pkg/Rcpp/inst/include/RcppCommon.h 2013-09-19 23:02:23 UTC (rev 4523) @@ -133,4 +133,6 @@ #include #include +#include + #endif From noreply at r-forge.r-project.org Fri Sep 20 02:01:34 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 20 Sep 2013 02:01:34 +0200 (CEST) Subject: [Rcpp-commits] r4524 - in pkg/Rcpp: . inst inst/include/Rcpp Message-ID: <20130920000135.2560B184CEF@r-forge.r-project.org> Author: edd Date: 2013-09-20 02:01:34 +0200 (Fri, 20 Sep 2013) New Revision: 4524 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/longlong.h Log: Unbreak long long by making it (as before) conditional on g++ (or clang) as well as C++11. The condition can be OR'ed with another suitably-defined variable, but the default has to be off as CRAN compliance has to remain the standard. Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-19 23:02:23 UTC (rev 4523) +++ pkg/Rcpp/ChangeLog 2013-09-20 00:01:34 UTC (rev 4524) @@ -1,38 +1,45 @@ -2013-09-20 Romain Francois +2013-09-19 Dirk Eddelbuettel + * inst/include/Rcpp/longlong.h: Unbreak long long by making it (as + before) conditional on g++ (or clang) as well as C++11. The condition + can be OR'ed with another suitably-defined variable, but the default + has to be off as CRAN compliance has to remain the standard + +2013-09-19 Romain Francois + * include/Rcpp/longlong.h: isolate all handling of long long in a separate file which we might choose not to include by default -2013-09-19 Romain Francois - - * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP - long standing feature request from Murray. + * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as + REALSXP long standing feature request from Murray. * R/Attributes.R : Added the helper demangle and sizeof functions * man/demangle.Rd : Documentation for demangle and sizeof - * include/Rcpp/platform/compiler.h : less restritive support of long long - types. But still behind a test for gcc and a test for the availability - of the type, and the __extension__. -pedantic does not warn about it + * include/Rcpp/platform/compiler.h : less restritive support of long + long types. But still behind a test for gcc and a test for the + availability of the type, and the __extension__. -pedantic does not + warn about it 2013-09-18 JJ Allaire - * R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute + * R/Attributes.R: Don't search the inline package as a fallback when + loading plugins for the the Rcpp::plugins attribute 2013-09-18 Romain Francois - * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE - by default. - * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is - what we should encourage people to use. + * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting + attributes to TRUE by default. + * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by + default. This is what we should encourage people to use. * include/Rcpp/as.h: add as specialization - * include/Rcpp/sugar/functions/diff.h : rework the implementation of diff - so that it works even when we don't know the previous value - * unitTests/runit.sugar.R : + * include/Rcpp/sugar/functions/diff.h : rework the implementation of + diff so that it works even when we don't know the previous value + * unitTests/runit.sugar.R : * unitTests/cpp/sugar.cpp : * include/Rcpp/sugar/functions/range.h : factored out of minmax.h * include/Rcpp/sugar/functions/min.h : factored out of minmax.h * include/Rcpp/sugar/functions/max.h : factored out of minmax.h * TODO : 3 less items - + 2013-09-17 JJ Allaire * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-19 23:02:23 UTC (rev 4523) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-20 00:01:34 UTC (rev 4524) @@ -48,7 +48,8 @@ \code{__LONG_LONG_MAX__} is defined, then we have typedefs \code{rcpp_long_long_type} and \code{rcpp_ulong_long_type} that are defined behind a gcc \code{__extension__}. This way, we can create useful - features supporting long long, while having \code{-pedantic} not warn about it. + features supporting long long, while having \code{-pedantic} not + warn about it. Note that this still depends on C++11. } \item Changes in Attributes: \itemize{ Modified: pkg/Rcpp/inst/include/Rcpp/longlong.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/longlong.h 2013-09-19 23:02:23 UTC (rev 4523) +++ pkg/Rcpp/inst/include/Rcpp/longlong.h 2013-09-20 00:01:34 UTC (rev 4524) @@ -1,4 +1,4 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // longlong.h: Rcpp R/C++ interface class library -- long long support // @@ -22,6 +22,14 @@ #ifndef RCPP_LONG_LONG_H #define RCPP_LONG_LONG_H +// This does not work as C++98, our default, has no long long support. +// So we are wrapping another layer of C++11 test around it. Feel free +// to add a boolean OR with another suitably #define'd variable which +// has to be OFF by default to restore the old behaviour. + +#ifdef __GNUC__ +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) + // long long and unssigned long long support. // // given the current restriction of what might go to CRAN @@ -71,5 +79,7 @@ } #endif +#endif +#endif #endif From noreply at r-forge.r-project.org Fri Sep 20 14:40:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 20 Sep 2013 14:40:57 +0200 (CEST) Subject: [Rcpp-commits] r4525 - pkg/Rcpp/inst/include/Rcpp Message-ID: <20130920124057.52FB0185E23@r-forge.r-project.org> Author: edd Date: 2013-09-20 14:40:57 +0200 (Fri, 20 Sep 2013) New Revision: 4525 Modified: pkg/Rcpp/inst/include/Rcpp/longlong.h Log: shortened / corrected the long comment: 'long long' is on with either clang, or -std=c++11 Modified: pkg/Rcpp/inst/include/Rcpp/longlong.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/longlong.h 2013-09-20 00:01:34 UTC (rev 4524) +++ pkg/Rcpp/inst/include/Rcpp/longlong.h 2013-09-20 12:40:57 UTC (rev 4525) @@ -22,64 +22,41 @@ #ifndef RCPP_LONG_LONG_H #define RCPP_LONG_LONG_H -// This does not work as C++98, our default, has no long long support. -// So we are wrapping another layer of C++11 test around it. Feel free -// to add a boolean OR with another suitably #define'd variable which -// has to be OFF by default to restore the old behaviour. +// 'long long' is a C99 extension and (as of fall 2013) still +// forbidden by CRAN which stick with the C++98 standard predating it. +// One way to get 'long long' is to switch to C++11, another is to use +// clang++ from the llvm project. #ifdef __GNUC__ -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) + #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) -// long long and unssigned long long support. -// -// given the current restriction of what might go to CRAN -// we can only use long long if we are running a gcc compatible (e.g. clang) -// compiler and the type is actually available (hence the test for __LONG_LONG_MAX__) -// even then, we cannot use long long as is, we first have to "hide" it -// behind the __extension__ so that -pedantic stops giving warnings about -// compliance with C++98 -// -// client code may use the facilities we provide for long long (wrap, etc ...) -// but not using long long directly, because then it is not CRAN proof. -// So client code must use the rcpp_long_long_type and rcpp_ulong_long_type -// types -// -// e.g. code like this is not good: -// -// long long x = 2 ; -// -// but code like this is CRAN proof -// -// rcpp_long_long_type x = 2 ; -// -// Note that if you don't distribute your code to CRAN and you don't use the -// -pedantic option, then you can use long long -#if defined(__GNUC__) && defined(__LONG_LONG_MAX__) - __extension__ typedef long long int rcpp_long_long_type; - __extension__ typedef unsigned long long int rcpp_ulong_long_type; - #define RCPP_HAS_LONG_LONG_TYPES + #if defined(__GNUC__) && defined(__LONG_LONG_MAX__) + __extension__ typedef long long int rcpp_long_long_type; + __extension__ typedef unsigned long long int rcpp_ulong_long_type; + #define RCPP_HAS_LONG_LONG_TYPES + #endif + + #endif #endif + #if defined(RCPP_HAS_LONG_LONG_TYPES) namespace Rcpp{ -namespace traits{ + namespace traits{ - template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; - template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; + template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; + template<> struct r_sexptype_traits{ enum{ rtype = REALSXP } ; } ; - template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; - template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; - template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; - template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits{ typedef r_type_primitive_tag r_category ; } ; + template<> struct r_type_traits< std::pair >{ typedef r_type_primitive_tag r_category ; } ; - template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; - template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; + template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; + template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; + } } -} #endif #endif -#endif - -#endif From noreply at r-forge.r-project.org Fri Sep 20 21:12:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 20 Sep 2013 21:12:57 +0200 (CEST) Subject: [Rcpp-commits] r4526 - in pkg/Rcpp: . R man Message-ID: <20130920191257.EB24D183FB9@r-forge.r-project.org> Author: edd Date: 2013-09-20 21:12:57 +0200 (Fri, 20 Sep 2013) New Revision: 4526 Added: pkg/Rcpp/man/Rcpp-internal.Rd Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/NAMESPACE pkg/Rcpp/R/Module.R pkg/Rcpp/R/RcppClass.R pkg/Rcpp/man/setRcppClass.Rd Log: a number of smaller cosmetic changes (incl NAMESPACE additions and a new internal manual page) to make (R-devel's) R CMD check happy Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-20 12:40:57 UTC (rev 4525) +++ pkg/Rcpp/ChangeLog 2013-09-20 19:12:57 UTC (rev 4526) @@ -1,3 +1,14 @@ +2013-09-20 Dirk Eddelbuettel + + * R/Module.R: More ':::' cleanups to make R CMD check happy + * R/RcppClass.R: Ditto + + * NAMESPACE: Some new exports related to this + + * man/setRcppClass.Rd: Document loadRcppClass() + * man/Rcpp-internal.Rd: Added in order to document + cpp_object_initializer() and cpp_object_dummy() + 2013-09-19 Dirk Eddelbuettel * inst/include/Rcpp/longlong.h: Unbreak long long by making it (as Modified: pkg/Rcpp/NAMESPACE =================================================================== --- pkg/Rcpp/NAMESPACE 2013-09-20 12:40:57 UTC (rev 4525) +++ pkg/Rcpp/NAMESPACE 2013-09-20 19:12:57 UTC (rev 4526) @@ -18,14 +18,18 @@ populate, loadRcppModules, setRcppClass, + loadRcppClass, loadModule, cppFunction, evalCpp, sourceCpp, compileAttributes, registerPlugin, - RcppLdFlags, - demangle, sizeof + RcppLdFlags, + demangle, + sizeof, + cpp_object_initializer, + cpp_object_dummy ) S3method( print, bytes ) exportClass(RcppClass) Modified: pkg/Rcpp/R/Module.R =================================================================== --- pkg/Rcpp/R/Module.R 2013-09-20 12:40:57 UTC (rev 4525) +++ pkg/Rcpp/R/Module.R 2013-09-20 19:12:57 UTC (rev 4526) @@ -155,7 +155,7 @@ } cpp_object_maker <- function(typeid, pointer){ - Class <- Rcpp:::.classes_map[[ typeid ]] + Class <- .classes_map[[ typeid ]] new( Class, .object_pointer = pointer ) } @@ -230,11 +230,11 @@ .self <- .refClassDef <- NULL generator$methods(initialize = if(cpp_hasDefaultConstructor(CLASS)) - function(...) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...) + function(...) cpp_object_initializer(.self,.refClassDef, ...) else function(...) { - if(nargs()) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...) - else Rcpp:::cpp_object_dummy(.self, .refClassDef) + if(nargs()) cpp_object_initializer(.self,.refClassDef, ...) + else cpp_object_dummy(.self, .refClassDef) } ) rm( .self, .refClassDef ) @@ -264,12 +264,12 @@ } , where = where ) } } - + # promoting show to S4 if( any( grepl( "show", names(CLASS at methods) ) ) ){ setMethod( "show", clname, function(object) object$show(), where = where ) } - + } if(length(classes)) { module$refClassGenerators <- generators @@ -280,24 +280,24 @@ clname <- as.character(CLASS) demangled_name <- sub( "^Rcpp_", "", clname ) .classes_map[[ CLASS at typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp ) - - # exposing enums values as CLASS.VALUE + + # exposing enums values as CLASS.VALUE # (should really be CLASS$value but I don't know how to do it) if( length( CLASS at enums ) ){ for( enum in CLASS at enums ){ for( i in 1:length(enum) ){ - storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i] + storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i] } } } - + } # functions functions <- .Call( Module__functions_names, xp ) for( fun in functions ){ storage[[ fun ]] <- .get_Module_function( module, fun, xp ) - + # register as(FROM, TO) methods converter_rx <- "^[.]___converter___(.*)___(.*)$" if( length( matches <- grep( converter_rx, functions ) ) ){ @@ -306,13 +306,13 @@ from <- sub( converter_rx, "\\1", fun ) to <- sub( converter_rx, "\\2", fun ) converter <- function( from ){} - body( converter ) <- substitute( { CONVERT(from) }, + body( converter ) <- substitute( { CONVERT(from) }, list( CONVERT = storage[[fun]] ) ) setAs( from, to, converter, where = where ) } } - + } assign( "storage", storage, envir = as.environment(module) ) @@ -322,7 +322,7 @@ dealWith <- function( x ) if(isTRUE(x[[1]])) invisible(NULL) else x[[2]] method_wrapper <- function( METHOD, where ){ - noargs <- all( METHOD$nargs == 0 ) + noargs <- all( METHOD$nargs == 0 ) stuff <- list( class_pointer = METHOD$class_pointer, pointer = METHOD$pointer, @@ -335,9 +335,9 @@ f <- function(...) NULL if( noargs ){ formals(f) <- NULL - } - - extCall <- if( noargs ) { + } + + extCall <- if( noargs ) { if( all( METHOD$void ) ){ # all methods are void, so we know we want to return invisible(NULL) substitute( Modified: pkg/Rcpp/R/RcppClass.R =================================================================== --- pkg/Rcpp/R/RcppClass.R 2013-09-20 12:40:57 UTC (rev 4525) +++ pkg/Rcpp/R/RcppClass.R 2013-09-20 19:12:57 UTC (rev 4526) @@ -25,7 +25,7 @@ where = topenv(parent.frame()), ...) { myCall <- match.call() - myCall[[1]] <- quote(Rcpp:::loadRcppClass) + myCall[[1]] <- quote(Rcpp::loadRcppClass) if(!missing(module) && moduleIsLoaded(module, where)) # eval now eval.parent(myCall) else { Added: pkg/Rcpp/man/Rcpp-internal.Rd =================================================================== --- pkg/Rcpp/man/Rcpp-internal.Rd (rev 0) +++ pkg/Rcpp/man/Rcpp-internal.Rd 2013-09-20 19:12:57 UTC (rev 4526) @@ -0,0 +1,22 @@ +\name{Rcpp-internal} +\alias{Rcpp-internal} +\alias{cpp_object_initializer} +\alias{cpp_object_dummy} +\title{Rcpp internal functions} +\description{The \pkg{Rcpp} utilizes several internal functions which + need to visible within its namespace, yet are not user-facing. This + page provides basic documentation for them. +} +\usage{ + cpp_object_initializer(.self, .refClassDef, ..., .object_pointer) + cpp_object_dummy(.self, .refClassDef) +} +\arguments{ + \item{.self}{A reference to the object being modified} + \item{.refClassDef}{The definition of a reference class} + \item{...}{Further arguments} + \item{.object_pointer}{Optional external pointer} +} +\keyword{programming} +\keyword{interface} +\keyword{internal} Modified: pkg/Rcpp/man/setRcppClass.Rd =================================================================== --- pkg/Rcpp/man/setRcppClass.Rd 2013-09-20 12:40:57 UTC (rev 4525) +++ pkg/Rcpp/man/setRcppClass.Rd 2013-09-20 19:12:57 UTC (rev 4526) @@ -1,5 +1,6 @@ \name{setRcppClass} \alias{setRcppClass} +\alias{loadRcppClass} \alias{RcppClass-class} \title{ Create a Class Extending a C++ Class @@ -13,6 +14,9 @@ \usage{ setRcppClass(Class, CppClass, module, fields = list(), contains = , methods = , saveAs = Class, where = , ...) +loadRcppClass(Class, CppClass, module, fields = character(), + contains = character(), + methods = , saveAs = Class, where = , ...) } %- maybe also 'usage' for other objects documented here. \arguments{ @@ -50,7 +54,7 @@ } } \details{ -The call to this function normally appears in the source code for a +The call to these functions normally appears in the source code for a package. It generates a load action that loads the specified module and extracts the C++ class definition specified. From noreply at r-forge.r-project.org Sat Sep 21 17:23:37 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 21 Sep 2013 17:23:37 +0200 (CEST) Subject: [Rcpp-commits] r4527 - in pkg/Rcpp: . vignettes Message-ID: <20130921152337.32564185B23@r-forge.r-project.org> Author: edd Date: 2013-09-21 17:23:36 +0200 (Sat, 21 Sep 2013) New Revision: 4527 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/vignettes/Rcpp-modules.Rnw Log: Remove local compilations from Rcpp-modules vignette -- package now passes win-builder Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-20 19:12:57 UTC (rev 4526) +++ pkg/Rcpp/ChangeLog 2013-09-21 15:23:36 UTC (rev 4527) @@ -1,3 +1,9 @@ +2013-09-21 Dirk Eddelbuettel + + * vignettes/Rcpp-modules.Rnw: Remove vignette-local compilations + which again caused problems for the Windows builds at R-Forge and + win-builder. Unit tests comprise the same functionality and pass. + 2013-09-20 Dirk Eddelbuettel * R/Module.R: More ':::' cleanups to make R CMD check happy Modified: pkg/Rcpp/vignettes/Rcpp-modules.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-20 19:12:57 UTC (rev 4526) +++ pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-21 15:23:36 UTC (rev 4527) @@ -21,8 +21,7 @@ \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} <>= -require( inline ) -require( Rcpp ) +suppressMessages(require(Rcpp)) prettyVersion <- packageDescription("Rcpp")$Version prettyDate <- format(Sys.Date(), "%B %e, %Y") @ @@ -31,27 +30,6 @@ \title{Exposing \proglang{C++} functions and classes with \pkg{Rcpp} modules} \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} -<>= -link <- function( f, package, text = f, root = "http://finzi.psych.upenn.edu/R/library/" ) { - h <- if( missing(package) ) { - as.character( help( f ) ) - } else { - as.character( help( f, package = paste( package, sep = "" ) ) ) - } - if( ! length(h) ) { - sprintf( "\\\\textbf{%s}", f ) - } else { - rx <- "^.*/([^/]*?)/help/(.*?)$" - package <- sub( rx, "\\1", h, perl = TRUE ) - page <- sub( rx, "\\2", h, perl = TRUE ) - sprintf( "\\\\href{%s%s/html/%s.html}{\\\\texttt{%s}}", root, package, page, text ) - } -} -linkS4class <- function( cl, package, text = cl, root = "http://finzi.psych.upenn.edu/R/library/" ) { - link( sprintf("%s-class", cl), package, text, root ) -} -@ - \begin{document} \maketitle @@ -78,7 +56,7 @@ These \pkg{Rcpp} facilities offer a lot of assistance to the programmer wishing to interface \proglang{R} and \proglang{C++}. At the same time, these facilities are limited as they operate on a function-by-function basis. The -programmer has to implement a \Sexpr{link(".Call")} compatible function (to +programmer has to implement a \code{.Call} compatible function (to conform to the \proglang{R} API) using classes of the \pkg{Rcpp} API as described in the next section. @@ -127,6 +105,24 @@ provides a much more elegant and unintrusive way to expose \proglang{C++} functions such as the \texttt{norm} function shown above to \proglang{R}. +We should note that \pkg{Rcpp} now has \textsl{Rcpp attributes} which extends +certain aspect of \textsl{Rcpp modules} and makes binding to simple functions +such as this one even easier. With \textsl{Rcpp attribues} we can just write + +<>= +# include + +// [[Rcpp::export]] +double norm(double x, double y) { + return sqrt(x*x + y*y); +} +@ + +See the corresponding vignette \citep{CRAN:Rcpp:Attributes} for details, but +read on for \textsl{Rcpp modules} which contains to provide features not +covered by \textsl{Rcpp attributes}, particularly when it comes to binding +entire C++ classes and more. + \subsection{Exposing classes using Rcpp} Exposing \proglang{C++} classes or structs is even more of a challenge because it @@ -191,57 +187,22 @@ they usually get wrapped as a slot of an S4 class. Using \code{cxxfunction()} from the \pkg{inline} package, we can build this -example on the fly: +example on the fly. Suppose the previous example code assigned to a text variable +\texttt{unifModcode}, we could then do -<<>>= -f1 <- cxxfunction( , "", includes = ' -using namespace Rcpp; - -class Uniform { -public: - Uniform(double min_, double max_) : min(min_), max(max_) {} - - NumericVector draw(int n) { - RNGScope scope; - return runif( n, min, max ); - } - -private: - double min, max; -}; - -/// create an external pointer to a Uniform object -RcppExport SEXP Uniform__new(SEXP min_, SEXP max_) { - // convert inputs to appropriate C++ types - double min = as(min_), max = as(max_); - - // create a pointer to an Uniform object and wrap it - // as an external pointer - Rcpp::XPtr ptr( new Uniform( min, max ), true ); - - // return the external pointer to the R side - return ptr; -} - -/// invoke the draw method -RcppExport SEXP Uniform__draw( SEXP xp, SEXP n_ ) { - // grab the object as a XPtr (smart pointer) to Uniform - Rcpp::XPtr ptr(xp); - - // convert the parameter to int - int n = as(n_); - - // invoke the function - NumericVector res = ptr->draw( n ); - - // return the result to R - return res; -} -', plugin = "Rcpp" ) -getDynLib( f1 ) +%% DE 21 Sep 2013: there must a bug somewhere in the vignette processing +%% as the following example produces only empty lines preceded +%% by '+' -- same for 0.10.4 release and current 0.10.5 pre-release +%% hence shortened example to not show code again +<>= +f1 <- cxxfunction( , "", includes = unifModCode, plugin = "Rcpp" ) +getDynLib(f1) ## will display information about 'f1' just created @ -<<>>= +The following listing shows some \textsl{manual} wrapping to access the code, +we will see later how this can be automated: + +<>= setClass( "Uniform", representation( pointer = "externalptr" ) ) # helper @@ -309,9 +270,9 @@ the need for a wrapper function using either \pkg{Rcpp} or the \proglang{R} API. On the \proglang{R} side, the module is retrieved by using the -\Sexpr{link("Module")} function from \pkg{Rcpp} +\code{Module} function from \pkg{Rcpp} -<<>>= +<>= inc <- ' using namespace Rcpp; @@ -325,8 +286,7 @@ ' fx <- cxxfunction(signature(), plugin="Rcpp", include=inc) -mod <- Module( "mod", getDynLib(fx) ) -mod$norm( 3, 4 ) +mod <- Module("mod", getDynLib(fx)) @ Note that this example assumed that the previous code segment defining the @@ -380,12 +340,12 @@ RCPP_MODULE(yada) { using namespace Rcpp; - function( "hello" , &hello ); - function( "bar" , &bar ); - function( "foo" , &foo ); - function( "bla" , &bla ); - function( "bla1" , &bla1 ); - function( "bla2" , &bla2 ); + function("hello" , &hello); + function("bar" , &bar ); + function("foo" , &foo ); + function("bla" , &bla ); + function("bla1" , &bla1 ); + function("bla2" , &bla2 ); } @ @@ -394,13 +354,13 @@ <>= require( Rcpp ) -yd <- Module( "yada", getDynLib(fx) ) -yd$bar( 2L ) -yd$foo( 2L, 10.0 ) +yd <- Module("yada", getDynLib(fx)) +yd$bar(2L) +yd$foo(2L, 10.0) yd$hello() yd$bla() -yd$bla1( 2L) -yd$bla2( 2L, 5.0 ) +yd$bla1(2L) +yd$bla2(2L, 5.0) @ In the case of a package (as for example the one created by @@ -408,14 +368,14 @@ below), we can use <>= -require( myModulePackage ) ## or whichever name was chose +require(myModulePackage) ## or whichever name was chose -bar( 2L ) -foo( 2L, 10.0 ) +bar(2L) +foo(2L, 10.0) hello() bla() -bla1( 2L) -bla2( 2L, 5.0 ) +bla1(2L) +bla2(2L, 5.0) @ @@ -452,24 +412,10 @@ The description is used when displaying the function to the R prompt: -<>= -fx <- cxxfunction( , "", includes = ' - -using namespace Rcpp; - -double norm( double x, double y ) { - return sqrt( x*x + y*y ); -} - -RCPP_MODULE(mod) { - function( "norm", &norm, "Provides a simple vector norm" ); -} -', plugin = "Rcpp" ) +<>= +mod <- Module("mod", getDynLib(fx)) +show(mod$norm) @ -<<>>= -mod <- Module( "mod", getDynLib( fx ) ) -show( mod$norm ) -@ \subsubsection{Formal arguments specification} @@ -494,23 +440,7 @@ A simple usage example is provided below: -<>= -fx_form <- cxxfunction( , '', includes = ' -using namespace Rcpp; - -double norm( double x, double y ) { - return sqrt( x*x + y*y ); -} - -RCPP_MODULE(mod_formals) { - function("norm", &norm, - List::create( _["x"] = 0.0, _["y"] = 0.0 ), - "Provides a simple vector norm"); -} -', plugin = "Rcpp" ) -mod <- Module( "mod_formals", getDynLib( fx_form ), mustStart = TRUE ) -@ -<<>>= +<>= norm <- mod$norm norm() norm( y = 2 ) @@ -536,25 +466,9 @@ This can be used as follows: -<>= -fx_form2 <- cxxfunction( , '', includes = ' -using namespace Rcpp; - -double norm( double x, double y ) { - return sqrt( x*x + y*y ); -} - -RCPP_MODULE(mod_formals2) { - function("norm", &norm, - List::create( _["x"], _["y"] = 0.0 ), - "Provides a simple vector norm"); -} -', plugin = "Rcpp" ) -mod <- Module( "mod_formals2", getDynLib( fx_form2 ), mustStart = TRUE ) -@ -<<>>= +<>= norm <- mod$norm -args( norm ) +args(norm) @ The ellipsis (\texttt{...}) can be used to denote that additional arguments @@ -573,23 +487,7 @@ "documentation for norm"); } @ -<>= -fx_form3 <- cxxfunction( , '', includes = ' -using namespace Rcpp; - -double norm( double x, double y ) { - return sqrt( x*x + y*y ); -} - -RCPP_MODULE(mod_formals3) { - function( "norm", &norm, - List::create( _["x"] , _["..."] ), - "documentation for norm"); -} -', plugin = "Rcpp" ) -mod <- Module( "mod_formals3", getDynLib( fx_form3 ), mustStart = TRUE ) -@ -<<>>= +<>= norm <- mod$norm args( norm ) @ @@ -639,42 +537,7 @@ } @ -<>= -fx_unif <- cxxfunction( , "", includes = ' -using namespace Rcpp; -class Uniform { -public: - Uniform(double min_, double max_) : min(min_), max(max_) {} - - NumericVector draw(int n) const { - RNGScope scope; - return runif( n, min, max ); - } - - double min, max; -}; - -double uniformRange( Uniform* w) { - return w->max - w->min; -} - -RCPP_MODULE(unif_module) { - - class_( "Uniform" ) - - .constructor() - - .field( "min", &Uniform::min ) - .field( "max", &Uniform::max ) - - .method( "draw", &Uniform::draw ) - .method( "range", &uniformRange ) - ; - -} -', plugin = "Rcpp" ) -@ -<<>>= +<>= ## assumes fx_unif <- cxxfunction(...) has ben run unif_module <- Module( "unif_module", getDynLib(fx_unif ) ) Uniform <- unif_module$Uniform @@ -848,46 +711,7 @@ Here is a simple usage example: -<>= -fx_bar <- cxxfunction( , "", includes = ' -class Bar { -public: - - Bar(double x_) : x(x_), nread(0), nwrite(0) {} - - double get_x( ) { - nread++; - return x; - } - - void set_x( double x_) { - nwrite++; - x = x_; - } - - IntegerVector stats() const { - return IntegerVector::create(_["read"] = nread, - _["write"] = nwrite); - } - -private: - double x; - int nread, nwrite; -}; - -RCPP_MODULE(mod_bar) { - class_( "Bar" ) - - .constructor() - - .property( "x", &Bar::get_x, &Bar::set_x ) - .method( "stats", &Bar::stats ) - ; -} -', plugin = "Rcpp" ) -mod_bar <- Module( "mod_bar", getDynLib( fx_bar ) ) -@ -<<>>= +<>= Bar <- mod_bar$Bar b <- new( Bar, 10 ) b$x + b$x @@ -1037,71 +861,7 @@ } @ -<>= -fx_vec <- cxxfunction(, '', includes = ' -// convenience typedef -typedef std::vector vec; - -// helpers -void vec_assign( vec* obj, Rcpp::NumericVector data ) { - obj->assign( data.begin(), data.end() ); -} - -void vec_insert( vec* obj, int position, Rcpp::NumericVector data) { - vec::iterator it = obj->begin() + position; - obj->insert( it, data.begin(), data.end() ); -} - -Rcpp::NumericVector vec_asR( vec* obj ) { - return Rcpp::wrap( *obj ); -} - -void vec_set( vec* obj, int i, double value ) { - obj->at( i ) = value; -} - -RCPP_MODULE(mod_vec) { - using namespace Rcpp; - - // we expose the class std::vector as "vec" on the R side - class_( "vec") - - // exposing constructors - .constructor() - .constructor() - - // exposing member functions - .method( "size", &vec::size) - .method( "max_size", &vec::max_size) - .method( "resize", &vec::resize) - .method( "capacity", &vec::capacity) - .method( "empty", &vec::empty) - .method( "reserve", &vec::reserve) - .method( "push_back", &vec::push_back ) - .method( "pop_back", &vec::pop_back ) - .method( "clear", &vec::clear ) - - // specifically exposing const member functions - .const_method( "back", &vec::back ) - .const_method( "front", &vec::front ) - .const_method( "at", &vec::at ) - - // exposing free functions taking a std::vector* - // as their first argument - .method( "assign", &vec_assign ) - .method( "insert", &vec_insert ) - .method( "as.vector", &vec_asR ) - - // special methods for indexing - .const_method( "[[", &vec::at ) - .method( "[[<-", &vec_set ) - - ; -} -', plugin = "Rcpp" ) -@ - -<<>>= +<>= ## for code compiled on the fly using cxxfunction() into 'fx_vec', we use mod_vec <- Module( "mod_vec", getDynLib(fx_vec), mustStart = TRUE ) vec <- mod_vec$vec @@ -1137,8 +897,8 @@ @ The simplest way to load all functions and classes from a module directly -into a package namespace is to use the \Sexpr{link("loadRcppModules" )} function -within the \Sexpr{link(".onLoad" )} body. +into a package namespace is to use the \code{loadRcppModules} function +within the \code{.onLoad} body. <>= .onLoad <- function(libname, pkgname) { @@ -1157,7 +917,7 @@ RcppModules: yada, stdVector, NumEx \end{verbatim} -The \Sexpr{link("loadRcppModules" )} has a single argument \texttt{direct} +The \code{loadRcppModules} function has a single argument \texttt{direct} with a default value of \texttt{TRUE}. With this default value, all content from the module is exposed directly in the package namespace. If set to \texttt{FALSE}, all content is exposed as components of the module. @@ -1199,7 +959,7 @@ \subsection{Support for modules in skeleton generator} -The \Sexpr{link("Rcpp.package.skeleton")} function has been improved to help +The \code{Rcpp.package.skeleton} function has been improved to help \pkg{Rcpp} modules. When the \texttt{module} argument is set to \texttt{TRUE}, the skeleton generator installs code that uses a simple module. @@ -1213,8 +973,8 @@ \subsection{Module documentation} -\pkg{Rcpp} defines a \Sexpr{link("prompt")} method for the -\Sexpr{linkS4class("Module")} class, allowing generation of a skeleton of an Rd +\pkg{Rcpp} defines a \code{prompt} method for the +\code{Module} class, allowing generation of a skeleton of an Rd file containing some information about the module. <>= From noreply at r-forge.r-project.org Sat Sep 21 17:24:38 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 21 Sep 2013 17:24:38 +0200 (CEST) Subject: [Rcpp-commits] r4528 - pkg/Rcpp/inst Message-ID: <20130921152439.090C8185B23@r-forge.r-project.org> Author: edd Date: 2013-09-21 17:24:38 +0200 (Sat, 21 Sep 2013) New Revision: 4528 Modified: pkg/Rcpp/inst/NEWS.Rd Log: cleanup Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-21 15:23:36 UTC (rev 4527) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-21 15:24:38 UTC (rev 4528) @@ -43,13 +43,6 @@ file \item \code{RcppLdFlags()}, often used in \code{Makevars} files of packages using \pkg{Rcpp}, is now exported from the package namespace. - \item Less restritive support for \code{long long}. If we are using a gcc - compatible compiler and the long long type is available (i.e. the - \code{__LONG_LONG_MAX__} is defined, then we have typedefs - \code{rcpp_long_long_type} and \code{rcpp_ulong_long_type} that are defined - behind a gcc \code{__extension__}. This way, we can create useful - features supporting long long, while having \code{-pedantic} not - warn about it. Note that this still depends on C++11. } \item Changes in Attributes: \itemize{ From noreply at r-forge.r-project.org Sat Sep 21 17:43:34 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 21 Sep 2013 17:43:34 +0200 (CEST) Subject: [Rcpp-commits] r4529 - in pkg/Rcpp: . inst vignettes Message-ID: <20130921154334.D6550185B23@r-forge.r-project.org> Author: edd Date: 2013-09-21 17:43:34 +0200 (Sat, 21 Sep 2013) New Revision: 4529 Modified: pkg/Rcpp/.Rbuildignore pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw pkg/Rcpp/vignettes/Rcpp-attributes.Rnw pkg/Rcpp/vignettes/Rcpp-extending.Rnw pkg/Rcpp/vignettes/Rcpp-modules.Rnw pkg/Rcpp/vignettes/Rcpp-package.Rnw pkg/Rcpp/vignettes/Rcpp-quickref.Rnw pkg/Rcpp/vignettes/Rcpp-sugar.Rnw Log: refresh look of vignettes by using Bitstream Charter, and microtype package (cf http://www.khirevich.com/latex) add vignettes/notyet to .Rbuildignore Modified: pkg/Rcpp/.Rbuildignore =================================================================== --- pkg/Rcpp/.Rbuildignore 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/.Rbuildignore 2013-09-21 15:43:34 UTC (rev 4529) @@ -9,3 +9,4 @@ ^\.Rproj\.user$ inst/include/Rcpp/preprocessor inst/include/Rcpp/sugar/functions/impl +vignettes/notyet Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/ChangeLog 2013-09-21 15:43:34 UTC (rev 4529) @@ -4,6 +4,15 @@ which again caused problems for the Windows builds at R-Forge and win-builder. Unit tests comprise the same functionality and pass. + * vignettes/Rcpp-attributes.Rnw: Refresh look by using Bitstream + Charter, and microtype package (cf http://www.khirevich.com/latex) + * vignettes/Rcpp-extending.Rnw: Idem + * vignettes/Rcpp-FAQ.Rnw: Idem + * vignettes/Rcpp-modules.Rnw: Idem + * vignettes/Rcpp-package.Rnw: Idem + * vignettes/Rcpp-quickref.Rnw: Idem + * vignettes/Rcpp-sugar.Rnw: Idem + 2013-09-20 Dirk Eddelbuettel * R/Module.R: More ':::' cleanups to make R CMD check happy Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-21 15:43:34 UTC (rev 4529) @@ -74,9 +74,11 @@ \item Changes in Rcpp documentation: \itemize{ \item The vignettes have been moved from \code{inst/doc/} to the - \code{vignettes} directory which is now preferred + \code{vignettes} directory which is now preferred. \item The unitTest vignette has been disabled as no longer builds - when called from \code{R CMD check}; + when called from \code{R CMD check}. + \item The appearance of the vignettes has been refreshed by + switching to the Bistream Charter font, and microtype package. } \item Deprecation of \code{RCPP_FUNCTION_*}: \itemize{ Modified: pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -16,6 +16,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} \newcommand{\code}[1]{\texttt{#1}} Modified: pkg/Rcpp/vignettes/Rcpp-attributes.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -4,7 +4,6 @@ \usepackage[USletter]{vmargin} \setmargrb{1.25in}{1.25in}{1.25in}{1.25in} - \usepackage{textcomp} \usepackage{color, alltt} \usepackage[authoryear,round,longnamesfirst]{natbib} @@ -18,6 +17,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} \newcommand{\code}[1]{\texttt{#1}} Modified: pkg/Rcpp/vignettes/Rcpp-extending.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-extending.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-extending.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -16,6 +16,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} Modified: pkg/Rcpp/vignettes/Rcpp-modules.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-modules.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -16,6 +16,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\code}[1]{\texttt{#1}} \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -16,6 +16,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} @@ -146,12 +150,12 @@ \subsection{\proglang{C++} code} -If the \texttt{attributes} argument is set to +If the \texttt{attributes} argument is set to \texttt{TRUE}\footnote{Setting \texttt{attributes} to \texttt{TRUE} is the default. This document -does not cover the behavior of \texttt{Rcpp.package.skeleton} when \texttt{attributes} is set -to \texttt{FALSE} as we try to encourage package developpers to use -attributes. }, -the following \proglang{C++} file is included in the \texttt{src/} directory: +does not cover the behavior of \texttt{Rcpp.package.skeleton} when \texttt{attributes} is set +to \texttt{FALSE} as we try to encourage package developpers to use +attributes. }, +the following \proglang{C++} file is included in the \texttt{src/} directory: <>= #include @@ -169,14 +173,14 @@ @ The file defines the simple \texttt{rcpp\_hello\_world} function that -uses a few \pkg{Rcpp} classes and returns a \texttt{List}. +uses a few \pkg{Rcpp} classes and returns a \texttt{List}. This function is preceded by the \texttt{Rcpp::export} attribute to automatically -handle argument conversion because \proglang{R} has to be taught how to -e.g. handle the \texttt{List} class. +handle argument conversion because \proglang{R} has to be taught how to +e.g. handle the \texttt{List} class. \Sexpr{link("Rcpp.package.skeleton")} then invokes \Sexpr{link("compileAttributes")} -on the package, which generates the \texttt{RcppExports.cpp} file: +on the package, which generates the \texttt{RcppExports.cpp} file: <>= // This file was generated by Rcpp::compileAttributes @@ -203,16 +207,16 @@ @ This file defines a function with the appropriate calling convention, suitable for -\Sexpr{link(".Call")}. It needs to be regenerated each time functions -exposed by attributes are modified. This is the task of the +\Sexpr{link(".Call")}. It needs to be regenerated each time functions +exposed by attributes are modified. This is the task of the \Sexpr{link("compileAttributes")} function. A discussion on attributes is -beyond the scope of this document and more information is available -in the attributes vignette \citep{CRAN:Rcpp:Attributes}. +beyond the scope of this document and more information is available +in the attributes vignette \citep{CRAN:Rcpp:Attributes}. \subsection{\proglang{R} code} -The \Sexpr{link("compileAttributes")} also generates \proglang{R} code -that uses the \proglang{C++} function. +The \Sexpr{link("compileAttributes")} also generates \proglang{R} code +that uses the \proglang{C++} function. <>= # This file was generated by Rcpp::compileAttributes @@ -224,7 +228,7 @@ @ This is also a generated file so it should not be modified manually, rather -regenerated as needed by \Sexpr{link("compileAttributes")}. +regenerated as needed by \Sexpr{link("compileAttributes")}. \subsection{\texttt{DESCRIPTION}} @@ -411,7 +415,7 @@ This document does not cover the use of the \texttt{module} argument of \Sexpr{link("Rcpp.package.skeleton")}. It is covered -in the modules vignette \citep{CRAN:Rcpp:Modules}. +in the modules vignette \citep{CRAN:Rcpp:Modules}. \section{Further examples} Modified: pkg/Rcpp/vignettes/Rcpp-quickref.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-quickref.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -17,6 +17,10 @@ \usepackage[colorlinks]{hyperref} +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} <>= Modified: pkg/Rcpp/vignettes/Rcpp-sugar.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-sugar.Rnw 2013-09-21 15:24:38 UTC (rev 4528) +++ pkg/Rcpp/vignettes/Rcpp-sugar.Rnw 2013-09-21 15:43:34 UTC (rev 4529) @@ -16,6 +16,10 @@ urlcolor=link } +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ + \newcommand{\proglang}[1]{\textsf{#1}} \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} \newcommand{\sugar}{\textsl{Rcpp sugar}} From noreply at r-forge.r-project.org Sun Sep 22 05:13:48 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 22 Sep 2013 05:13:48 +0200 (CEST) Subject: [Rcpp-commits] r4530 - testlogs Message-ID: <20130922031349.07096185F6E@r-forge.r-project.org> Author: edd Date: 2013-09-22 05:13:45 +0200 (Sun, 22 Sep 2013) New Revision: 4530 Added: testlogs/Rcpp-Summary-20130319.R testlogs/Rcpp-Summary-20130622.R testlogs/Rcpp-Summary-20130921.R testlogs/Rcpp-check-20130319-2138.txt testlogs/Rcpp-check-20130921-1222.txt testlogs/result-20130319-233519.RData testlogs/result-20130319-233519.txt testlogs/result-20130620-075629.RData testlogs/result-20130620-075629.txt testlogs/result-20130921-173123.RData testlogs/result-20130921-173123.txt Log: current and previous regression test logs Added: testlogs/Rcpp-Summary-20130319.R =================================================================== --- testlogs/Rcpp-Summary-20130319.R (rev 0) +++ testlogs/Rcpp-Summary-20130319.R 2013-09-22 03:13:45 UTC (rev 4530) @@ -0,0 +1,63 @@ + +goodPkg <- c("acer", "ALKr", "Amelia", "apcluster", "bcp", "bfa", + "bfp", "bifactorial", "blockcluster", "ccaPP", "cda", + "clusteval", "ConConPiWiFun", "ecp", "fastGHQuad", + "fdaMixed", "forecast", "gof", "growcurves", "GUTS", + "KernSmoothIRT", "Kmisc", "LaF", "minqa", "mMRMe", + "multmod", "mvabund", "MVB", "NetworkAnalysis", "oem", + "openair", "parser", "phom", "phylobase", "planar", + "psgp", "quadrupen", "Rchemcpp", "Rclusterpp", + "RcppArmadillo", "RcppBDT", "rcppbugs", "RcppClassic", + "RcppClassicExamples", "RcppCNPy", "RcppDE", "RcppEigen", + "RcppExamples", "RcppGSL", "RcppOctave", "RcppRoll", + "RcppSMC", "RcppXts", "rexpokit", "rforensicbatwing", + "rgam", "RInside", "Rmalchains", "Rmessenger", "Rmixmod", + "robustgam", "robustHD", "rococo", "RProtoBuf", + "RQuantLib", "RSNNS", "RSofia", "rugarch", + "RVowpalWabbit", "SBSA", "sdcMicro", "simFrame", + "sparseHessianFD", "sparseLTSEigen", "SpatialTools", + "stochvol", "survSNP", "termstrc", "tmg", "transmission", + "transnet", "trustOptim", "unmarked", "waffect", + "wordcloud", "zic" ) + +badPkg <- c("auteur", "classify", "ExactNumCI", "EpiContactTrace", + "fugeR", "GeneticTools", "gMWT", "gRbase", "gRim", + "HLMdiag", "httpuv", "jaatha", "marked", "maxent", "mets", + "mirt", "ngspatial", "orQA", "PReMiuM", "sdcTable", + "spacodir", "stream", "surveillance", "VIM", "WideLM" ) + +bad4missing <- c("auteur", # geiger + "classify", # R2WinBugs, R2jags + "EpiContactTrace", # ?igraph0? ?R2HTML? + "fugeR", # snowfall + "GeneticTools", # ?gMWT? ?snpStats? + "gMWT", # clinfun + "gRbase", # fastmatch RBGL + "gRim", # ?gRbase? ?gRain? ?doBy? + "HLMdiag", # 'mlmRev' + "jaatha", # ?phyclust? + "marked", # ?optimx? ?R2admb? + "maxent", # tm + "mets", # ?lava? ?timereg? ?prodlim? + "mirt", # ?psych? ?GPArotation? + "ngspatial", # ?batchmeans? + "orQA", # ?genefilter? + "PReMiuM", # clue + "sdcTable", # lpSolveAPI + "spacodir", # picante + "stream", # ?proxy? ?clusterGeneration? ?fpc? ?birch? ?clue? ?mlbench? + "surveillance", # spatstat + "VIM", # vcd + "WideLM" # CUDA needs gcc/g++ 4.5 set as CC + ) + +bad4error <- c("ExactNumCI", # needs BOOSTLIB defined, bad src/ file + "httpuv") # C++ mixup + + +cat("Good ", length(goodPkg), "\n") +cat("Bad ", length(badPkg), "\n") +cat(" MissDep ", length(bad4missing), "\n") +cat(" Errors ", length(bad4error), "\n") +cat("Total ", length(goodPkg)+length(badPkg), "\n") +cat("Error Pct ", length(bad4error)/(length(bad4error)+length(goodPkg)), "\n") Added: testlogs/Rcpp-Summary-20130622.R =================================================================== --- testlogs/Rcpp-Summary-20130622.R (rev 0) +++ testlogs/Rcpp-Summary-20130622.R 2013-09-22 03:13:45 UTC (rev 4530) @@ -0,0 +1,77 @@ + +## results here are edited after a second run following manual +## installation of a number of package missing in the first run + +goodPkg <- c("acer", "ALKr", "Amelia", "apcluster", "BayesComm", + "bcp", "bfa", "bfp", "bifactorial", "blockcluster", + "ccaPP", "cda", "cladoRcpp", "clogitL1", "clusteval", + "ConConPiWiFun", "Delaporte", "ecp", "fastGHQuad", + "FBFsearch", "forecast", "gRbase", "gRim", "growcurves", + "GSE", "GUTS", "httpuv", "jaatha", "Kmisc", "maxent", + "minqa", "MPTinR", "msgl", "multmod", "mvabund", "MVB", + "NetworkAnalysis", "oem", "phom", "phylobase", "planar", + "psgp", "RcppArmadillo", "RcppBDT", "rcppbugs", + "RcppClassic", "RcppClassicExamples", "RcppCNPy", + "RcppDE", "RcppEigen", "RcppExamples", "RcppGSL", + "RcppOctave", "RcppProgress", "RcppRoll", "RcppSMC", + "RcppXts", "rexpokit", "rforensicbatwing", "rgam", + "RInside", "Rmalschains", "RMessenger", "rmgarch", + "Rmixmod", "robustgam", "robustHD", "rococo", + "RProtoBuf", "RQuantLib", "RSNNS", "RSofia", "rugarch", + "RVowpalWabbit", "SBSA", "sdcMicro", "sequences", + "simFrame", "sparseHessianFD", "sparseLTSEigen", + "SpatialTools", "stochvol", "survSNP", "tagcloud", + "termstrc", "tmg", "transmission", "trustOptim", + "unmarked", "waffect", "WideLM", "wordcloud") + +badPkg <- c("ALDqr", "classify", "diversitree", "EpiContactTrace", + "ExactNumCI", "FastPCS", "fdaMixed", "fugeR", "geiger", + "GeneticTools", "gMWT", "GOsummaries", "HLMdiag", "LaF", + "marked", "mets", "mirt", "miscF", "ngspatial", "openair", + "orQA", "PReMiuM", "quadrupen", "sdcTable", "sirt", + "spacodiR", "stream", "surveillance", "tbart", "transnet", + "VIM") + +bad4missing <- c("ALDqr", # 'HyperbolicDist? ?sn? + "classify", # ?R2WinBUGS? ?R2jags? + "diversitree", # ?deSolve? ?subplex? + "EpiContactTrace", # ?igraph0? + "FastPCS", # ?matrixStats? + "fugeR", # snowfall + "geiger", # ?msm? ?subplex? ?deSolve? ?coda? ?ncbit? + "GeneticTools", # ?gMWT? ?snpStats? + "gMWT", # ?clinfun? + "GOsummaries", # ?gProfileR? ?limma? + "HLMdiag", # ?mlmRev? + "LaF", # 'yaml' + "marked", # ?optimx? ?coda? ?R2admb? + "mets", # ?lava? ?timereg? ?prodlim? + "mirt", # ?GPArotation? + "miscF", # ?MCMCpack? + "ngspatial", # ?batchmeans? + "openair", # ?latticeExtra? ?hexbin? ?RgoogleMaps? ?png? ?mapdata? + "orQA", # ?genefilter? + "PReMiuM", # ?clue? + "sdcTable", # ?lpSolveAPI? + "sirt", # ?pbivnorm? ?sfsmisc? + "spacodiR", # ?picante? + "stream", # ?proxy? ?rJava? ?clusterGeneration? ?fpc? ?birch? ?clue? ?mlbench? + "surveillance", # ?spatstat? + "tbart", # ?GISTools? + "transnet", # ?rJava? + "VIM") # ?vcd? + +## these fail initially but can all be run with some extra effort +bad4fixable <- c("ExactNumCI", # needs BOOSTLIB defined, bad src/ file + "fdaMixed", # no x11() device, need xvfb-run wrapper + "KernSmoothIRT") # rgl failed, needs full x11 session + +bad4error <- c("quadrupen") # killed after fscking six hours of cross-validation (??) + +cat("Good ", length(goodPkg), "\n") +cat("Bad ", length(bad4missing)+length(bad4fixable)+length(bad4error), "\n") +cat(" MissDep ", length(bad4missing), "\n") +cat(" Fixabled ", length(bad4fixable), "\n") +cat(" Borked ", length(bad4error), "\n") +cat("Total ", length(goodPkg)+length(bad4missing)+length(bad4fixable)+length(bad4error), "\n") +cat("Error Pct ", length(bad4error)/(length(bad4error)+length(bad4fixable)+length(goodPkg)), "\n") Added: testlogs/Rcpp-Summary-20130921.R =================================================================== --- testlogs/Rcpp-Summary-20130921.R (rev 0) +++ testlogs/Rcpp-Summary-20130921.R 2013-09-22 03:13:45 UTC (rev 4530) @@ -0,0 +1,77 @@ + +## results here are edited after a second run following manual +## installation of a number of package missing in the first run + + +goodPkg <- c("accelerometry", "acer", "AdaptiveSparsity", "ALKr", "Amelia", + "apcluster", "BayesComm", "bcp", "bfa", "bfp", "bifactorial", + "blockcluster", "ccaPP", "clogitL1", "clusteval", "ConConPiWiFun", + "coneproj", "Delaporte", "ecp", "EpiContactTrace", "fastGHQuad", + "FastPCS", "FastRCS", "FBFsearch", "fdaMixed", "forecast", "gRbase", + "gRim", "GSE", "GUTS", "httpuv", "inarmix", "jaatha", "Kmisc", + "maxent", "minqa", "MPTinR", "msgl", "multmod", "mvabund", "MVB", + "NetSim", "oem", "phom", "phylobase", "prospectr", "psgp", "Rankcluster", + "RcppArmadillo", "RcppBDT", "rcppbugs", "RcppClassic", "RcppClassicExamples", + "RcppDE", "RcppEigen", "RcppExamples", "RcppGSL", "RcppOctave", + "RcppProgress", "RcppRoll", "RcppSMC", "RcppXts", "rexpokit", + "rforensicbatwing", "rgam", "RInside", "Rmalschains", "RMessenger", + "rmgarch", "Rmixmod", "robustgam", "robustHD", "rococo", "rotations", + "RProtoBuf", "RQuantLib", "RSNNS", "RSofia", "rugarch", "RVowpalWabbit", + "SBSA", "sdcMicro", "sequences", "simFrame", "sparseHessianFD", + "sparseLTSEigen", "SpatialTools", "stochvol", "survSNP", "tagcloud", + "termstrc", "tmg", "transmission", "trustOptim", "unmarked", + "waffect", "WideLM", "wordcloud", "zic") + + +bad4missing <- c("ALDqr", # 'HyperbolicDist? + "CDM", # sirt, TAM + "classify", # ?R2WinBUGS? ?R2jags? + "climdex.pcic", # 'PCIct' + "diversitree", # ?deSolve? ?subplex? + "EpiContactTrace", # ?igraph0? + "FastPCS", # ?matrixStats? + "fugeR", # snowfall + "Funclustering", # fda + "geiger", # ?msm? ?subplex? ?deSolve? ?coda? ?ncbit? + "GeneticTools", # ?gMWT? ?snpStats? + "gMWT", # ?clinfun? + "GOsummaries", # ?gProfileR? ?limma? + "HLMdiag", # ?mlmRev? + "LaF", # 'yaml' + "lme4", # mlmRev + "marked", # ?optimx? ?coda? ?R2admb? + "mets", # ?lava? ?timereg? ?prodlim? + "mirt", # ?GPArotation? + "miscF", # ?MCMCpack? + "ngspatial", # ?batchmeans? + "openair", # ?latticeExtra? ?hexbin? ?RgoogleMaps? ?png? ?mapdata? + "orQA", # ?genefilter? + "PReMiuM", # ?clue? + "sdcTable", # ?lpSolveAPI? + "sirt", # ?pbivnorm? ?sfsmisc? + "spacodiR", # ?picante? + "surveillance", # ?spatstat? + "TAM", # ?tensor? ?sfsmisc? ?GPArotation? ?psych? + "tbart", # ?GISTools? + "VIM") # ?vcd? + +bad4rcpp <- c("cda", # Exporter.h + "growcurves", # sugar + "planar", # Exporter.h + "RcppCNPy") # Exporter.h + +## these fail initially but can all be run with some extra effort +bad4notrcpp <- c("ExactNumCI", # needs BOOSTLIB defined, bad src/ file + "KernSmoothIRT", # rgl failed, needs full x11 session + "NetworkAnalysis") # igraph interaction? + +good <- length(goodPkg) +bad <- length(bad4missing) + length(bad4rcpp) + length(bad4notrcpp) + +cat("Good ", good, "\n") +cat("Bad ", bad, "\n") +cat(" RcppErr ", length(bad4rcpp), "\n") +cat(" MissDep ", length(bad4missing), "\n") +cat(" NotRcpp ", length(bad4notrcpp), "\n") +cat("Total ", good + bad, "\n") +cat("Error Pct ", length(bad4rcpp) / (good + bad), "\n") Added: testlogs/Rcpp-check-20130319-2138.txt =================================================================== --- testlogs/Rcpp-check-20130319-2138.txt (rev 0) +++ testlogs/Rcpp-check-20130319-2138.txt 2013-09-22 03:13:45 UTC (rev 4530) @@ -0,0 +1,264 @@ +Started at 2013-03-19 21:37:47 + [1] "acer" "ALKr" "Amelia" + [4] "apcluster" "auteur" "bcp" + [7] "bfa" "bfp" "bifactorial" + [10] "blockcluster" "ccaPP" "cda" + [13] "classify" "clusteval" "ConConPiWiFun" + [16] "ecp" "EpiContactTrace" "ExactNumCI" + [19] "fastGHQuad" "fdaMixed" "forecast" + [22] "fugeR" "GeneticTools" "gMWT" + [25] "gof" "gRbase" "gRim" + [28] "growcurves" "GUTS" "HLMdiag" + [31] "httpuv" "jaatha" "KernSmoothIRT" + [34] "Kmisc" "Kmisc" "LaF" + [37] "marked" "maxent" "mets" + [40] "minqa" "mirt" "mRMRe" + [43] "multmod" "mvabund" "MVB" + [46] "NetworkAnalysis" "ngspatial" "oem" + [49] "openair" "orQA" "parser" + [52] "phom" "phylobase" "planar" + [55] "PReMiuM" "psgp" "quadrupen" + [58] "Rchemcpp" "Rclusterpp" "RcppArmadillo" + [61] "RcppBDT" "rcppbugs" "RcppClassic" + [64] "RcppClassicExamples" "RcppCNPy" "RcppDE" + [67] "RcppEigen" "RcppExamples" "RcppGSL" + [70] "RcppOctave" "RcppRoll" "RcppSMC" + [73] "RcppXts" "rexpokit" "rforensicbatwing" + [76] "rgam" "RInside" "Rmalschains" + [79] "RMessenger" "Rmixmod" "robustgam" + [82] "robustHD" "rococo" "RProtoBuf" + [85] "RQuantLib" "RSNNS" "RSofia" + [88] "rugarch" "RVowpalWabbit" "SBSA" + [91] "sdcMicro" "sdcTable" "simFrame" + [94] "spacodiR" "sparseHessianFD" "sparseLTSEigen" + [97] "SpatialTools" "stochvol" "stream" +[100] "surveillance" "survSNP" "termstrc" +[103] "tmg" "transmission" "trustOptim" +[106] "unmarked" "VIM" "waffect" +[109] "WideLM" "wordcloud" "zic" +0 : acer_0.1.2.tar.gz +0 : ALKr_0.5.tar.gz +0 : Amelia_1.7.tar.gz +0 : apcluster_1.3.0.tar.gz +1 : auteur_0.12.1010.tar.gz +0 : bcp_3.0.1.tar.gz +0 : bfa_0.2.3.tar.gz +0 : bfp_0.0-25.tar.gz +0 : bifactorial_1.4.7.tar.gz +0 : blockcluster_2.0.1.tar.gz +0 : ccaPP_0.2.0.tar.gz +0 : cda_1.3.tar.gz +1 : classify_1.1.tar.gz +0 : clusteval_0.1.tar.gz +0 : ConConPiWiFun_0.3.tar.gz +0 : ecp_1.5.2.tar.gz +1 : EpiContactTrace_0.7.1.tar.gz +1 : ExactNumCI_1.0.0.tar.gz +0 : fastGHQuad_0.1-1.tar.gz +0 : fdaMixed_0.1.tar.gz +0 : forecast_4.03.tar.gz +1 : fugeR_0.1.2.tar.gz +1 : GeneticTools_0.2.tar.gz +1 : gMWT_0.2.1.tar.gz +0 : gof_0.8-2.tar.gz +1 : gRbase_1.6-8.tar.gz +1 : gRim_0.1-15.tar.gz +0 : growcurves_0.2.3.4.tar.gz +0 : GUTS_0.2.8.tar.gz +1 : HLMdiag_0.2.0.tar.gz +1 : httpuv_1.0.5.tar.gz +1 : jaatha_2.0.2.tar.gz +0 : KernSmoothIRT_5.0.tar.gz +0 : Kmisc_0.4.0.tar.gz Kmisc_0.4.0-1.tar.gz +0 : Kmisc_0.4.0.tar.gz Kmisc_0.4.0-1.tar.gz +0 : LaF_0.4.tar.gz +1 : marked_1.0.9.tar.gz +1 : maxent_1.3.2.tar.gz +1 : mets_0.1-13.tar.gz +0 : minqa_1.2.1.tar.gz +1 : mirt_0.6.0.tar.gz +0 : mRMRe_1.0.2.tar.gz +0 : multmod_0.9.tar.gz +0 : mvabund_3.6.11.tar.gz +0 : MVB_1.1.tar.gz +0 : NetworkAnalysis_0.3-1.tar.gz +1 : ngspatial_0.5-2.tar.gz +0 : oem_1.02.tar.gz +0 : openair_0.8-1.tar.gz +1 : orQA_0.2.1.tar.gz +0 : parser_0.1.tar.gz +0 : phom_1.0.1.tar.gz +0 : phylobase_0.6.5.tar.gz +0 : planar_1.2.4.tar.gz +1 : PReMiuM_3.0.16.tar.gz +0 : psgp_0.3-2.tar.gz +0 : quadrupen_0.2-1.tar.gz +0 : Rchemcpp_1.1.1.tar.gz +0 : Rclusterpp_0.2.1.tar.gz +0 : RcppArmadillo_0.3.800.1.tar.gz +0 : RcppBDT_0.2.1.tar.gz +0 : rcppbugs_0.1.1.tar.gz +0 : RcppClassic_0.9.3.tar.gz +0 : RcppClassicExamples_0.1.1.tar.gz +0 : RcppCNPy_0.2.0.tar.gz +0 : RcppDE_0.1.1.tar.gz +0 : RcppEigen_0.3.1.2.1.tar.gz +0 : RcppExamples_0.1.6.tar.gz +0 : RcppGSL_0.2.0.tar.gz +0 : RcppOctave_0.9.tar.gz +0 : RcppRoll_0.1.0.tar.gz +0 : RcppSMC_0.1.1.tar.gz +0 : RcppXts_0.0.4.tar.gz +0 : rexpokit_0.24.tar.gz +0 : rforensicbatwing_1.1.tar.gz +0 : rgam_0.6.1.tar.gz +0 : RInside_0.2.10.tar.gz +0 : Rmalschains_0.1-2.tar.gz +0 : RMessenger_0.1.1.tar.gz +0 : Rmixmod_1.1.3.tar.gz +0 : robustgam_0.1.5.tar.gz +1 : robustHD_0.3.0.tar.gz +0 : rococo_1.1.0.tar.gz +0 : RProtoBuf_0.2.6.tar.gz +0 : RQuantLib_0.3.10.tar.gz +0 : RSNNS_0.4-3.tar.gz +0 : RSofia_1.1.tar.gz +0 : rugarch_1.0-16.tar.gz +0 : RVowpalWabbit_0.0.5.tar.gz +0 : SBSA_0.2.0.tar.gz +0 : sdcMicro_3.1.2.tar.gz +1 : sdcTable_0.10.2.tar.gz +0 : simFrame_0.5.0.tar.gz +1 : spacodiR_0.13.0115.tar.gz +0 : sparseHessianFD_0.1.0.tar.gz +1 : sparseLTSEigen_0.1.2.tar.gz +0 : SpatialTools_0.4.3.tar.gz +0 : stochvol_0.5-1.tar.gz +1 : stream_0.1-0.tar.gz +1 : surveillance_1.5-2.tar.gz +0 : survSNP_0.21-5.tar.gz +0 : termstrc_1.3.5.tar.gz +0 : tmg_0.1.tar.gz +0 : transmission_0.1.tar.gz +0 : transnet_0.1.tar.gz +0 : trustOptim_0.8.0.tar.gz +0 : unmarked_0.9-9.tar.gz +1 : VIM_3.0.3.tar.gz +0 : waffect_1.2.tar.gz +1 : WideLM_0.1-1.tar.gz +0 : wordcloud_2.2.tar.gz +0 : zic_0.7.5.tar.gz + pkg res +1 acer 0 +2 ALKr 0 +3 Amelia 0 +4 apcluster 0 +5 auteur 1 +6 bcp 0 +7 bfa 0 +8 bfp 0 +9 bifactorial 0 +10 blockcluster 0 +11 ccaPP 0 +12 cda 0 +13 classify 1 +14 clusteval 0 +15 ConConPiWiFun 0 +16 ecp 0 +17 EpiContactTrace 1 +18 ExactNumCI 1 +19 fastGHQuad 0 +20 fdaMixed 0 +21 forecast 0 +22 fugeR 1 +23 GeneticTools 1 +24 gMWT 1 +25 gof 0 +26 gRbase 1 +27 gRim 1 +28 growcurves 0 +29 GUTS 0 +30 HLMdiag 1 +31 httpuv 1 +32 jaatha 1 +33 KernSmoothIRT 0 +34 Kmisc 0 +35 Kmisc 0 +36 LaF 0 +37 marked 1 +38 maxent 1 +39 mets 1 +40 minqa 0 +41 mirt 1 +42 mRMRe 0 +43 multmod 0 +44 mvabund 0 +45 MVB 0 +46 NetworkAnalysis 0 +47 ngspatial 1 +48 oem 0 +49 openair 0 +50 orQA 1 +51 parser 0 +52 phom 0 +53 phylobase 0 +54 planar 0 +55 PReMiuM 1 +56 psgp 0 +57 quadrupen 0 +58 Rchemcpp 0 +59 Rclusterpp 0 +60 RcppArmadillo 0 +61 RcppBDT 0 +62 rcppbugs 0 +63 RcppClassic 0 +64 RcppClassicExamples 0 +65 RcppCNPy 0 +66 RcppDE 0 +67 RcppEigen 0 +68 RcppExamples 0 +69 RcppGSL 0 +70 RcppOctave 0 +71 RcppRoll 0 +72 RcppSMC 0 +73 RcppXts 0 +74 rexpokit 0 +75 rforensicbatwing 0 +76 rgam 0 +77 RInside 0 +78 Rmalschains 0 +79 RMessenger 0 +80 Rmixmod 0 +81 robustgam 0 +82 robustHD 1 +83 rococo 0 +84 RProtoBuf 0 +85 RQuantLib 0 +86 RSNNS 0 +87 RSofia 0 +88 rugarch 0 +89 RVowpalWabbit 0 +90 SBSA 0 +91 sdcMicro 0 +92 sdcTable 1 +93 simFrame 0 +94 spacodiR 1 +95 sparseHessianFD 0 +96 sparseLTSEigen 1 +97 SpatialTools 0 +98 stochvol 0 +99 stream 1 +100 surveillance 1 +101 survSNP 0 +102 termstrc 0 +103 tmg 0 +104 transmission 0 +105 transnet 0 +106 trustOptim 0 +107 unmarked 0 +108 VIM 1 +109 waffect 0 +110 WideLM 1 +111 wordcloud 0 +112 zic 0 +Ended at 2013-03-19 23:35:19 Added: testlogs/Rcpp-check-20130921-1222.txt =================================================================== --- testlogs/Rcpp-check-20130921-1222.txt (rev 0) +++ testlogs/Rcpp-check-20130921-1222.txt 2013-09-22 03:13:45 UTC (rev 4530) @@ -0,0 +1,323 @@ +Started at 2013-09-21 12:22:52 + [1] "accelerometry" "acer" "AdaptiveSparsity" + [4] "ALDqr" "ALKr" "Amelia" + [7] "apcluster" "BayesComm" "bcp" + [10] "bfa" "bfp" "bifactorial" + [13] "BioGeoBEARS" "blockcluster" "ccaPP" + [16] "cda" "CDM" "classify" + [19] "climdex.pcic" "clogitL1" "clusteval" + [22] "ConConPiWiFun" "coneproj" "Delaporte" + [25] "diversitree" "ecp" "EpiContactTrace" + [28] "ExactNumCI" "fastGHQuad" "FastPCS" + [31] "FastRCS" "FBFsearch" "fdaMixed" + [34] "forecast" "fugeR" "Funclustering" + [37] "geiger" "GeneticTools" "gMWT" + [40] "GOsummaries" "gRbase" "gRim" + [43] "growcurves" "GSE" "GUTS" + [46] "HLMdiag" "httpuv" "inarmix" + [49] "jaatha" "KernSmoothIRT" "Kmisc" + [52] "LaF" "lme4" "marked" + [55] "maxent" "mets" "minqa" + [58] "mirt" "miscF" "MPTinR" + [61] "msgl" "multmod" "mvabund" + [64] "MVB" "NetSim" "NetworkAnalysis" + [67] "ngspatial" "oem" "openair" + [70] "orQA" "phom" "phylobase" + [73] "planar" "PReMiuM" "prospectr" + [76] "psgp" "quadrupen" "Rankcluster" + [79] "RcppArmadillo" "RcppBDT" "rcppbugs" + [82] "RcppClassic" "RcppClassicExamples" "RcppCNPy" + [85] "RcppDE" "RcppEigen" "RcppExamples" + [88] "RcppGSL" "RcppOctave" "RcppProgress" + [91] "RcppRoll" "RcppSMC" "RcppXts" + [94] "rexpokit" "rforensicbatwing" "rgam" + [97] "RInside" "Rmalschains" "RMessenger" +[100] "rmgarch" "Rmixmod" "robustgam" +[103] "robustHD" "rococo" "rotations" +[106] "RProtoBuf" "RQuantLib" "RSNNS" +[109] "RSofia" "rugarch" "RVowpalWabbit" +[112] "SBSA" "sdcMicro" "sdcTable" +[115] "sequences" "simFrame" "sirt" +[118] "spacodiR" "sparseHessianFD" "sparseLTSEigen" +[121] "SpatialTools" "stochvol" "surveillance" +[124] "survSNP" "tagcloud" "TAM" +[127] "tbart" "termstrc" "tmg" +[130] "transmission" "trustOptim" "unmarked" +[133] "VIM" "waffect" "WideLM" +[136] "wordcloud" "zic" +0 : accelerometry_2.0.tar.gz +0 : acer_0.1.2.tar.gz +0 : AdaptiveSparsity_1.2.tar.gz +1 : ALDqr_0.2.tar.gz +0 : ALKr_0.5.3.tar.gz +0 : Amelia_1.7.2.tar.gz +0 : apcluster_1.3.2.tar.gz +0 : BayesComm_0.1-0.tar.gz +0 : bcp_3.0.1.tar.gz +0 : bfa_0.3.tar.gz +0 : bfp_0.0-25.tar.gz +0 : bifactorial_1.4.7.tar.gz +1 : BioGeoBEARS_0.2.1.tar.gz +0 : blockcluster_3.0.tar.gz +0 : ccaPP_0.2.0.tar.gz +1 : cda_1.3.3.tar.gz +1 : CDM_2.3-15.tar.gz +1 : classify_1.1.tar.gz +1 : climdex.pcic_0.7-2.tar.gz +0 : clogitL1_1.0.tar.gz +0 : clusteval_0.1.tar.gz +0 : ConConPiWiFun_0.4.1.tar.gz +0 : coneproj_1.1.tar.gz +0 : Delaporte_1.0-1.tar.gz +1 : diversitree_0.9-6.tar.gz +0 : ecp_1.5.4.tar.gz +0 : EpiContactTrace_0.8.6.tar.gz +1 : ExactNumCI_1.0.0.tar.gz +0 : fastGHQuad_0.1-1.tar.gz +0 : FastPCS_0.0.6.tar.gz +0 : FastRCS_0.0.1.tar.gz +0 : FBFsearch_1.0.tar.gz +0 : fdaMixed_0.2.tar.gz +0 : forecast_4.06.tar.gz +1 : fugeR_0.1.2.tar.gz +1 : Funclustering_1.0.tar.gz +1 : geiger_1.99-3.tar.gz +1 : GeneticTools_0.2.tar.gz +1 : gMWT_0.2.1.tar.gz +1 : GOsummaries_1.0.tar.gz +0 : gRbase_1.6-12.tar.gz +0 : gRim_0.1-17.tar.gz +1 : growcurves_0.2.3.5.tar.gz +0 : GSE_3.0.tar.gz +0 : GUTS_0.2.8.tar.gz +1 : HLMdiag_0.2.2.tar.gz +0 : httpuv_1.1.0.tar.gz +0 : inarmix_0.2.tar.gz +0 : jaatha_2.1.tar.gz +1 : KernSmoothIRT_6.0.tar.gz +0 : Kmisc_0.4.0-1.tar.gz +1 : LaF_0.5.tar.gz +1 : lme4_1.0-4.tar.gz +1 : marked_1.1.2.tar.gz +0 : maxent_1.3.3.tar.gz +1 : mets_0.2.4.tar.gz +0 : minqa_1.2.1.tar.gz +1 : mirt_0.9.0.tar.gz +1 : miscF_0.1-2.tar.gz +0 : MPTinR_1.1.8.tar.gz +0 : msgl_0.1.4.tar.gz +0 : multmod_1.0.tar.gz +0 : mvabund_3.7.0.tar.gz +0 : MVB_1.1.tar.gz +0 : NetSim_0.9.tar.gz +1 : NetworkAnalysis_0.3-1.tar.gz +1 : ngspatial_1.0-1.tar.gz +0 : oem_1.02.tar.gz +1 : openair_0.8-5.tar.gz +1 : orQA_0.2.1.tar.gz +0 : phom_1.0.2.tar.gz +0 : phylobase_0.6.5.2.tar.gz +1 : planar_1.2.4.tar.gz +1 : PReMiuM_3.0.20.tar.gz +0 : prospectr_0.1.tar.gz +0 : psgp_0.3-3.tar.gz +1 : quadrupen_0.2-2.tar.gz +0 : Rankcluster_0.90.3.tar.gz +0 : RcppArmadillo_0.3.910.0.tar.gz +0 : RcppBDT_0.2.1.tar.gz +0 : rcppbugs_0.1.4.tar.gz +0 : RcppClassic_0.9.4.tar.gz +0 : RcppClassicExamples_0.1.1.tar.gz +1 : RcppCNPy_0.2.0.tar.gz +0 : RcppDE_0.1.1.tar.gz +0 : RcppEigen_0.3.1.2.1.tar.gz +0 : RcppExamples_0.1.6.tar.gz +0 : RcppGSL_0.2.0.tar.gz +0 : RcppOctave_0.9.5.tar.gz +0 : RcppProgress_0.1.tar.gz +0 : RcppRoll_0.1.0.tar.gz +0 : RcppSMC_0.1.1.tar.gz +0 : RcppXts_0.0.4.tar.gz +0 : rexpokit_0.24.1.tar.gz +0 : rforensicbatwing_1.1.tar.gz +0 : rgam_0.6.1.tar.gz +0 : RInside_0.2.10.tar.gz +0 : Rmalschains_0.2-1.tar.gz +0 : RMessenger_0.1.3.tar.gz +0 : rmgarch_1.2-0.tar.gz +0 : Rmixmod_1.1.3.tar.gz +0 : robustgam_0.1.7.tar.gz +0 : robustHD_0.3.2.tar.gz +0 : rococo_1.1.0.tar.gz +0 : rotations_0.1.tar.gz +0 : RProtoBuf_0.3.1.tar.gz +0 : RQuantLib_0.3.10.tar.gz +0 : RSNNS_0.4-3.tar.gz +0 : RSofia_1.1.tar.gz +0 : rugarch_1.2-7.tar.gz +0 : RVowpalWabbit_0.0.5.tar.gz +0 : SBSA_0.2.0.tar.gz +0 : sdcMicro_4.0.3.tar.gz +1 : sdcTable_0.10.2.tar.gz +0 : sequences_0.5.7.tar.gz +0 : simFrame_0.5.0.tar.gz +1 : sirt_0.36-30.tar.gz +1 : spacodiR_0.13.0115.tar.gz +0 : sparseHessianFD_0.1.0.tar.gz +0 : sparseLTSEigen_0.1.3.tar.gz +0 : SpatialTools_0.5.4.tar.gz +0 : stochvol_0.6-1.tar.gz +1 : surveillance_1.6-0.tar.gz +0 : survSNP_0.21-5.tar.gz +0 : tagcloud_0.1.tar.gz +1 : TAM_0.7-35.tar.gz +1 : tbart_0.9.tar.gz +0 : termstrc_1.3.5.tar.gz +0 : tmg_0.1.tar.gz +0 : transmission_0.1.tar.gz +0 : trustOptim_0.8.1.tar.gz +0 : unmarked_0.10-2.tar.gz +1 : VIM_3.0.3.1.tar.gz +0 : waffect_1.2.tar.gz +0 : WideLM_0.1-1.tar.gz +0 : wordcloud_2.4.tar.gz +0 : zic_0.7.5.tar.gz + pkg res +1 accelerometry 0 +2 acer 0 +3 AdaptiveSparsity 0 +4 ALDqr 1 +5 ALKr 0 +6 Amelia 0 +7 apcluster 0 +8 BayesComm 0 +9 bcp 0 +10 bfa 0 +11 bfp 0 +12 bifactorial 0 +13 BioGeoBEARS 1 +14 blockcluster 0 +15 ccaPP 0 +16 cda 1 +17 CDM 1 +18 classify 1 +19 climdex.pcic 1 +20 clogitL1 0 +21 clusteval 0 +22 ConConPiWiFun 0 +23 coneproj 0 +24 Delaporte 0 +25 diversitree 1 +26 ecp 0 +27 EpiContactTrace 0 +28 ExactNumCI 1 +29 fastGHQuad 0 +30 FastPCS 0 +31 FastRCS 0 +32 FBFsearch 0 +33 fdaMixed 0 +34 forecast 0 +35 fugeR 1 +36 Funclustering 1 +37 geiger 1 +38 GeneticTools 1 +39 gMWT 1 +40 GOsummaries 1 +41 gRbase 0 +42 gRim 0 +43 growcurves 1 +44 GSE 0 +45 GUTS 0 +46 HLMdiag 1 +47 httpuv 0 +48 inarmix 0 +49 jaatha 0 +50 KernSmoothIRT 1 +51 Kmisc 0 +52 LaF 1 +53 lme4 1 +54 marked 1 +55 maxent 0 +56 mets 1 +57 minqa 0 +58 mirt 1 +59 miscF 1 +60 MPTinR 0 +61 msgl 0 +62 multmod 0 +63 mvabund 0 +64 MVB 0 +65 NetSim 0 +66 NetworkAnalysis 1 +67 ngspatial 1 +68 oem 0 +69 openair 1 +70 orQA 1 +71 phom 0 +72 phylobase 0 +73 planar 1 +74 PReMiuM 1 +75 prospectr 0 +76 psgp 0 +77 quadrupen 1 +78 Rankcluster 0 +79 RcppArmadillo 0 +80 RcppBDT 0 +81 rcppbugs 0 +82 RcppClassic 0 +83 RcppClassicExamples 0 +84 RcppCNPy 1 +85 RcppDE 0 +86 RcppEigen 0 +87 RcppExamples 0 +88 RcppGSL 0 +89 RcppOctave 0 +90 RcppProgress 0 +91 RcppRoll 0 +92 RcppSMC 0 +93 RcppXts 0 +94 rexpokit 0 +95 rforensicbatwing 0 +96 rgam 0 +97 RInside 0 +98 Rmalschains 0 +99 RMessenger 0 +100 rmgarch 0 +101 Rmixmod 0 +102 robustgam 0 +103 robustHD 0 +104 rococo 0 +105 rotations 0 +106 RProtoBuf 0 +107 RQuantLib 0 +108 RSNNS 0 +109 RSofia 0 +110 rugarch 0 +111 RVowpalWabbit 0 +112 SBSA 0 +113 sdcMicro 0 +114 sdcTable 1 +115 sequences 0 +116 simFrame 0 +117 sirt 1 +118 spacodiR 1 +119 sparseHessianFD 0 +120 sparseLTSEigen 0 +121 SpatialTools 0 +122 stochvol 0 +123 surveillance 1 +124 survSNP 0 +125 tagcloud 0 +126 TAM 1 +127 tbart 1 +128 termstrc 0 +129 tmg 0 +130 transmission 0 +131 trustOptim 0 +132 unmarked 0 +133 VIM 1 +134 waffect 0 +135 WideLM 0 +136 wordcloud 0 +137 zic 0 +Ended at 2013-09-21 17:31:23 Added: testlogs/result-20130319-233519.RData =================================================================== (Binary files differ) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4530 From noreply at r-forge.r-project.org Sun Sep 22 19:42:43 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 22 Sep 2013 19:42:43 +0200 (CEST) Subject: [Rcpp-commits] r4531 - pkg/Rcpp/inst/include/Rcpp/vector Message-ID: <20130922174243.9F29A184F46@r-forge.r-project.org> Author: edd Date: 2013-09-22 19:42:42 +0200 (Sun, 22 Sep 2013) New Revision: 4531 Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h Log: correct a debug message, and one whitespace indent Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2013-09-22 03:13:45 UTC (rev 4530) +++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2013-09-22 17:42:42 UTC (rev 4531) @@ -88,11 +88,11 @@ update_vector(); } Vector( const char* st ) : RObject( internal::vector_from_string(st) ){ - RCPP_DEBUG_2( "Vector<%d>( const std::string& = %s )", RTYPE, st.c_str() ) + RCPP_DEBUG_2( "Vector<%d>( const char* = %s )", RTYPE, st.c_str() ) update_vector(); } - Vector( const int& siz, stored_type (*gen)(void) ) : RObject(Rf_allocVector( RTYPE, siz)) { + Vector( const int& siz, stored_type (*gen)(void) ) : RObject(Rf_allocVector( RTYPE, siz)) { RCPP_DEBUG_2( "Vector<%d>( const int& siz = %s, stored_type (*gen)(void) )", RTYPE, siz ) update_vector() ; iterator first = begin(), last = end() ; From noreply at r-forge.r-project.org Mon Sep 23 04:43:40 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 23 Sep 2013 04:43:40 +0200 (CEST) Subject: [Rcpp-commits] r4532 - in pkg/Rcpp: . inst/include/Rcpp/sugar/functions Message-ID: <20130923024340.923EE1858E5@r-forge.r-project.org> Author: edd Date: 2013-09-23 04:43:39 +0200 (Mon, 23 Sep 2013) New Revision: 4532 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h Log: correction to sugar function diff() as unearthed by package growcurves Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-22 17:42:42 UTC (rev 4531) +++ pkg/Rcpp/ChangeLog 2013-09-23 02:43:39 UTC (rev 4532) @@ -1,3 +1,8 @@ +2013-09-22 Dirk Eddelbuettel + + * inst/include/Rcpp/sugar/functions/diff.h: Declare set_previous + const and add a missing traits:: prefix before is_na + 2013-09-21 Dirk Eddelbuettel * vignettes/Rcpp-modules.Rnw: Remove vignette-local compilations Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h 2013-09-22 17:42:42 UTC (rev 4531) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/diff.h 2013-09-23 02:43:39 UTC (rev 4532) @@ -56,9 +56,9 @@ return res ; } - inline void set_previous(int i, STORAGE value){ + inline void set_previous(int i, STORAGE value) const { previous = value ; - was_na = is_na(previous) ; + was_na = traits::is_na(previous) ; previous_index = i ; } From noreply at r-forge.r-project.org Mon Sep 23 04:53:46 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 23 Sep 2013 04:53:46 +0200 (CEST) Subject: [Rcpp-commits] r4533 - in pkg/Rcpp: . inst/unitTests inst/unitTests/cpp Message-ID: <20130923025346.E827C18577E@r-forge.r-project.org> Author: edd Date: 2013-09-23 04:53:46 +0200 (Mon, 23 Sep 2013) New Revision: 4533 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/unitTests/cpp/sugar.cpp pkg/Rcpp/inst/unitTests/runit.sugar.R Log: new int vector test for sugar diff() function Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-23 02:43:39 UTC (rev 4532) +++ pkg/Rcpp/ChangeLog 2013-09-23 02:53:46 UTC (rev 4533) @@ -3,6 +3,9 @@ * inst/include/Rcpp/sugar/functions/diff.h: Declare set_previous const and add a missing traits:: prefix before is_na + * inst/unitTests/cpp/sugar.cpp: Unit test for diff() of int. vector + * inst/unitTests/runit.sugar.R: Invoke new test + 2013-09-21 Dirk Eddelbuettel * vignettes/Rcpp-modules.Rnw: Remove vignette-local compilations Modified: pkg/Rcpp/inst/unitTests/cpp/sugar.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/sugar.cpp 2013-09-23 02:43:39 UTC (rev 4532) +++ pkg/Rcpp/inst/unitTests/cpp/sugar.cpp 2013-09-23 02:53:46 UTC (rev 4533) @@ -145,6 +145,12 @@ } // [[Rcpp::export]] +IntegerVector runit_diff_int(IntegerVector xx) { + IntegerVector res = diff(xx); + return res; +} + +// [[Rcpp::export]] NumericVector runit_diff_ifelse( LogicalVector pred, NumericVector xx, NumericVector yy){ NumericVector res = ifelse( pred, diff(xx), diff(yy) ); return res ; Modified: pkg/Rcpp/inst/unitTests/runit.sugar.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.sugar.R 2013-09-23 02:43:39 UTC (rev 4532) +++ pkg/Rcpp/inst/unitTests/runit.sugar.R 2013-09-23 02:53:46 UTC (rev 4533) @@ -22,7 +22,7 @@ if (.runThisTest) { -.setUp <- Rcpp:::unit_test_setup( "sugar.cpp" ) +.setUp <- Rcpp:::unit_test_setup( "sugar.cpp" ) test.sugar.abs <- function( ){ x <- rnorm(10) @@ -211,8 +211,10 @@ } test.sugar.diff <- function( ){ + x <- as.integer(round(rnorm(100,1,100))) + checkEquals( runit_diff_int(x) , diff(x) ) x <- rnorm( 100 ) - checkEquals( runit_diff(x) , diff(x) ) + checkEquals( runit_diff(x) , diff(x) ) y <- rnorm(100) pred <- sample( c(T,F), 99, replace = TRUE ) checkEquals( runit_diff_ifelse(pred, x, y ), ifelse( pred, diff(x), diff(y) ) ) @@ -266,26 +268,26 @@ } test.sugar.isfinite <- function( ){ - checkEquals( - runit_isfinite( c(1, NA, Inf, -Inf, NaN) ) , - c(TRUE, FALSE, FALSE, FALSE, FALSE), + checkEquals( + runit_isfinite( c(1, NA, Inf, -Inf, NaN) ) , + c(TRUE, FALSE, FALSE, FALSE, FALSE), msg = "is_finite" ) } test.sugar.isinfinite <- function( ){ - checkEquals( - runit_isinfinite( c(1, NA, Inf, -Inf, NaN) ) , - c(FALSE, FALSE, TRUE, TRUE, FALSE), + checkEquals( + runit_isinfinite( c(1, NA, Inf, -Inf, NaN) ) , + c(FALSE, FALSE, TRUE, TRUE, FALSE), msg = "is_infinite" ) } test.sugar.isnan <- function( ){ - checkEquals( - runit_isnan( c(1, NA, Inf, -Inf, NaN) ) , - c(FALSE, FALSE, FALSE, FALSE, TRUE), + checkEquals( + runit_isnan( c(1, NA, Inf, -Inf, NaN) ) , + c(FALSE, FALSE, FALSE, FALSE, TRUE), msg = "is_nan" ) } @@ -722,8 +724,8 @@ test.clamp <- function(){ r_clamp <- function(a, x, b) pmax(a, pmin(x, b) ) - checkEquals( - runit_clamp( -1, seq(-3,3, length=100), 1 ), + checkEquals( + runit_clamp( -1, seq(-3,3, length=100), 1 ), r_clamp( -1, seq(-3,3, length=100), 1 ) ) } From noreply at r-forge.r-project.org Tue Sep 24 05:48:47 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 24 Sep 2013 05:48:47 +0200 (CEST) Subject: [Rcpp-commits] r4534 - in pkg/RcppArmadillo: . inst/include inst/include/armadillo_bits Message-ID: <20130924034847.6C79D1858FE@r-forge.r-project.org> Author: edd Date: 2013-09-24 05:48:46 +0200 (Tue, 24 Sep 2013) New Revision: 4534 Added: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft2.hpp Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/include/armadillo pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_config.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/debug.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_elem.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_herk.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_resize_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/span.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp Log: Upgraded to Armadillo pre-release of 3.920.0 to test sparse matrix ctor Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/ChangeLog 2013-09-24 03:48:46 UTC (rev 4534) @@ -1,3 +1,8 @@ +2013-09-23 Dirk Eddelbuettel + + * inst/include/*: Upgraded to Armadillo pre-release of 3.920.0 + * DESCRIPTION: Mark as test release version 0.3.910.0.2 + 2013-09-15 Dirk Eddelbuettel * inst/include/RcppArmadilloAs.h: Also define ConstInputParameter Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/DESCRIPTION 2013-09-24 03:48:46 UTC (rev 4534) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.910.0.1 +Version: 0.3.910.0.2 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel Modified: pkg/RcppArmadillo/inst/include/armadillo =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo 2013-09-24 03:48:46 UTC (rev 4534) @@ -422,6 +422,7 @@ #include "armadillo_bits/fn_histc.hpp" #include "armadillo_bits/fn_unique.hpp" #include "armadillo_bits/fn_fft.hpp" + #include "armadillo_bits/fn_fft2.hpp" #include "armadillo_bits/fn_any.hpp" #include "armadillo_bits/fn_all.hpp" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -27,6 +27,9 @@ inline explicit Col(const uword n_elem); inline Col(const uword in_rows, const uword in_cols); + template inline Col(const uword n_elem, const arma::fill::fill_class& f); + template inline Col(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + inline Col(const char* text); inline const Col& operator=(const char* text); @@ -39,12 +42,16 @@ #if defined(ARMA_USE_CXX11) inline Col(const std::initializer_list& list); inline const Col& operator=(const std::initializer_list& list); + + inline Col(Col&& m); + inline const Col& operator=(Col&& m); #endif inline explicit Col(const SpCol& X); inline const Col& operator=(const eT val); - + inline const Col& operator=(const Col& m); + template inline Col(const Base& X); template inline const Col& operator=(const Base& X); @@ -66,9 +73,11 @@ arma_inline const Op,op_htrans> ht() const; arma_inline const Op,op_strans> st() const; - arma_inline eT& row(const uword row_num); + arma_inline eT& row(const uword row_num); // TODO: inconsistent; should return a subview_row; change API for 4.0 ? arma_inline eT row(const uword row_num) const; + using Mat::rows; + arma_inline subview_col rows(const uword in_row1, const uword in_row2); arma_inline const subview_col rows(const uword in_row1, const uword in_row2) const; @@ -156,6 +165,8 @@ arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); + // TODO: constructor with fill_type + template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); @@ -178,6 +189,8 @@ inline const Col& operator=(const std::initializer_list& list); #endif + arma_inline const Col& operator=(const fixed& X); + arma_inline const Op< Col_fixed_type, op_htrans > t() const; arma_inline const Op< Col_fixed_type, op_htrans > ht() const; arma_inline const Op< Col_fixed_type, op_strans > st() const; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -56,6 +56,34 @@ +template +template +inline +Col::Col(const uword in_n_elem, const arma::fill::fill_class& f) + : Mat(arma_vec_indicator(), in_n_elem, 1, 1) + { + arma_extra_debug_sigprint(); + + (*this).fill(f); + } + + + +template +template +inline +Col::Col(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) + : Mat(arma_vec_indicator(), 0, 0, 1) + { + arma_extra_debug_sigprint(); + + Mat::init_warm(in_n_rows, in_n_cols); + + (*this).fill(f); + } + + + //! construct a column vector from specified text template inline @@ -207,6 +235,32 @@ return *this; } + + + template + inline + Col::Col(Col&& X) + : Mat(arma_vec_indicator(), 1) + { + arma_extra_debug_sigprint(); + + (*this).steal_mem(X); + } + + + + template + inline + const Col& + Col::operator=(Col&& X) + { + arma_extra_debug_sigprint(); + + (*this).steal_mem(X); + + return *this; + } + #endif @@ -221,7 +275,9 @@ arrayops::inplace_set(Mat::memptr(), eT(0), X.n_elem); for(typename SpCol::const_iterator it = X.begin(); it != X.end(); ++it) + { at(it.row()) = (*it); + } } @@ -241,6 +297,20 @@ template +inline +const Col& +Col::operator=(const Col& X) + { + arma_extra_debug_sigprint(); + + Mat::operator=(X); + + return *this; + } + + + +template template inline Col::Col(const Base& X) @@ -809,9 +879,10 @@ { arma_extra_debug_sigprint_this(this); - eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; - arrayops::copy( dest, X.mem, fixed_n_elem ); + arrayops::copy( dest, src, fixed_n_elem ); } @@ -1026,6 +1097,24 @@ template template arma_inline +const Col& +Col::fixed::operator=(const fixed& X) + { + arma_extra_debug_sigprint(); + + eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; + + arrayops::copy( dest, src, fixed_n_elem ); + + return *this; + } + + + +template +template +arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_htrans > Col::fixed::t() const { Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -57,6 +57,14 @@ inline Cube(const uword in_rows, const uword in_cols, const uword in_slices); + template + inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const arma::fill::fill_class& f); + + #if defined(ARMA_USE_CXX11) + inline Cube(Cube&& m); + inline const Cube& operator=(Cube&& m); + #endif + inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool strict = true); inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices); @@ -98,7 +106,16 @@ inline subview_cube operator()(const span& row_span, const span& col_span, const span& slice_span); inline const subview_cube operator()(const span& row_span, const span& col_span, const span& slice_span) const; + arma_inline subview_cube tube(const uword in_row1, const uword in_col1); + arma_inline const subview_cube tube(const uword in_row1, const uword in_col1) const; + arma_inline subview_cube tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); + arma_inline const subview_cube tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; + + inline subview_cube tube(const span& row_span, const span& col_span); + inline const subview_cube tube(const span& row_span, const span& col_span) const; + + inline void shed_slice(const uword slice_num); inline void shed_slices(const uword in_slice1, const uword in_slice2); @@ -222,6 +239,9 @@ inline const Cube& fill(const eT val); + template + arma_hot inline const Cube& fill(const arma::fill::fill_class& f); + inline const Cube& zeros(); inline const Cube& zeros(const uword in_rows, const uword in_cols, const uword in_slices); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -75,8 +75,69 @@ +//! construct the cube to have user specified dimensions and fill with specified pattern template +template inline +Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma::fill::fill_class& f) + : n_rows(in_n_rows) + , n_cols(in_n_cols) + , n_elem_slice(in_n_rows*in_n_cols) + , n_slices(in_n_slices) + , n_elem(in_n_rows*in_n_cols*in_n_slices) + , mem_state(0) + , mat_ptrs() + , mem() + { + arma_extra_debug_sigprint_this(this); + + init_cold(); + + (*this).fill(f); + } + + + +#if defined(ARMA_USE_CXX11) + + template + inline + Cube::Cube(Cube&& in_cube) + : n_rows(0) + , n_cols(0) + , n_elem_slice(0) + , n_slices(0) + , n_elem(0) + , mem_state(0) + , mat_ptrs() + , mem() + { + arma_extra_debug_sigprint_this(this); + arma_extra_debug_sigprint(arma_boost::format("this = %x in_cube = %x") % this % &in_cube); + + (*this).steal_mem(in_cube); + } + + + + template + inline + const Cube& + Cube::operator=(Cube&& in_cube) + { + arma_extra_debug_sigprint(arma_boost::format("this = %x in_cube = %x") % this % &in_cube); + + (*this).steal_mem(in_cube); + + return *this; + } + +#endif + + + +template +inline void Cube::init_cold() { @@ -970,6 +1031,156 @@ +template +arma_inline +subview_cube +Cube::tube(const uword in_row1, const uword in_col1) + { + arma_extra_debug_sigprint(); + + arma_debug_check + ( + ((in_row1 >= n_rows) || (in_col1 >= n_cols)), + "Cube::tube(): indices out of bounds" + ); + + return subview_cube(*this, in_row1, in_col1, 0, 1, 1, n_slices); + } + + + +template +arma_inline +const subview_cube +Cube::tube(const uword in_row1, const uword in_col1) const + { + arma_extra_debug_sigprint(); + + arma_debug_check + ( + ((in_row1 >= n_rows) || (in_col1 >= n_cols)), + "Cube::tube(): indices out of bounds" + ); + + return subview_cube(*this, in_row1, in_col1, 0, 1, 1, n_slices); + } + + + +template +arma_inline +subview_cube +Cube::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) + { + arma_extra_debug_sigprint(); + + arma_debug_check + ( + (in_row1 > in_row2) || (in_col1 > in_col2) || + (in_row2 >= n_rows) || (in_col2 >= n_cols), + "Cube::tube(): indices out of bounds or incorrectly used" + ); + + const uword subcube_n_rows = in_row2 - in_row1 + 1; + const uword subcube_n_cols = in_col2 - in_col1 + 1; + + return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); + } + + + +template +arma_inline +const subview_cube +Cube::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const + { + arma_extra_debug_sigprint(); + + arma_debug_check + ( + (in_row1 > in_row2) || (in_col1 > in_col2) || + (in_row2 >= n_rows) || (in_col2 >= n_cols), + "Cube::tube(): indices out of bounds or incorrectly used" + ); + + const uword subcube_n_rows = in_row2 - in_row1 + 1; + const uword subcube_n_cols = in_col2 - in_col1 + 1; + + return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); + } + + + +template +inline +subview_cube +Cube::tube(const span& row_span, const span& col_span) + { + arma_extra_debug_sigprint(); + + const bool row_all = row_span.whole; + const bool col_all = col_span.whole; + + const uword local_n_rows = n_rows; + const uword local_n_cols = n_cols; + + const uword in_row1 = row_all ? 0 : row_span.a; + const uword in_row2 = row_span.b; + const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; + + const uword in_col1 = col_all ? 0 : col_span.a; + const uword in_col2 = col_span.b; + const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; + + arma_debug_check + ( + ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) + || + ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) + , + "Cube::tube(): indices out of bounds or incorrectly used" + ); + + return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); + } + + + +template +inline +const subview_cube +Cube::tube(const span& row_span, const span& col_span) const + { + arma_extra_debug_sigprint(); + + const bool row_all = row_span.whole; + const bool col_all = col_span.whole; + + const uword local_n_rows = n_rows; + const uword local_n_cols = n_cols; + + const uword in_row1 = row_all ? 0 : row_span.a; + const uword in_row2 = row_span.b; + const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; + + const uword in_col1 = col_all ? 0 : col_span.a; + const uword in_col2 = col_span.b; + const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; + + arma_debug_check + ( + ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) + || + ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) + , + "Cube::tube(): indices out of bounds or incorrectly used" + ); + + return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); + } + + + //! remove specified slice template inline @@ -2503,13 +2714,36 @@ template +template +arma_hot inline const Cube& +Cube::fill(const arma::fill::fill_class&) + { + arma_extra_debug_sigprint(); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + + if(is_same_type::yes) { arma_debug_check(true, "Cube::fill(): unsupported fill type"); } + + return *this; + } + + + +template +inline +const Cube& Cube::zeros() { arma_extra_debug_sigprint(); - return (*this).fill(eT(0)); + arrayops::fill_zeros(memptr(), n_elem); + + return *this; } @@ -2523,7 +2757,7 @@ set_size(in_rows, in_cols, in_slices); - return (*this).fill(eT(0)); + return (*this).zeros(); } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -49,6 +49,9 @@ inline Mat(const uword in_rows, const uword in_cols); + template + inline Mat(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + inline Mat(const char* text); inline const Mat& operator=(const char* text); @@ -61,6 +64,9 @@ #if defined(ARMA_USE_CXX11) inline Mat(const std::initializer_list& list); inline const Mat& operator=(const std::initializer_list& list); + + inline Mat(Mat&& m); + inline const Mat& operator=(Mat&& m); #endif inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = true); @@ -166,6 +172,9 @@ inline Col unsafe_col(const uword col_num); inline const Col unsafe_col(const uword col_num) const; + // TODO: rows( span ) + // TODO: cols( span ) + // TODO: also need to add the overloads in Col and Row classes arma_inline subview rows(const uword in_row1, const uword in_row2); arma_inline const subview rows(const uword in_row1, const uword in_row2) const; @@ -363,6 +372,9 @@ arma_hot inline const Mat& fill(const eT val); + template + arma_hot inline const Mat& fill(const arma::fill::fill_class& f); + inline const Mat& zeros(); inline const Mat& zeros(const uword in_elem); inline const Mat& zeros(const uword in_rows, const uword in_cols); @@ -566,6 +578,7 @@ arma_inline fixed(); arma_inline fixed(const fixed& X); + template inline fixed(const arma::fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); @@ -582,6 +595,8 @@ inline const Mat& operator=(const std::initializer_list& list); #endif + arma_inline const Mat& operator=(const fixed& X); + arma_inline const Op< Mat_fixed_type, op_htrans > t() const; arma_inline const Op< Mat_fixed_type, op_htrans > ht() const; arma_inline const Op< Mat_fixed_type, op_strans > st() const; @@ -608,6 +623,9 @@ arma_inline arma_warn_unused bool is_vec() const; + template + arma_hot inline const Mat& fill(const arma::fill::fill_class& f); + arma_hot inline const Mat& fill(const eT val); arma_hot inline const Mat& zeros(); arma_hot inline const Mat& ones(); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -69,6 +69,27 @@ +//! construct the matrix to have user specified dimensions and fill with specified pattern +template +template +inline +Mat::Mat(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) + : n_rows(in_n_rows) + , n_cols(in_n_cols) + , n_elem(in_n_rows*in_n_cols) + , vec_state(0) + , mem_state(0) + , mem() + { + arma_extra_debug_sigprint_this(this); + + init_cold(); + + (*this).fill(f); + } + + + //! constructor used by Row and Col classes template inline @@ -509,6 +530,38 @@ return *this; } + + + template + inline + Mat::Mat(Mat&& in_mat) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , vec_state(0) + , mem_state(0) + , mem() + { + arma_extra_debug_sigprint_this(this); + arma_extra_debug_sigprint(arma_boost::format("this = %x in_mat = %x") % this % &in_mat); + + (*this).steal_mem(in_mat); + } + + + + template + inline + const Mat& + Mat::operator=(Mat&& in_mat) + { + arma_extra_debug_sigprint(arma_boost::format("this = %x in_mat = %x") % this % &in_mat); + + (*this).steal_mem(in_mat); + + return *this; + } + #endif @@ -5107,14 +5160,37 @@ +//! fill the matrix with the specified value template +template +arma_hot inline const Mat& +Mat::fill(const arma::fill::fill_class&) + { + arma_extra_debug_sigprint(); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + + return *this; + } + + + +template +inline +const Mat& Mat::zeros() { arma_extra_debug_sigprint(); - return fill(eT(0)); + arrayops::fill_zeros(memptr(), n_elem); + + return *this; } @@ -5128,7 +5204,7 @@ set_size(in_elem); - return fill(eT(0)); + return (*this).zeros(); } @@ -5136,13 +5212,13 @@ template inline const Mat& -Mat::zeros(const uword in_rows, const uword in_cols) +Mat::zeros(const uword in_n_rows, const uword in_n_cols) { arma_extra_debug_sigprint(); - - set_size(in_rows, in_cols); - return fill(eT(0)); + set_size(in_n_rows, in_n_cols); + + return (*this).zeros(); } @@ -5278,7 +5354,7 @@ { arma_extra_debug_sigprint(); - fill(eT(0)); + (*this).zeros(); const uword N = (std::min)(n_rows, n_cols); @@ -6204,15 +6280,30 @@ { arma_extra_debug_sigprint_this(this); - eT* dest = (use_extra) ? mem_local_extra : mem_local; + eT* dest = (use_extra) ? mem_local_extra : mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; - arrayops::copy( dest, X.mem, fixed_n_elem ); + arrayops::copy( dest, src, fixed_n_elem ); } template template +template +inline +Mat::fixed::fixed(const arma::fill::fill_class& f) + : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : mem_local) ) + { + arma_extra_debug_sigprint_this(this); + + (*this).fill(f); + } + + + +template +template template inline Mat::fixed::fixed(const Base& A) @@ -6323,6 +6414,24 @@ template template arma_inline +const Mat& +Mat::fixed::operator=(const fixed& X) + { + arma_extra_debug_sigprint(); + + eT* dest = (use_extra) ? mem_local_extra : mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; + + arrayops::copy( dest, src, fixed_n_elem ); + + return *this; + } + + + +template +template +arma_inline const Op< typename Mat::template fixed::Mat_fixed_type, op_htrans > Mat::fixed::t() const { @@ -6577,9 +6686,30 @@ template template +template arma_hot inline const Mat& +Mat::fixed::fill(const arma::fill::fill_class&) + { + arma_extra_debug_sigprint(); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + + return *this; + } + + + +template +template +arma_hot +inline +const Mat& Mat::fixed::fill(const eT val) { arma_extra_debug_sigprint(); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -27,6 +27,9 @@ inline explicit Row(const uword N); inline Row(const uword in_rows, const uword in_cols); + template inline Row(const uword n_elem, const arma::fill::fill_class& f); + template inline Row(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + inline Row(const char* text); inline const Row& operator=(const char* text); @@ -39,11 +42,15 @@ #if defined(ARMA_USE_CXX11) inline Row(const std::initializer_list& list); inline const Row& operator=(const std::initializer_list& list); + + inline Row(Row&& m); + inline const Row& operator=(Row&& m); #endif inline explicit Row(const SpRow& X); inline const Row& operator=(const eT val); + inline const Row& operator=(const Row& X); template inline Row(const Base& X); template inline const Row& operator=(const Base& X); @@ -66,9 +73,11 @@ arma_inline const Op,op_htrans> ht() const; arma_inline const Op,op_strans> st() const; - arma_inline eT& col(const uword col_num); + arma_inline eT& col(const uword col_num); // TODO: inconsistent; should return a subview_col; change API for 4.0 ? arma_inline eT col(const uword col_num) const; + using Mat::cols; + arma_inline subview_row cols(const uword in_col1, const uword in_col2); arma_inline const subview_row cols(const uword in_col1, const uword in_col2) const; @@ -153,6 +162,7 @@ arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); + // TODO: constructor with fill template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); @@ -176,6 +186,8 @@ inline const Row& operator=(const std::initializer_list& list); #endif + arma_inline const Row& operator=(const fixed& X); + arma_inline const Op< Row_fixed_type, op_htrans > t() const; arma_inline const Op< Row_fixed_type, op_htrans > ht() const; arma_inline const Op< Row_fixed_type, op_strans > st() const; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -57,7 +57,35 @@ template +template inline +Row::Row(const uword in_n_elem, const arma::fill::fill_class& f) + : Mat(arma_vec_indicator(), 1, in_n_elem, 2) + { + arma_extra_debug_sigprint(); + + (*this).fill(f); + } + + + +template +template +inline +Row::Row(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) + : Mat(arma_vec_indicator(), 2) + { + arma_extra_debug_sigprint(); + + Mat::init_warm(in_n_rows, in_n_cols); + + (*this).fill(f); + } + + + +template +inline Row::Row(const char* text) { arma_extra_debug_sigprint(); @@ -173,6 +201,32 @@ return *this; } + + + template + inline + Row::Row(Row&& X) + : Mat(arma_vec_indicator(), 2) + { + arma_extra_debug_sigprint(); + + (*this).steal_mem(X); + } + + + + template + inline + const Row& + Row::operator=(Row&& X) + { + arma_extra_debug_sigprint(); + + (*this).steal_mem(X); + + return *this; + } + #endif @@ -207,6 +261,20 @@ template +inline +const Row& +Row::operator=(const Row& X) + { + arma_extra_debug_sigprint(); + + Mat::operator=(X); + + return *this; + } + + + +template template inline Row::Row(const Base& X) @@ -761,9 +829,10 @@ { arma_extra_debug_sigprint_this(this); - eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; - arrayops::copy( dest, X.mem, fixed_n_elem ); + arrayops::copy( dest, src, fixed_n_elem ); } @@ -964,6 +1033,24 @@ template template arma_inline +const Row& +Row::fixed::operator=(const fixed& X) + { + arma_extra_debug_sigprint(); + + eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; + + arrayops::copy( dest, src, fixed_n_elem ); + + return *this; + } + + + +template +template +arma_inline const Op< typename Row::template fixed::Row_fixed_type, op_htrans > Row::fixed::t() const { Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-09-23 02:53:46 UTC (rev 4533) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-09-24 03:48:46 UTC (rev 4534) @@ -36,21 +36,27 @@ * The memory used to store the values of the matrix. * In accordance with the CSC format, this stores only the actual values. * The correct locations of the values are assembled from the row indices - * and the column pointers. + * and the column pointers. The length of this array is n_nonzero + 1; the + * final value ensures the integrity of iterators. If you are planning on + * resizing this vector, it's probably best to use mem_resize() instead. */ const eT* const values; /** * The row indices of each value. row_indices[i] is the row of values[i]. * The length of this array is n_nonzero + 1; the final value ensures the - * integrity of iterators. + * integrity of iterators. If you are planning on resizing this vector, it's + * probably best to use mem_resize() instead. */ const uword* const row_indices; /** * The column pointers. This stores the index of the first item in column i. * That is, values[col_ptrs[i]] is the first value in column i, and it is in - * row row_indices[col_ptrs[i]]. + * row row_indices[col_ptrs[i]]. This array is of length (n_cols + 2); the + * element col_ptrs[n_cols] should be equal to n_nonzero, and the element + * col_ptrs[n_cols + 1] is an invalid very large value that ensures the + * integrity of iterators. */ const uword* const col_ptrs; @@ -68,6 +74,8 @@ template inline SpMat(const Base& locations, const Base& values, const bool sort_locations = true); template inline SpMat(const Base& locations, const Base& values, const uword n_rows, const uword n_cols, const bool sort_locations = true); + template inline SpMat(const Base& rowind, const Base& colptr, const Base& values, const uword n_rows, const uword n_cols); + inline const SpMat& operator=(const eT val); //! Sets size to 1x1. inline const SpMat& operator*=(const eT val); inline const SpMat& operator/=(const eT val); [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4534 From noreply at r-forge.r-project.org Fri Sep 27 16:07:07 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 27 Sep 2013 16:07:07 +0200 (CEST) Subject: [Rcpp-commits] r4535 - in pkg/Rcpp: . inst/include/Rcpp/module inst/unitTests inst/unitTests/cpp Message-ID: <20130927140707.1622A184F87@r-forge.r-project.org> Author: romain Date: 2013-09-27 16:07:06 +0200 (Fri, 27 Sep 2013) New Revision: 4535 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h pkg/Rcpp/inst/unitTests/cpp/Module.cpp pkg/Rcpp/inst/unitTests/runit.Module.R Log: use input_parameter and test it, should fix cfa / planar / RcppCNPy issues Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-24 03:48:46 UTC (rev 4534) +++ pkg/Rcpp/ChangeLog 2013-09-27 14:07:06 UTC (rev 4535) @@ -1,3 +1,10 @@ +2013-09-27 Romain Francois + + * include/Rcpp/module/Module_generated_CppFunction.h : regenerated to + use input_parameter traits for more flexible parameter passing strategy + * unitTests/cpp/Module.cpp : more testing + * unitTests/runit.Module.R : more testing + 2013-09-22 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/diff.h: Declare set_previous Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h 2013-09-24 03:48:46 UTC (rev 4534) +++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h 2013-09-27 14:07:06 UTC (rev 4535) @@ -2,7 +2,7 @@ // // Module_generated_CppFunction.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2010-2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010-2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -27,7 +27,9 @@ public: CppFunction0(OUT (*fun)(void), const char* docstring = 0 ) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP*) { + BEGIN_RCPP return Rcpp::module_wrap( ptr_fun() ) ; + END_RCPP } inline int nargs(){ return 0; } @@ -45,8 +47,9 @@ CppFunction0(void (*fun)(void), const char* docstring = 0 ) : CppFunction(docstring), ptr_fun(fun){} ; SEXP operator()(SEXP*) { + BEGIN_RCPP ptr_fun() ; - return R_NilValue ; + END_RCPP } inline int nargs(){ return 0; } @@ -64,7 +67,9 @@ public: CppFunction_WithFormals0(OUT (*fun)(void), Rcpp::List, const char* docstring = 0 ) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP*) { + BEGIN_RCPP return Rcpp::module_wrap( ptr_fun() ) ; + END_RCPP } inline int nargs(){ return 0; } @@ -82,8 +87,9 @@ CppFunction_WithFormals0(void (*fun)(void), Rcpp::List, const char* docstring = 0 ) : CppFunction(docstring), ptr_fun(fun){} ; SEXP operator()(SEXP*) { + BEGIN_RCPP ptr_fun() ; - return R_NilValue ; + END_RCPP } inline int nargs(){ return 0; } @@ -102,7 +108,12 @@ CppFunction1(OUT (*fun)(U0) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + + return Rcpp::module_wrap( ptr_fun( x0 ) ) ; + END_RCPP } inline int nargs(){ return 1; } @@ -119,8 +130,11 @@ CppFunction1(void (*fun)(U0) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + ptr_fun( x0 ) ; + END_RCPP } inline int nargs(){ return 1; } @@ -142,7 +156,10 @@ CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ) ) ) ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + return Rcpp::module_wrap( ptr_fun( x0 ) ) ; + END_RCPP } inline int nargs(){ return 1; } @@ -162,8 +179,10 @@ CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ) ) ; - return R_NilValue ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + ptr_fun( x0 ) ; + END_RCPP } inline int nargs(){ return 1; } @@ -179,5314 +198,14466 @@ -template class CppFunction2 : public CppFunction { +template class CppFunction2 : public CppFunction { public: - CppFunction2(OUT (*fun)(U0, U1) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction2(OUT (*fun)(U0,U1) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + + return Rcpp::module_wrap( ptr_fun( x0,x1 ) ) ; + END_RCPP } inline int nargs(){ return 2; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - OUT (*ptr_fun)(U0, U1) ; + OUT (*ptr_fun)(U0,U1) ; } ; template -class CppFunction2 : public CppFunction { +class CppFunction2 : public CppFunction { public: - CppFunction2(void (*fun)(U0, U1) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction2(void (*fun)(U0,U1) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + ptr_fun( x0,x1 ) ; + END_RCPP } inline int nargs(){ return 2; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - void (*ptr_fun)(U0, U1) ; + void (*ptr_fun)(U0,U1) ; } ; -template +template class CppFunction_WithFormals2 : public CppFunction { public: - CppFunction_WithFormals2(OUT (*fun)(U0, U1) , Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals2(OUT (*fun)(U0,U1) , Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ) ) ) ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + return Rcpp::module_wrap( ptr_fun( x0,x1 ) ) ; + END_RCPP } inline int nargs(){ return 2; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - OUT (*ptr_fun)(U0, U1) ; + OUT (*ptr_fun)(U0,U1) ; } ; template -class CppFunction_WithFormals2 : public CppFunction { +class CppFunction_WithFormals2 : public CppFunction { public: - CppFunction_WithFormals2(void (*fun)(U0, U1), Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals2(void (*fun)(U0,U1), Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ) ) ; - return R_NilValue ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + ptr_fun( x0,x1 ) ; + END_RCPP } inline int nargs(){ return 2; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - void (*ptr_fun)(U0, U1) ; + void (*ptr_fun)(U0,U1) ; } ; -template class CppFunction3 : public CppFunction { +template class CppFunction3 : public CppFunction { public: - CppFunction3(OUT (*fun)(U0, U1, U2) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction3(OUT (*fun)(U0,U1,U2) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + + return Rcpp::module_wrap( ptr_fun( x0,x1,x2 ) ) ; + END_RCPP } inline int nargs(){ return 3; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - OUT (*ptr_fun)(U0, U1, U2) ; + OUT (*ptr_fun)(U0,U1,U2) ; } ; template -class CppFunction3 : public CppFunction { +class CppFunction3 : public CppFunction { public: - CppFunction3(void (*fun)(U0, U1, U2) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction3(void (*fun)(U0,U1,U2) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + ptr_fun( x0,x1,x2 ) ; + END_RCPP } inline int nargs(){ return 3; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - void (*ptr_fun)(U0, U1, U2) ; + void (*ptr_fun)(U0,U1,U2) ; } ; -template +template class CppFunction_WithFormals3 : public CppFunction { public: - CppFunction_WithFormals3(OUT (*fun)(U0, U1, U2) , Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals3(OUT (*fun)(U0,U1,U2) , Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ) ) ) ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + return Rcpp::module_wrap( ptr_fun( x0,x1,x2 ) ) ; + END_RCPP } inline int nargs(){ return 3; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - OUT (*ptr_fun)(U0, U1, U2) ; + OUT (*ptr_fun)(U0,U1,U2) ; } ; template -class CppFunction_WithFormals3 : public CppFunction { +class CppFunction_WithFormals3 : public CppFunction { public: - CppFunction_WithFormals3(void (*fun)(U0, U1, U2), Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals3(void (*fun)(U0,U1,U2), Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ) ) ; - return R_NilValue ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + ptr_fun( x0,x1,x2 ) ; + END_RCPP } inline int nargs(){ return 3; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - void (*ptr_fun)(U0, U1, U2) ; + void (*ptr_fun)(U0,U1,U2) ; } ; -template class CppFunction4 : public CppFunction { +template class CppFunction4 : public CppFunction { public: - CppFunction4(OUT (*fun)(U0, U1, U2, U3) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction4(OUT (*fun)(U0,U1,U2,U3) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + + return Rcpp::module_wrap( ptr_fun( x0,x1,x2,x3 ) ) ; + END_RCPP } inline int nargs(){ return 4; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - OUT (*ptr_fun)(U0, U1, U2, U3) ; + OUT (*ptr_fun)(U0,U1,U2,U3) ; } ; template -class CppFunction4 : public CppFunction { +class CppFunction4 : public CppFunction { public: - CppFunction4(void (*fun)(U0, U1, U2, U3) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction4(void (*fun)(U0,U1,U2,U3) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + ptr_fun( x0,x1,x2,x3 ) ; + END_RCPP } inline int nargs(){ return 4; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - void (*ptr_fun)(U0, U1, U2, U3) ; + void (*ptr_fun)(U0,U1,U2,U3) ; } ; -template +template class CppFunction_WithFormals4 : public CppFunction { public: - CppFunction_WithFormals4(OUT (*fun)(U0, U1, U2, U3) , Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals4(OUT (*fun)(U0,U1,U2,U3) , Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ) ) ) ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + return Rcpp::module_wrap( ptr_fun( x0,x1,x2,x3 ) ) ; + END_RCPP } inline int nargs(){ return 4; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - OUT (*ptr_fun)(U0, U1, U2, U3) ; + OUT (*ptr_fun)(U0,U1,U2,U3) ; } ; template -class CppFunction_WithFormals4 : public CppFunction { +class CppFunction_WithFormals4 : public CppFunction { public: - CppFunction_WithFormals4(void (*fun)(U0, U1, U2, U3), Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals4(void (*fun)(U0,U1,U2,U3), Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ) ) ; - return R_NilValue ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + ptr_fun( x0,x1,x2,x3 ) ; + END_RCPP } inline int nargs(){ return 4; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - void (*ptr_fun)(U0, U1, U2, U3) ; + void (*ptr_fun)(U0,U1,U2,U3) ; } ; -template class CppFunction5 : public CppFunction { +template class CppFunction5 : public CppFunction { public: - CppFunction5(OUT (*fun)(U0, U1, U2, U3, U4) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction5(OUT (*fun)(U0,U1,U2,U3,U4) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + + return Rcpp::module_wrap( ptr_fun( x0,x1,x2,x3,x4 ) ) ; + END_RCPP } inline int nargs(){ return 5; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - OUT (*ptr_fun)(U0, U1, U2, U3, U4) ; + OUT (*ptr_fun)(U0,U1,U2,U3,U4) ; } ; template -class CppFunction5 : public CppFunction { +class CppFunction5 : public CppFunction { public: - CppFunction5(void (*fun)(U0, U1, U2, U3, U4) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction5(void (*fun)(U0,U1,U2,U3,U4) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + ptr_fun( x0,x1,x2,x3,x4 ) ; + END_RCPP } inline int nargs(){ return 5; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - void (*ptr_fun)(U0, U1, U2, U3, U4) ; + void (*ptr_fun)(U0,U1,U2,U3,U4) ; } ; -template +template class CppFunction_WithFormals5 : public CppFunction { public: - CppFunction_WithFormals5(OUT (*fun)(U0, U1, U2, U3, U4) , Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals5(OUT (*fun)(U0,U1,U2,U3,U4) , Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ) ) ) ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + return Rcpp::module_wrap( ptr_fun( x0,x1,x2,x3,x4 ) ) ; + END_RCPP } inline int nargs(){ return 5; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - OUT (*ptr_fun)(U0, U1, U2, U3, U4) ; + OUT (*ptr_fun)(U0,U1,U2,U3,U4) ; } ; template -class CppFunction_WithFormals5 : public CppFunction { +class CppFunction_WithFormals5 : public CppFunction { public: - CppFunction_WithFormals5(void (*fun)(U0, U1, U2, U3, U4), Rcpp::List formals_, const char* docstring = 0) : + CppFunction_WithFormals5(void (*fun)(U0,U1,U2,U3,U4), Rcpp::List formals_, const char* docstring = 0) : CppFunction(docstring), formals(formals_), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ) ) ; - return R_NilValue ; + BEGIN_RCPP + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + ptr_fun( x0,x1,x2,x3,x4 ) ; + END_RCPP } inline int nargs(){ return 5; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } SEXP get_formals(){ return formals; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: Rcpp::List formals ; - void (*ptr_fun)(U0, U1, U2, U3, U4) ; + void (*ptr_fun)(U0,U1,U2,U3,U4) ; } ; -template class CppFunction6 : public CppFunction { +template class CppFunction6 : public CppFunction { public: - CppFunction6(OUT (*fun)(U0, U1, U2, U3, U4, U5) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction6(OUT (*fun)(U0,U1,U2,U3,U4,U5) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - return Rcpp::module_wrap( ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ), Rcpp::as< U5 >( args[5] ) ) ) ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + typename traits::input_parameter< U5 >::type x5( args[5] ) ; + + return Rcpp::module_wrap( ptr_fun( x0,x1,x2,x3,x4,x5 ) ) ; + END_RCPP } inline int nargs(){ return 6; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - OUT (*ptr_fun)(U0, U1, U2, U3, U4, U5) ; + OUT (*ptr_fun)(U0,U1,U2,U3,U4,U5) ; } ; template -class CppFunction6 : public CppFunction { +class CppFunction6 : public CppFunction { public: - CppFunction6(void (*fun)(U0, U1, U2, U3, U4, U5) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} + CppFunction6(void (*fun)(U0,U1,U2,U3,U4,U5) , const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun){} SEXP operator()(SEXP* args) { - ptr_fun( Rcpp::as< U0 >( args[0] ), Rcpp::as< U1 >( args[1] ), Rcpp::as< U2 >( args[2] ), Rcpp::as< U3 >( args[3] ), Rcpp::as< U4 >( args[4] ), Rcpp::as< U5 >( args[5] ) ) ; - return R_NilValue ; + BEGIN_RCPP + + typename traits::input_parameter< U0 >::type x0( args[0] ) ; + typename traits::input_parameter< U1 >::type x1( args[1] ) ; + typename traits::input_parameter< U2 >::type x2( args[2] ) ; + typename traits::input_parameter< U3 >::type x3( args[3] ) ; + typename traits::input_parameter< U4 >::type x4( args[4] ) ; + typename traits::input_parameter< U5 >::type x5( args[5] ) ; + ptr_fun( x0,x1,x2,x3,x4,x5 ) ; + END_RCPP } inline int nargs(){ return 6; } inline bool is_void(){ return true; } - inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } + inline void signature(std::string& s, const char* name){ Rcpp::signature(s, name) ; } inline DL_FUNC get_function_ptr(){ return (DL_FUNC)ptr_fun ; } private: - void (*ptr_fun)(U0, U1, U2, U3, U4, U5) ; + void (*ptr_fun)(U0,U1,U2,U3,U4,U5) ; } ; [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4535 From noreply at r-forge.r-project.org Fri Sep 27 16:07:41 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 27 Sep 2013 16:07:41 +0200 (CEST) Subject: [Rcpp-commits] r4536 - scripts Message-ID: <20130927140741.C629F184F87@r-forge.r-project.org> Author: romain Date: 2013-09-27 16:07:41 +0200 (Fri, 27 Sep 2013) New Revision: 4536 Modified: scripts/generator_Module_CppFunction.R Log: updated generator script Modified: scripts/generator_Module_CppFunction.R =================================================================== --- scripts/generator_Module_CppFunction.R 2013-09-27 14:07:06 UTC (rev 4535) +++ scripts/generator_Module_CppFunction.R 2013-09-27 14:07:41 UTC (rev 4536) @@ -2,7 +2,7 @@ fun <- function( i ){ index <- (1:i)-1 - collapse <- function(x) paste( x, collapse = ", " ) + collapse <- function(x, sep = "," ) paste( x, collapse = sep ) txt <- sprintf( ' template class CppFunction%d : public CppFunction { @@ -12,6 +12,9 @@ SEXP operator()(SEXP* args) { BEGIN_RCPP + + %s + return Rcpp::module_wrap( ptr_fun( %s ) ) ; END_RCPP } @@ -31,6 +34,8 @@ SEXP operator()(SEXP* args) { BEGIN_RCPP + + %s ptr_fun( %s ) ; END_RCPP } @@ -55,6 +60,7 @@ SEXP operator()(SEXP* args) { BEGIN_RCPP + %s return Rcpp::module_wrap( ptr_fun( %s ) ) ; END_RCPP } @@ -77,6 +83,7 @@ SEXP operator()(SEXP* args) { BEGIN_RCPP + %s ptr_fun( %s ) ; END_RCPP } @@ -97,7 +104,8 @@ i, i, collapse( sprintf( "U%d", index ) ), -collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) ), +collapse( sprintf( "typename traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), sep = "\n " ), +collapse( sprintf( "x%d", index ) ), i, collapse( sprintf( "U%d", index ) ), collapse( sprintf( "U%d", index ) ), @@ -108,7 +116,8 @@ collapse( sprintf( "U%d", index ) ), i, collapse( sprintf( "U%d", index ) ), -collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d>::type >( args[%d] )", index, index ) ), +collapse( sprintf( "typename traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), sep = "\n " ), +collapse( sprintf( "x%d", index ) ), i, collapse( sprintf( "U%d", index ) ), collapse( sprintf( "U%d", index ) ), @@ -118,7 +127,8 @@ i, i, collapse( sprintf( "U%d", index ) ), -collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) ), +collapse( sprintf( "typename traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), sep = "\n " ), +collapse( sprintf( "x%d", index ) ), i, collapse( sprintf( "U%d", index ) ), collapse( sprintf( "U%d", index ) ), @@ -129,7 +139,8 @@ collapse( sprintf( "U%d", index ) ), i, collapse( sprintf( "U%d", index ) ), -collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d>::type >( args[%d] )", index, index ) ), +collapse( sprintf( "typename traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), sep = "\n " ), +collapse( sprintf( "x%d", index ) ), i, collapse( sprintf( "U%d", index ) ), collapse( sprintf( "U%d", index ) ) @@ -142,7 +153,7 @@ // // Module_generated_CppFunction.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2010-2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010-2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // From noreply at r-forge.r-project.org Fri Sep 27 17:11:21 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 27 Sep 2013 17:11:21 +0200 (CEST) Subject: [Rcpp-commits] r4537 - in pkg/RcppArmadillo: . inst/include inst/unitTests inst/unitTests/cpp Message-ID: <20130927151121.5E78D183E92@r-forge.r-project.org> Author: romain Date: 2013-09-27 17:11:20 +0200 (Fri, 27 Sep 2013) New Revision: 4537 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R Log: handle InputParameter for complex type (cx_mat) ... Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-27 14:07:41 UTC (rev 4536) +++ pkg/RcppArmadillo/ChangeLog 2013-09-27 15:11:20 UTC (rev 4537) @@ -1,3 +1,10 @@ +2013-09-27 Romain Francois + + * include/RcppArmadilloAs.h : handle cx_mat, using that Rcomplex is + layout compatible with std::complex + * unitTests/cpp/armadillo.cpp : more testing + * unitTests/runit.RcppArmadillo.R : more testing + 2013-09-23 Dirk Eddelbuettel * inst/include/*: Upgraded to Armadillo pre-release of 3.920.0 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-27 14:07:41 UTC (rev 4536) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-09-27 15:11:20 UTC (rev 4537) @@ -105,7 +105,7 @@ public: typedef const typename arma::Mat& const_reference ; - ConstReferenceInputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + ConstReferenceInputParameter( SEXP x_ ) : m(x_), mat( reinterpret_cast( m.begin() ), m.nrow(), m.ncol(), false ){} inline operator const_reference(){ return mat ; @@ -121,7 +121,7 @@ public: typedef typename arma::Mat& reference ; - ReferenceInputParameter( SEXP x_ ) : m(x_), mat( m.begin(), m.nrow(), m.ncol(), false ){} + ReferenceInputParameter( SEXP x_ ) : m(x_), mat( reinterpret_cast( m.begin() ), m.nrow(), m.ncol(), false ){} inline operator reference(){ return mat ; @@ -136,7 +136,7 @@ class ConstInputParameter< arma::Mat > { public: typedef const typename arma::Mat const_nonref; - ConstInputParameter(SEXP x_) : m(x_), mat(m.begin(), m.nrow(), m.ncol(), false){} + ConstInputParameter(SEXP x_) : m(x_), mat( reinterpret_cast( m.begin() ), m.nrow(), m.ncol(), false){} inline operator const_nonref() { return mat ; } private: Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; @@ -147,7 +147,7 @@ template class ArmaVec_InputParameter { public: - ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( v.begin(), v.size(), false ){} + ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( reinterpret_cast( v.begin() ), v.size(), false ){} inline operator REF(){ return vec ; Modified: pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp =================================================================== --- pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp 2013-09-27 14:07:41 UTC (rev 4536) +++ pkg/RcppArmadillo/inst/unitTests/cpp/armadillo.cpp 2013-09-27 15:11:20 UTC (rev 4537) @@ -252,3 +252,23 @@ return x.n_elem; } +// [[Rcpp::export]] +int cx_mat_plain(arma::cx_mat x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int cx_mat_const(const arma::cx_mat x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int cx_mat_ref(arma::cx_mat & x) { + return x.n_elem; +} + +// [[Rcpp::export]] +int cx_mat_const_ref(const arma::cx_mat & x) { + return x.n_elem; +} + Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R =================================================================== --- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-09-27 14:07:41 UTC (rev 4536) +++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-09-27 15:11:20 UTC (rev 4537) @@ -209,3 +209,26 @@ checkEquals(fx(m), 9, msg = "Const Reference Vector function signature" ) } +test.armadillo.mat.plain <- function() { + fx <- cx_mat_plain + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Plain Matrix function signature" ) +} + +test.armadillo.mat.const <- function() { + fx <- cx_mat_const + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Const Matrix function signature" ) +} + +test.armadillo.mat.ref <- function() { + fx <- cx_mat_ref + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Reference Matrix function signature" ) +} + +test.armadillo.mat.const.ref <- function() { + fx <- cx_mat_const_ref + m <- matrix(1:9, 3, 3) + checkEquals(fx(m), 9, msg = "Const Reference Matrix function signature" ) +} From noreply at r-forge.r-project.org Fri Sep 27 21:30:44 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 27 Sep 2013 21:30:44 +0200 (CEST) Subject: [Rcpp-commits] r4538 - in pkg/Rcpp: . inst vignettes vignettes/notyet Message-ID: <20130927193044.F0DCE184F87@r-forge.r-project.org> Author: edd Date: 2013-09-27 21:30:44 +0200 (Fri, 27 Sep 2013) New Revision: 4538 Added: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw Removed: pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/inst/NEWS.Rd Log: re-activated unitTests vignette, bumbed pre-release version Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-27 15:11:20 UTC (rev 4537) +++ pkg/Rcpp/ChangeLog 2013-09-27 19:30:44 UTC (rev 4538) @@ -1,3 +1,8 @@ +2013-09-27 Dirk Eddelbuettel + + * vignettes/Rcpp-unitTests.Rnw: Re-activated vignette + * DESCRIPTION: Version number bumped to 0.10.4.6 + 2013-09-27 Romain Francois * include/Rcpp/module/Module_generated_CppFunction.h : regenerated to Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-09-27 15:11:20 UTC (rev 4537) +++ pkg/Rcpp/DESCRIPTION 2013-09-27 19:30:44 UTC (rev 4538) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.4.5 +Version: 0.10.4.6 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-27 15:11:20 UTC (rev 4537) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-27 19:30:44 UTC (rev 4538) @@ -75,8 +75,6 @@ \itemize{ \item The vignettes have been moved from \code{inst/doc/} to the \code{vignettes} directory which is now preferred. - \item The unitTest vignette has been disabled as no longer builds - when called from \code{R CMD check}. \item The appearance of the vignettes has been refreshed by switching to the Bistream Charter font, and microtype package. } Copied: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw (from rev 4536, pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw) =================================================================== --- pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw (rev 0) +++ pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-09-27 19:30:44 UTC (rev 4538) @@ -0,0 +1,69 @@ +\documentclass[10pt]{article} +%\VignetteIndexEntry{Rcpp-unitTests} +%\VignetteKeywords{R,Rcpp,unit tests} +%\VignettePackage{Rcpp} + +\usepackage{vmargin} +\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} + +\RequirePackage{ae,mathpple} % ae as a default font pkg works with Sweave +\RequirePackage[T1]{fontenc} + +<>= +require(Rcpp) +prettyVersion <- packageDescription("Rcpp")$Version +prettyDate <- format(Sys.Date(), "%B %e, %Y") +library(RUnit) +@ + +\usepackage[colorlinks]{hyperref} +\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} +\title{\textbf{Rcpp}: Unit testing results} +\date{Rcpp version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} + +\begin{document} +\maketitle + +\section*{Test Execution} + +<>= +pkg <- "Rcpp" + +## Make sure we run all tests for the vignette +Sys.setenv("RunAllRcppTests"="yes") + +if (file.exists("unitTests-results")) unlink("unitTests-results", recursive = TRUE) +dir.create("unitTests-results") +pathRcppTests <<- system.file("unitTests", package = pkg) +path <- system.file("unitTests", package=pkg) +testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs=path) +tests <- runTestSuite(testSuite) +err <- getErrors(tests) +if (err$nFail > 0) stop(sprintf("unit test problems: %d failures", err$nFail)) +if (err$nErr > 0) stop( sprintf("unit test problems: %d errors", err$nErr)) +printHTMLProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.html", pkg)) +printTextProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.txt" , pkg)) + +if (file.exists("/tmp")) { + invisible(sapply(c("txt", "html"), function(ext) { + fname <- sprintf("unitTests-results/%s-unitTests.%s", pkg, ext) + file.copy(fname, "/tmp", overwrite=TRUE) + })) +} +@ + +\section*{Test Results} + +\begin{verbatim} +<>= +results <- "unitTests-results/Rcpp-unitTests.txt" +if (file.exists(results)) { + writeLines(readLines(results)) +} else{ + writeLines( "unit test results not available" ) +} +@ + +\end{verbatim} + +\end{document} Deleted: pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw =================================================================== --- pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw 2013-09-27 15:11:20 UTC (rev 4537) +++ pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw 2013-09-27 19:30:44 UTC (rev 4538) @@ -1,69 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-unitTests} -%\VignetteKeywords{R,Rcpp,unit tests} -%\VignettePackage{Rcpp} - -\usepackage{vmargin} -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} - -\RequirePackage{ae,mathpple} % ae as a default font pkg works with Sweave -\RequirePackage[T1]{fontenc} - -<>= -require(Rcpp) -prettyVersion <- packageDescription("Rcpp")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -library(RUnit) -@ - -\usepackage[colorlinks]{hyperref} -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{\textbf{Rcpp}: Unit testing results} -\date{Rcpp version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} - -\begin{document} -\maketitle - -\section*{Test Execution} - -<>= -pkg <- "Rcpp" - -## Make sure we run all tests for the vignette -Sys.setenv("RunAllRcppTests"="yes") - -if (file.exists("unitTests-results")) unlink("unitTests-results", recursive = TRUE) -dir.create("unitTests-results") -pathRcppTests <<- system.file("unitTests", package = pkg) -path <- system.file("unitTests", package=pkg) -testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs=path) -tests <- runTestSuite(testSuite) -err <- getErrors(tests) -if (err$nFail > 0) stop(sprintf("unit test problems: %d failures", err$nFail)) -if (err$nErr > 0) stop( sprintf("unit test problems: %d errors", err$nErr)) -printHTMLProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.html", pkg)) -printTextProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.txt" , pkg)) - -if (file.exists("/tmp")) { - invisible(sapply(c("txt", "html"), function(ext) { - fname <- sprintf("unitTests-results/%s-unitTests.%s", pkg, ext) - file.copy(fname, "/tmp", overwrite=TRUE) - })) -} -@ - -\section*{Test Results} - -\begin{verbatim} -<>= -results <- "unitTests-results/Rcpp-unitTests.txt" -if (file.exists(results)) { - writeLines(readLines(results)) -} else{ - writeLines( "unit test results not available" ) -} -@ - -\end{verbatim} - -\end{document} From noreply at r-forge.r-project.org Sat Sep 28 03:45:35 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 03:45:35 +0200 (CEST) Subject: [Rcpp-commits] r4539 - in pkg/RcppArmadillo: . debian inst inst/include/armadillo_bits Message-ID: <20130928014535.EAE49181019@r-forge.r-project.org> Author: edd Date: 2013-09-28 03:45:32 +0200 (Sat, 28 Sep 2013) New Revision: 4539 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_dot.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eig.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_join.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_kron_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp Log: Armadillo 0.3.920.1 (a minor one-file fix over 0.3.920.0) forgot to commit the finalized 0.3.920.0 yesterday Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/ChangeLog 2013-09-28 01:45:32 UTC (rev 4539) @@ -1,10 +1,17 @@ -2013-09-27 Romain Francois +2013-09-27 Dirk Eddelbuettel + * DESCRIPTION: Release 0.3.920.1 + * inst/NEWS: Release 0.3.920.1 + * inst/include/*: Upgraded to new release 3.920.1 of Armadillo + * debian/*: Similarly updated for new release to Debian + +2013-09-27 Romain Francois + * include/RcppArmadilloAs.h : handle cx_mat, using that Rcomplex is - layout compatible with std::complex + layout compatible with std::complex * unitTests/cpp/armadillo.cpp : more testing * unitTests/runit.RcppArmadillo.R : more testing - + 2013-09-23 Dirk Eddelbuettel * inst/include/*: Upgraded to Armadillo pre-release of 3.920.0 Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/DESCRIPTION 2013-09-28 01:45:32 UTC (rev 4539) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.910.0.2 +Version: 0.3.920.0 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel @@ -21,7 +21,7 @@ (due to speed and/or integration capabilities), rather than another language. . The RcppArmadillo package includes the header files from the templated - Armadillo library (currently version 3.910.0). Thus users do not need to + Armadillo library (currently version 3.920.0). Thus users do not need to install Armadillo itself in order to use RcppArmadillo. . This Armadillo integration provides a nice illustration of the Modified: pkg/RcppArmadillo/debian/changelog =================================================================== --- pkg/RcppArmadillo/debian/changelog 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/debian/changelog 2013-09-28 01:45:32 UTC (rev 4539) @@ -1,3 +1,9 @@ +r-cran-rcpparmadillo (0.3.920.0-1) unstable; urgency=low + + * New upstream release + + -- Dirk Eddelbuettel Thu, 26 Sep 2013 14:27:51 -0500 + r-cran-rcpparmadillo (0.3.910.0-1) unstable; urgency=low * New upstream release Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-09-28 01:45:32 UTC (rev 4539) @@ -2,15 +2,28 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{Changes in RcppArmadillo version (future)}{ +\section{Changes in RcppArmadillo version 0.3.920.1 (2013-09-27)}{ + \itemize{ + \item Upgraded to Armadillo release Version 3.920.1 (Agencia + Nacional Stasi) \itemize{ - \item Initial implementation of \code{wrap} - \item Improved implementation of \code{as<>()} and \code{wrap()} - for sparse matrices - \item Converted main vignette from \code{LaTeX} style \code{minted} - to \code{lstlisting} which permits builds on CRAN; removed - set \code{BuildVignettes: FALSE}. + \item faster \code{.zeros()} + \item faster \code{round()}, \code{exp2()} and \code{log2()} when using C++11 + \item added signum function: \code{sign()} + \item added move constructors when using C++11 + \item added 2D fast Fourier transform: \code{fft2()} + \item added \code{.tube()} for easier extraction of vectors and subcubes from + cubes + \item added specification of a fill type during construction of Mat, Col, + Row and Cube classes, eg. \code{mat X(4, 5, fill::zeros)} } + \item Initial implementation of \code{wrap} + \item Improved implementation of \code{as<>()} and \code{wrap()} + for sparse matrices + \item Converted main vignette from \code{LaTeX} style \code{minted} + to \code{lstlisting} which permits builds on CRAN; removed + set \code{BuildVignettes: FALSE}. + } } \section{Changes in RcppArmadillo version 0.3.910.0 (2013-08-12)}{ Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -27,8 +27,8 @@ inline explicit Col(const uword n_elem); inline Col(const uword in_rows, const uword in_cols); - template inline Col(const uword n_elem, const arma::fill::fill_class& f); - template inline Col(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + template inline Col(const uword n_elem, const fill::fill_class& f); + template inline Col(const uword in_rows, const uword in_cols, const fill::fill_class& f); inline Col(const char* text); inline const Col& operator=(const char* text); @@ -77,6 +77,7 @@ arma_inline eT row(const uword row_num) const; using Mat::rows; + using Mat::operator(); arma_inline subview_col rows(const uword in_row1, const uword in_row2); arma_inline const subview_col rows(const uword in_row1, const uword in_row2) const; @@ -84,11 +85,12 @@ arma_inline subview_col subvec(const uword in_row1, const uword in_row2); arma_inline const subview_col subvec(const uword in_row1, const uword in_row2) const; + arma_inline subview_col rows(const span& row_span); + arma_inline const subview_col rows(const span& row_span) const; + arma_inline subview_col subvec(const span& row_span); arma_inline const subview_col subvec(const span& row_span) const; - using Mat::operator(); - arma_inline subview_col operator()(const span& row_span); arma_inline const subview_col operator()(const span& row_span) const; @@ -165,8 +167,7 @@ arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); - // TODO: constructor with fill_type - + template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -59,7 +59,7 @@ template template inline -Col::Col(const uword in_n_elem, const arma::fill::fill_class& f) +Col::Col(const uword in_n_elem, const fill::fill_class& f) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_extra_debug_sigprint(); @@ -72,7 +72,7 @@ template template inline -Col::Col(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) +Col::Col(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_extra_debug_sigprint(); @@ -569,6 +569,30 @@ template arma_inline subview_col +Col::rows(const span& row_span) + { + arma_extra_debug_sigprint(); + + return subvec(row_span); + } + + + +template +arma_inline +const subview_col +Col::rows(const span& row_span) const + { + arma_extra_debug_sigprint(); + + return subvec(row_span); + } + + + +template +arma_inline +subview_col Col::subvec(const span& row_span) { arma_extra_debug_sigprint(); @@ -902,6 +926,24 @@ template template +template +inline +Col::fixed::fixed(const fill::fill_class&) + : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) + { + arma_extra_debug_sigprint_this(this); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + } + + + +template +template template inline Col::fixed::fixed(const Base& A) Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -58,7 +58,7 @@ inline Cube(const uword in_rows, const uword in_cols, const uword in_slices); template - inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const arma::fill::fill_class& f); + inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::fill_class& f); #if defined(ARMA_USE_CXX11) inline Cube(Cube&& m); @@ -239,9 +239,6 @@ inline const Cube& fill(const eT val); - template - arma_hot inline const Cube& fill(const arma::fill::fill_class& f); - inline const Cube& zeros(); inline const Cube& zeros(const uword in_rows, const uword in_cols, const uword in_slices); @@ -361,23 +358,19 @@ public: - inline fixed() { mem_setup(); } + inline fixed(); + inline fixed(const fixed& X); - inline const Cube& operator=(const eT val) { mem_setup(); Cube::operator=(val); return *this; } + template inline fixed(const fill::fill_class& f); + template inline fixed(const BaseCube& A); + template inline fixed(const BaseCube& A, const BaseCube& B); - template - inline fixed(const BaseCube& A) { mem_setup(); Cube::operator=(A.get_ref()); } - - template - inline const Cube& operator=(const BaseCube& A) { Cube::operator=(A.get_ref()); return *this; } - - template - inline explicit fixed(const BaseCube& A, const BaseCube& B) { mem_setup(); Cube::init(A,B); } - - + using Cube::operator=; using Cube::operator(); + inline const Cube& operator=(const fixed& X); + arma_inline arma_warn_unused eT& operator[] (const uword i); arma_inline arma_warn_unused const eT& operator[] (const uword i) const; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -79,7 +79,7 @@ template template inline -Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma::fill::fill_class& f) +Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class&) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem_slice(in_n_rows*in_n_cols) @@ -93,7 +93,12 @@ init_cold(); - (*this).fill(f); + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + + if(is_same_type::yes) { arma_debug_check(true, "Cube::Cube(): unsupported fill type"); } } @@ -2714,29 +2719,8 @@ template -template -arma_hot inline const Cube& -Cube::fill(const arma::fill::fill_class&) - { - arma_extra_debug_sigprint(); - - if(is_same_type::yes) (*this).zeros(); - if(is_same_type::yes) (*this).ones(); - if(is_same_type::yes) (*this).randu(); - if(is_same_type::yes) (*this).randn(); - - if(is_same_type::yes) { arma_debug_check(true, "Cube::fill(): unsupported fill type"); } - - return *this; - } - - - -template -inline -const Cube& Cube::zeros() { arma_extra_debug_sigprint(); @@ -3451,7 +3435,7 @@ if(this != &x) { - if( (x.mem_state == 0) && (x.n_elem > Cube_prealloc::mem_n_elem) ) + if( (mem_state <= 1) && (x.mem_state <= 1) && (x.n_elem > Cube_prealloc::mem_n_elem) ) { reset(); @@ -3485,6 +3469,7 @@ access::rw(x.n_elem_slice) = 0; access::rw(x.n_slices) = 0; access::rw(x.n_elem) = 0; + access::rw(x.mem_state) = 0; access::rw(x.mem) = 0; } else @@ -3496,13 +3481,18 @@ +// +// Cube::fixed + + + template template arma_inline void Cube::fixed::mem_setup() { - arma_extra_debug_sigprint_this(this); + arma_extra_debug_sigprint(); if(fixed_n_elem > 0) { @@ -3535,6 +3525,103 @@ template template +inline +Cube::fixed::fixed() + { + arma_extra_debug_sigprint_this(this); + + mem_setup(); + } + + + +template +template +inline +Cube::fixed::fixed(const fixed& X) + { + arma_extra_debug_sigprint_this(this); + + mem_setup(); + + eT* dest = (use_extra) ? mem_local_extra : mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; + + arrayops::copy( dest, src, fixed_n_elem ); + } + + + +template +template +template +inline +Cube::fixed::fixed(const fill::fill_class&) + { + arma_extra_debug_sigprint_this(this); + + mem_setup(); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + + if(is_same_type::yes) { arma_debug_check(true, "Cube::fixed::fixed(): unsupported fill type"); } + } + + + +template +template +template +inline +Cube::fixed::fixed(const BaseCube& A) + { + arma_extra_debug_sigprint_this(this); + + mem_setup(); + + Cube::operator=(A.get_ref()); + } + + + +template +template +template +inline +Cube::fixed::fixed(const BaseCube& A, const BaseCube& B) + { + arma_extra_debug_sigprint_this(this); + + mem_setup(); + + Cube::init(A,B); + } + + + +template +template +inline +const Cube& +Cube::fixed::operator=(const fixed& X) + { + arma_extra_debug_sigprint(); + + eT* dest = (use_extra) ? mem_local_extra : mem_local; + const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; + + arrayops::copy( dest, src, fixed_n_elem ); + + return *this; + } + + + +template +template arma_inline arma_warn_unused eT& @@ -3683,6 +3770,11 @@ +// +// Cube_aux + + + //! prefix ++ template arma_inline Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -50,7 +50,7 @@ inline Mat(const uword in_rows, const uword in_cols); template - inline Mat(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + inline Mat(const uword in_rows, const uword in_cols, const fill::fill_class& f); inline Mat(const char* text); inline const Mat& operator=(const char* text); @@ -172,9 +172,6 @@ inline Col unsafe_col(const uword col_num); inline const Col unsafe_col(const uword col_num) const; - // TODO: rows( span ) - // TODO: cols( span ) - // TODO: also need to add the overloads in Col and Row classes arma_inline subview rows(const uword in_row1, const uword in_row2); arma_inline const subview rows(const uword in_row1, const uword in_row2) const; @@ -182,10 +179,16 @@ arma_inline subview cols(const uword in_col1, const uword in_col2); arma_inline const subview cols(const uword in_col1, const uword in_col2) const; + inline subview rows(const span& row_span); + inline const subview rows(const span& row_span) const; + + arma_inline subview cols(const span& col_span); + arma_inline const subview cols(const span& col_span) const; + + arma_inline subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); arma_inline const subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; - inline subview submat (const span& row_span, const span& col_span); inline const subview submat (const span& row_span, const span& col_span) const; @@ -373,7 +376,7 @@ arma_hot inline const Mat& fill(const eT val); template - arma_hot inline const Mat& fill(const arma::fill::fill_class& f); + arma_hot inline const Mat& fill(const fill::fill_class& f); inline const Mat& zeros(); inline const Mat& zeros(const uword in_elem); @@ -578,7 +581,7 @@ arma_inline fixed(); arma_inline fixed(const fixed& X); - template inline fixed(const arma::fill::fill_class& f); + template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); @@ -623,9 +626,6 @@ arma_inline arma_warn_unused bool is_vec() const; - template - arma_hot inline const Mat& fill(const arma::fill::fill_class& f); - arma_hot inline const Mat& fill(const eT val); arma_hot inline const Mat& zeros(); arma_hot inline const Mat& ones(); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -73,7 +73,7 @@ template template inline -Mat::Mat(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) +Mat::Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) @@ -866,6 +866,7 @@ const uword x_mem_state = x.mem_state; const uword t_vec_state = vec_state; + const uword t_mem_state = mem_state; bool layout_ok = false; @@ -887,7 +888,7 @@ } - if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (layout_ok == true) ) + if( (t_mem_state <= 1) && (x_mem_state <= 1) && (x_n_elem > arma_config::mat_prealloc) && (layout_ok == true) ) { reset(); // note: calling reset() also prevents fixed size matrices from changing size or using non-local memory @@ -897,10 +898,11 @@ access::rw(n_elem) = x_n_elem; access::rw(mem) = x.mem; - access::rw(x.n_rows) = 0; - access::rw(x.n_cols) = 0; - access::rw(x.n_elem) = 0; - access::rw(x.mem) = 0; + access::rw(x.n_rows) = 0; + access::rw(x.n_cols) = 0; + access::rw(x.n_elem) = 0; + access::rw(x.mem_state) = 0; + access::rw(x.mem) = 0; } else { @@ -2670,6 +2672,118 @@ +//! creation of subview (submatrix comprised of specified row vectors) +template +inline +subview +Mat::rows(const span& row_span) + { + arma_extra_debug_sigprint(); + + const bool row_all = row_span.whole; + + const uword local_n_rows = n_rows; + + const uword in_row1 = row_all ? 0 : row_span.a; + const uword in_row2 = row_span.b; + const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; + + arma_debug_check + ( + ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) + , + "Mat::rows(): indices out of bounds or incorrectly used" + ); + + return subview(*this, in_row1, 0, submat_n_rows, n_cols); + } + + + +//! creation of subview (submatrix comprised of specified row vectors) +template +inline +const subview +Mat::rows(const span& row_span) const + { + arma_extra_debug_sigprint(); + + const bool row_all = row_span.whole; + + const uword local_n_rows = n_rows; + + const uword in_row1 = row_all ? 0 : row_span.a; + const uword in_row2 = row_span.b; + const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; + + arma_debug_check + ( + ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) + , + "Mat::rows(): indices out of bounds or incorrectly used" + ); + + return subview(*this, in_row1, 0, submat_n_rows, n_cols); + } + + + +//! creation of subview (submatrix comprised of specified column vectors) +template +arma_inline +subview +Mat::cols(const span& col_span) + { + arma_extra_debug_sigprint(); + + const bool col_all = col_span.whole; + + const uword local_n_cols = n_cols; + + const uword in_col1 = col_all ? 0 : col_span.a; + const uword in_col2 = col_span.b; + const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; + + arma_debug_check + ( + ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) + , + "Mat::cols(): indices out of bounds or incorrectly used" + ); + + return subview(*this, 0, in_col1, n_rows, submat_n_cols); + } + + + +//! creation of subview (submatrix comprised of specified column vectors) +template +arma_inline +const subview +Mat::cols(const span& col_span) const + { + arma_extra_debug_sigprint(); + + const bool col_all = col_span.whole; + + const uword local_n_cols = n_cols; + + const uword in_col1 = col_all ? 0 : col_span.a; + const uword in_col2 = col_span.b; + const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; + + arma_debug_check + ( + ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) + , + "Mat::cols(): indices out of bounds or incorrectly used" + ); + + return subview(*this, 0, in_col1, n_rows, submat_n_cols); + } + + + //! creation of subview (submatrix) template arma_inline @@ -5166,15 +5280,15 @@ arma_hot inline const Mat& -Mat::fill(const arma::fill::fill_class&) +Mat::fill(const fill::fill_class&) { arma_extra_debug_sigprint(); - if(is_same_type::yes) (*this).zeros(); - if(is_same_type::yes) (*this).ones(); - if(is_same_type::yes) (*this).eye(); - if(is_same_type::yes) (*this).randu(); - if(is_same_type::yes) (*this).randn(); + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); return *this; } @@ -6292,12 +6406,16 @@ template template inline -Mat::fixed::fixed(const arma::fill::fill_class& f) +Mat::fixed::fixed(const fill::fill_class&) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : mem_local) ) { arma_extra_debug_sigprint_this(this); - (*this).fill(f); + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); } @@ -6686,30 +6804,9 @@ template template -template arma_hot inline const Mat& -Mat::fixed::fill(const arma::fill::fill_class&) - { - arma_extra_debug_sigprint(); - - if(is_same_type::yes) (*this).zeros(); - if(is_same_type::yes) (*this).ones(); - if(is_same_type::yes) (*this).eye(); - if(is_same_type::yes) (*this).randu(); - if(is_same_type::yes) (*this).randn(); - - return *this; - } - - - -template -template -arma_hot -inline -const Mat& Mat::fixed::fill(const eT val) { arma_extra_debug_sigprint(); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -27,8 +27,8 @@ inline explicit Row(const uword N); inline Row(const uword in_rows, const uword in_cols); - template inline Row(const uword n_elem, const arma::fill::fill_class& f); - template inline Row(const uword in_rows, const uword in_cols, const arma::fill::fill_class& f); + template inline Row(const uword n_elem, const fill::fill_class& f); + template inline Row(const uword in_rows, const uword in_cols, const fill::fill_class& f); inline Row(const char* text); inline const Row& operator=(const char* text); @@ -77,6 +77,7 @@ arma_inline eT col(const uword col_num) const; using Mat::cols; + using Mat::operator(); arma_inline subview_row cols(const uword in_col1, const uword in_col2); arma_inline const subview_row cols(const uword in_col1, const uword in_col2) const; @@ -84,11 +85,12 @@ arma_inline subview_row subvec(const uword in_col1, const uword in_col2); arma_inline const subview_row subvec(const uword in_col1, const uword in_col2) const; + arma_inline subview_row cols(const span& col_span); + arma_inline const subview_row cols(const span& col_span) const; + arma_inline subview_row subvec(const span& col_span); arma_inline const subview_row subvec(const span& col_span) const; - using Mat::operator(); - arma_inline subview_row operator()(const span& col_span); arma_inline const subview_row operator()(const span& col_span) const; @@ -162,8 +164,8 @@ arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); - // TODO: constructor with fill + template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2013-09-27 19:30:44 UTC (rev 4538) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2013-09-28 01:45:32 UTC (rev 4539) @@ -59,7 +59,7 @@ template template inline -Row::Row(const uword in_n_elem, const arma::fill::fill_class& f) +Row::Row(const uword in_n_elem, const fill::fill_class& f) : Mat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_extra_debug_sigprint(); @@ -72,7 +72,7 @@ template template inline -Row::Row(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class& f) +Row::Row(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : Mat(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); @@ -241,7 +241,9 @@ arrayops::inplace_set(Mat::memptr(), eT(0), X.n_elem); for(typename SpRow::const_iterator it = X.begin(); it != X.end(); ++it) + { at(it.col()) = (*it); + } } @@ -533,6 +535,30 @@ template arma_inline subview_row +Row::cols(const span& col_span) + { + arma_extra_debug_sigprint(); + + return subvec(col_span); + } + + + +template +arma_inline +const subview_row +Row::cols(const span& col_span) const + { + arma_extra_debug_sigprint(); + + return subvec(col_span); + } + + + +template +arma_inline +subview_row Row::subvec(const span& col_span) { arma_extra_debug_sigprint(); @@ -852,6 +878,24 @@ template template +template +inline +Row::fixed::fixed(const fill::fill_class&) + : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) + { + arma_extra_debug_sigprint_this(this); + + if(is_same_type::yes) (*this).zeros(); + if(is_same_type::yes) (*this).ones(); + if(is_same_type::yes) (*this).eye(); + if(is_same_type::yes) (*this).randu(); + if(is_same_type::yes) (*this).randn(); + } + + + +template +template template arma_inline Row::fixed::fixed(const Base& A) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4539 From noreply at r-forge.r-project.org Sat Sep 28 08:22:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 08:22:57 +0200 (CEST) Subject: [Rcpp-commits] r4540 - in pkg/Rcpp: . inst/unitTests/cpp Message-ID: <20130928062257.A810B183E06@r-forge.r-project.org> Author: romain Date: 2013-09-28 08:22:57 +0200 (Sat, 28 Sep 2013) New Revision: 4540 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/unitTests/cpp/Module.cpp Log: new unit test, that intentionally fail for now. to be fixed Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-28 01:45:32 UTC (rev 4539) +++ pkg/Rcpp/ChangeLog 2013-09-28 06:22:57 UTC (rev 4540) @@ -1,3 +1,8 @@ +2013-09-28 Romain Francois + + * inst/unitTests/cpp/Module.cpp: Making sure Rcp is not released before this + is fixed + 2013-09-27 Dirk Eddelbuettel * vignettes/Rcpp-unitTests.Rnw: Re-activated vignette Modified: pkg/Rcpp/inst/unitTests/cpp/Module.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/Module.cpp 2013-09-28 01:45:32 UTC (rev 4539) +++ pkg/Rcpp/inst/unitTests/cpp/Module.cpp 2013-09-28 06:22:57 UTC (rev 4540) @@ -61,6 +61,8 @@ public: World() : msg("hello"){} void set(std::string msg_) { this->msg = msg_; } + void set_ref(std::string& msg_) { this->msg = msg_; } + void set_const_ref(const std::string& msg_) { this->msg = msg_; } std::string greet() { return msg; } private: @@ -155,6 +157,8 @@ .method( "greet", &World::greet ) .method( "set", &World::set ) + .method( "set_ref", &World::set_ref ) + .method( "set_const_ref", &World::set_const_ref ) .method( "clear", &clearWorld ) ; From noreply at r-forge.r-project.org Sat Sep 28 10:37:35 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 10:37:35 +0200 (CEST) Subject: [Rcpp-commits] r4541 - in pkg/Rcpp: . inst/include/Rcpp/module inst/unitTests Message-ID: <20130928083735.4AD18186348@r-forge.r-project.org> Author: romain Date: 2013-09-28 10:37:34 +0200 (Sat, 28 Sep 2013) New Revision: 4541 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppMethod.h pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h pkg/Rcpp/inst/unitTests/runit.Module.R Log: flexible semantics for method parameters Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-28 06:22:57 UTC (rev 4540) +++ pkg/Rcpp/ChangeLog 2013-09-28 08:37:34 UTC (rev 4541) @@ -1,8 +1,11 @@ 2013-09-28 Romain Francois - * inst/unitTests/cpp/Module.cpp: Making sure Rcp is not released before this - is fixed - + * include/Rcpp/module/Module_generated_CppMethod.h : more code bloat to handle + flexible semantics for passing parameters in methods + * include/Rcpp/module/Module_generated_Pointer_CppMethod.h : same + * inst/unitTests/cpp/Module.cpp: testing the above + * unitTests/runit.Module.R: testing + 2013-09-27 Dirk Eddelbuettel * vignettes/Rcpp-unitTests.Rnw: Re-activated vignette Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppMethod.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppMethod.h 2013-09-28 06:22:57 UTC (rev 4540) +++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppMethod.h 2013-09-28 08:37:34 UTC (rev 4541) @@ -2,7 +2,7 @@ // // Module_generated_CppMethod.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2010-2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010-2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -106,7 +106,8 @@ CppMethod1(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; + return Rcpp::module_wrap( (object->*met)( x0 ) ) ; } inline int nargs(){ return 1 ; } inline bool is_void(){ return false ; } @@ -124,7 +125,8 @@ CppMethod1( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; + (object->*met)( x0 ) ; return R_NilValue ; } inline int nargs(){ return 1 ; } @@ -147,7 +149,8 @@ const_CppMethod1(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; + return Rcpp::module_wrap( (object->*met)( x0 ) ) ; } inline int nargs(){ return 1 ; } inline bool is_void(){ return false ; } @@ -165,7 +168,8 @@ const_CppMethod1( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; + (object->*met)( x0 ) ; return R_NilValue ; } inline int nargs(){ return 1 ; } @@ -188,7 +192,9 @@ CppMethod2(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1 ) ) ; } inline int nargs(){ return 2 ; } inline bool is_void(){ return false ; } @@ -206,7 +212,9 @@ CppMethod2( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; + (object->*met)( x0, x1 ) ; return R_NilValue ; } inline int nargs(){ return 2 ; } @@ -229,7 +237,9 @@ const_CppMethod2(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1 ) ) ; } inline int nargs(){ return 2 ; } inline bool is_void(){ return false ; } @@ -247,7 +257,9 @@ const_CppMethod2( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; + (object->*met)( x0, x1 ) ; return R_NilValue ; } inline int nargs(){ return 2 ; } @@ -270,7 +282,10 @@ CppMethod3(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2 ) ) ; } inline int nargs(){ return 3 ; } inline bool is_void(){ return false ; } @@ -288,7 +303,10 @@ CppMethod3( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; + (object->*met)( x0, x1, x2 ) ; return R_NilValue ; } inline int nargs(){ return 3 ; } @@ -311,7 +329,10 @@ const_CppMethod3(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2 ) ) ; } inline int nargs(){ return 3 ; } inline bool is_void(){ return false ; } @@ -329,7 +350,10 @@ const_CppMethod3( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; + (object->*met)( x0, x1, x2 ) ; return R_NilValue ; } inline int nargs(){ return 3 ; } @@ -352,7 +376,11 @@ CppMethod4(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3 ) ) ; } inline int nargs(){ return 4 ; } inline bool is_void(){ return false ; } @@ -370,7 +398,11 @@ CppMethod4( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; + (object->*met)( x0, x1, x2, x3 ) ; return R_NilValue ; } inline int nargs(){ return 4 ; } @@ -393,7 +425,11 @@ const_CppMethod4(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3 ) ) ; } inline int nargs(){ return 4 ; } inline bool is_void(){ return false ; } @@ -411,7 +447,11 @@ const_CppMethod4( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; + (object->*met)( x0, x1, x2, x3 ) ; return R_NilValue ; } inline int nargs(){ return 4 ; } @@ -434,7 +474,12 @@ CppMethod5(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4 ) ) ; } inline int nargs(){ return 5 ; } inline bool is_void(){ return false ; } @@ -452,7 +497,12 @@ CppMethod5( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; + (object->*met)( x0, x1, x2, x3, x4 ) ; return R_NilValue ; } inline int nargs(){ return 5 ; } @@ -475,7 +525,12 @@ const_CppMethod5(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4 ) ) ; } inline int nargs(){ return 5 ; } inline bool is_void(){ return false ; } @@ -493,7 +548,12 @@ const_CppMethod5( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; + (object->*met)( x0, x1, x2, x3, x4 ) ; return R_NilValue ; } inline int nargs(){ return 5 ; } @@ -516,7 +576,13 @@ CppMethod6(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5 ) ) ; } inline int nargs(){ return 6 ; } inline bool is_void(){ return false ; } @@ -534,7 +600,13 @@ CppMethod6( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; + (object->*met)( x0, x1, x2, x3, x4, x5 ) ; return R_NilValue ; } inline int nargs(){ return 6 ; } @@ -557,7 +629,13 @@ const_CppMethod6(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5 ) ) ; } inline int nargs(){ return 6 ; } inline bool is_void(){ return false ; } @@ -575,7 +653,13 @@ const_CppMethod6( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; + (object->*met)( x0, x1, x2, x3, x4, x5 ) ; return R_NilValue ; } inline int nargs(){ return 6 ; } @@ -598,7 +682,14 @@ CppMethod7(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5, x6 ) ) ; } inline int nargs(){ return 7 ; } inline bool is_void(){ return false ; } @@ -616,7 +707,14 @@ CppMethod7( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; + (object->*met)( x0, x1, x2, x3, x4, x5, x6 ) ; return R_NilValue ; } inline int nargs(){ return 7 ; } @@ -639,7 +737,14 @@ const_CppMethod7(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5, x6 ) ) ; } inline int nargs(){ return 7 ; } inline bool is_void(){ return false ; } @@ -657,7 +762,14 @@ const_CppMethod7( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; + (object->*met)( x0, x1, x2, x3, x4, x5, x6 ) ; return R_NilValue ; } inline int nargs(){ return 7 ; } @@ -680,7 +792,15 @@ CppMethod8(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U7 >::type >( args[7] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; +typename Rcpp::traits::input_parameter< U7 >::type x7( args[7] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5, x6, x7 ) ) ; } inline int nargs(){ return 8 ; } inline bool is_void(){ return false ; } @@ -698,7 +818,15 @@ CppMethod8( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U7 >::type >( args[7] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; +typename Rcpp::traits::input_parameter< U7 >::type x7( args[7] ) ; + (object->*met)( x0, x1, x2, x3, x4, x5, x6, x7 ) ; return R_NilValue ; } inline int nargs(){ return 8 ; } @@ -721,7 +849,15 @@ const_CppMethod8(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - return Rcpp::module_wrap( (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U7 >::type >( args[7] ) ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; +typename Rcpp::traits::input_parameter< U3 >::type x3( args[3] ) ; +typename Rcpp::traits::input_parameter< U4 >::type x4( args[4] ) ; +typename Rcpp::traits::input_parameter< U5 >::type x5( args[5] ) ; +typename Rcpp::traits::input_parameter< U6 >::type x6( args[6] ) ; +typename Rcpp::traits::input_parameter< U7 >::type x7( args[7] ) ; + return Rcpp::module_wrap( (object->*met)( x0, x1, x2, x3, x4, x5, x6, x7 ) ) ; } inline int nargs(){ return 8 ; } inline bool is_void(){ return false ; } @@ -739,7 +875,15 @@ const_CppMethod8( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ - (object->*met)( Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U0 >::type >( args[0] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U1 >::type >( args[1] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U2 >::type >( args[2] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U3 >::type >( args[3] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U4 >::type >( args[4] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U5 >::type >( args[5] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U6 >::type >( args[6] ), Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U7 >::type >( args[7] ) ) ; + typename Rcpp::traits::input_parameter< U0 >::type x0( args[0] ) ; +typename Rcpp::traits::input_parameter< U1 >::type x1( args[1] ) ; +typename Rcpp::traits::input_parameter< U2 >::type x2( args[2] ) ; [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4541 From noreply at r-forge.r-project.org Sat Sep 28 10:38:37 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 10:38:37 +0200 (CEST) Subject: [Rcpp-commits] r4542 - scripts Message-ID: <20130928083837.46469186348@r-forge.r-project.org> Author: romain Date: 2013-09-28 10:38:36 +0200 (Sat, 28 Sep 2013) New Revision: 4542 Modified: scripts/DataFrame.R scripts/generator_Module_CppMethod.R scripts/generator_Module_PointerCppMethod.R Log: updated generators Modified: scripts/DataFrame.R =================================================================== --- scripts/DataFrame.R 2013-09-28 08:37:34 UTC (rev 4541) +++ scripts/DataFrame.R 2013-09-28 08:38:36 UTC (rev 4542) @@ -8,7 +8,7 @@ sprintf(' template <%s> static DataFrame create( %s ) { - return DataFrame( List::create( %s ) ) ; + return DataFrame::from_list( List::create( %s ) ) ; } ', paste( sprintf( "typename T%d", 1:i ), collapse = ", "), paste( sprintf( "const T%d& t%d", 1:i, 1:i ), collapse = ", "), Modified: scripts/generator_Module_CppMethod.R =================================================================== --- scripts/generator_Module_CppMethod.R 2013-09-28 08:37:34 UTC (rev 4541) +++ scripts/generator_Module_CppMethod.R 2013-09-28 08:38:36 UTC (rev 4542) @@ -3,11 +3,12 @@ fun <- function( i ){ index <- (1:i)-1 - collapse <- function(x) paste( x, collapse = ", " ) + collapse <- function(x, collapse = ", " ) paste( x, collapse = collapse ) typenames <- collapse( sprintf( "typename U%d", index ) ) u <- collapse( sprintf( "U%d u%d", index, index ) ) - as <- collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) ) + input_parameter <- collapse( sprintf( "typename Rcpp::traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), collapse = "\n" ) + x <- collapse( sprintf( "x%d", index ) ) U <- collapse( sprintf( "U%d", index ) ) txt <- sprintf( ' @@ -20,6 +21,7 @@ CppMethod%d(Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ + %s return Rcpp::module_wrap( (object->*met)( %s ) ) ; } inline int nargs(){ return %d ; } @@ -38,6 +40,7 @@ CppMethod%d( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ + %s (object->*met)( %s ) ; return R_NilValue ; } @@ -61,6 +64,7 @@ const_CppMethod%d(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ + %s return Rcpp::module_wrap( (object->*met)( %s ) ) ; } inline int nargs(){ return %d ; } @@ -79,6 +83,7 @@ const_CppMethod%d( Method m) : method_class(), met(m) {} SEXP operator()( Class* object, SEXP* args){ + %s (object->*met)( %s ) ; return R_NilValue ; } @@ -95,9 +100,10 @@ typenames, # typename U0, ... i, u, # U0 u0, ... +i, +input_parameter, +x, # Rcpp::as( args[0] ) , ... i, -as, # Rcpp::as( args[0] ) , ... -i, U, typenames, # typename U0, ... @@ -105,7 +111,8 @@ U, # U0, ... u, # U0 u0, ... i, -as, +input_parameter, +x, i, U, @@ -114,7 +121,8 @@ i, u, # U0 u0, ... i, -as, # Rcpp::as( args[0] ) , ... +input_parameter, +x, # Rcpp::as( args[0] ) , ... i, U, @@ -123,7 +131,8 @@ U, # U0, ... u, # U0 u0, ... i, -as, +input_parameter, +x, i, U @@ -136,7 +145,7 @@ // // Module_generated_CppMethod.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2010-2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010-2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // Modified: scripts/generator_Module_PointerCppMethod.R =================================================================== --- scripts/generator_Module_PointerCppMethod.R 2013-09-28 08:37:34 UTC (rev 4541) +++ scripts/generator_Module_PointerCppMethod.R 2013-09-28 08:38:36 UTC (rev 4542) @@ -3,11 +3,12 @@ fun <- function( i ){ index <- (1:i)-1 - collapse <- function(x) paste( x, collapse = ", " ) + collapse <- function(x, collapse = ", " ) paste( x, collapse = collapse ) typenames <- collapse( sprintf( "typename U%d", index ) ) u <- collapse( sprintf( "U%d u%d", index, index ) ) - as <- collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) ) + input_parameter <- collapse( sprintf( "typename Rcpp::traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), collapse = "\n" ) + x <- collapse( sprintf( "x%d", index ) ) U <- collapse( sprintf( "U%d", index ) ) txt <- sprintf( ' @@ -20,6 +21,7 @@ Pointer_CppMethod%d(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ + %s return Rcpp::module_wrap( met( object, %s ) ) ; } inline int nargs(){ return %d ; } @@ -38,7 +40,8 @@ Pointer_CppMethod%d( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ - met( object, %s ) ; + %s + met( object, %s ) ; return R_NilValue ; } inline int nargs(){ return %d ; } @@ -61,6 +64,7 @@ Const_Pointer_CppMethod%d(Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ + %s return Rcpp::module_wrap( met( object, %s ) ) ; } inline int nargs(){ return %d ; } @@ -79,6 +83,7 @@ Const_Pointer_CppMethod%d( Method m) : method_class(), met(m){} SEXP operator()( Class* object, SEXP* args){ + %s met( object, %s ) ; return R_NilValue ; } @@ -97,7 +102,8 @@ i, u, # U0 u0, ... i, -as, # Rcpp::as( args[0] ) , ... +input_parameter, +x, i, U, @@ -106,7 +112,8 @@ U, # U0, ... u, # U0 u0, ... i, -as, +input_parameter, +x, i, U, @@ -116,7 +123,8 @@ i, u, # U0 u0, ... i, -as, # Rcpp::as( args[0] ) , ... +input_parameter, +x, i, U, @@ -125,7 +133,8 @@ U, # U0, ... u, # U0 u0, ... i, -as, +input_parameter, +x, i, U From noreply at r-forge.r-project.org Sat Sep 28 17:16:23 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 17:16:23 +0200 (CEST) Subject: [Rcpp-commits] r4543 - scripts testlogs Message-ID: <20130928151623.82F90185CF0@r-forge.r-project.org> Author: edd Date: 2013-09-28 17:16:23 +0200 (Sat, 28 Sep 2013) New Revision: 4543 Added: testlogs/Rcpp-Summary-20130928.R testlogs/result-20130928-094524.RData testlogs/result-20130928-094524.txt Modified: scripts/runRcppDepends.r Log: test results -- 0.10.5 is ready Modified: scripts/runRcppDepends.r =================================================================== --- scripts/runRcppDepends.r 2013-09-28 08:38:36 UTC (rev 4542) +++ scripts/runRcppDepends.r 2013-09-28 15:16:23 UTC (rev 4543) @@ -9,13 +9,17 @@ rcppset <- sort(unname(AP[unique(c(grep("Rcpp", as.character(AP[,"Depends"])), grep("Rcpp", as.character(AP[,"LinkingTo"])), grep("Rcpp", as.character(AP[,"Imports"])))),"Package"])) -if (grep("transnet", rcppset)) { - print( rcppset[ ! grepl("transnet", rcppset) ]) -} else { - print( rcppset ) +if (grep("transnet", rcppset)) { ## not really an Rcpp user + rcppset <- rcppset[ ! grepl("transnet", rcppset) ] } +#if (grep("BioGeoBears", rcppset)) { ## indirect match, no need to test +# rcppset <- rcppset[ ! grepl("BioGeoBears", rcppset) ] +#} +if (grep("quadrupen", rcppset)) { ## takes hours, skipping + rcppset <- rcppset[ ! grepl("quadrupen", rcppset) ] +} +print( rcppset ) -rcppset <- rcppset res <- data.frame(pkg=rcppset, res=NA) #for (pi in 1:nrow(res)) { Added: testlogs/Rcpp-Summary-20130928.R =================================================================== --- testlogs/Rcpp-Summary-20130928.R (rev 0) +++ testlogs/Rcpp-Summary-20130928.R 2013-09-28 15:16:23 UTC (rev 4543) @@ -0,0 +1,80 @@ + +## results here are edited after a second run following manual +## installation of a number of package missing in the first run + +## loads 'res' +#load("~/svn/rcpp/testlogs/result-20130928-094524.RData") + +## Good: dput(as.character(subset(res, res==0, pkg)[,1,drop=TRUE])) +goodPkg <- c("accelerometry", "acer", "AdaptiveSparsity", "ALKr", "Amelia", + "apcluster", "BayesComm", "bcp", "bfa", "bfp", "bifactorial", + "blockcluster", "ccaPP", "cda", "cladoRcpp", "clogitL1", "clusteval", + "ConConPiWiFun", "coneproj", "Delaporte", "ecp", "EpiContactTrace", + "fastGHQuad", "FastPCS", "FastRCS", "FBFsearch", "fdaMixed", + "forecast", "gRbase", "gRim", "growcurves", "GSE", "GUTS", "HLMdiag", + "httpuv", "inarmix", "jaatha", "Kmisc", "maxent", "minqa", "MPTinR", + "msgl", "multmod", "mvabund", "MVB", "NetSim", "NetworkAnalysis", + "oem", "phom", "phylobase", "planar", "prospectr", "psgp", "Rankcluster", + "RcppArmadillo", "RcppBDT", "rcppbugs", "RcppClassic", "RcppClassicExamples", + "RcppCNPy", "RcppDE", "RcppEigen", "RcppExamples", "RcppGSL", + "RcppOctave", "RcppProgress", "RcppRoll", "RcppSMC", "RcppXts", + "rexpokit", "rforensicbatwing", "rgam", "RInside", "Rmalschains", + "RMessenger", "rmgarch", "Rmixmod", "robustgam", "robustHD", + "rococo", "rotations", "RProtoBuf", "RQuantLib", "RSNNS", "RSofia", + "rugarch", "RVowpalWabbit", "SBSA", "sdcMicro", "sequences", + "simFrame", "sparseHessianFD", "sparseLTSEigen", "SpatialTools", + "stochvol", "survSNP", "tagcloud", "termstrc", "tmg", "transmission", + "trustOptim", "unmarked", "VIM", "waffect", "WideLM", "wordcloud", + "zic") + +## Bad: dput(as.character(subset(res, res==1, pkg)[,1,drop=TRUE])) +badPkg <- c("ALDqr", "CDM", "classify", "climdex.pcic", "diversitree", + "ExactNumCI", "fugeR", "Funclustering", "geiger", "GeneticTools", + "gMWT", "GOsummaries", "KernSmoothIRT", "LaF", "lme4", "marked", + "mets", "mirt", "miscF", "ngspatial", "openair", "orQA", "PReMiuM", + "sdcTable", "sirt", "spacodiR", "surveillance", "TAM", "tbart") + +bad4missing <- c("ALDqr", # 'HyperbolicDist? + "CDM", # sirt, TAM + "classify", # ?R2WinBUGS? ?R2jags? + "climdex.pcic", # 'PCIct' + "diversitree", # ?deSolve? ?subplex? + "fugeR", # snowfall + "Funclustering", # fda + "geiger", # ?msm? ?subplex? ?deSolve? ?coda? ?ncbit? + "GeneticTools", # ?gMWT? ?snpStats? + "gMWT", # ?clinfun? + "GOsummaries", # ?gProfileR? ?limma? + "LaF", # 'yaml' + "lme4", # MEMSS + "marked", # ?optimx? ?coda? ?R2admb? + "mets", # ?lava? ?timereg? ?prodlim? + "mirt", # ?GPArotation? + "miscF", # ?MCMCpack? + "ngspatial", # ?batchmeans? + "openair", # ?latticeExtra? ?hexbin? ?RgoogleMaps? ?png? ?mapdata? + "orQA", # ?genefilter? + "PReMiuM", # ?clue? + "sdcTable", # ?lpSolveAPI? + "sirt", # ?pbivnorm? ?sfsmisc? + "spacodiR", # ?picante? + "surveillance", # ?spatstat? + "TAM", # ?tensor? ?sfsmisc? ?GPArotation? ?psych? + "tbart") # ?GISTools? + +bad4rcpp <- c() # Yay! + +## these fail initially but can all be run with some extra effort +bad4notrcpp <- c("ExactNumCI", # needs BOOSTLIB defined, bad src/ file + "KernSmoothIRT") # rgl failed, needs full x11 session +good <- length(goodPkg) +bad <- length(bad4missing) + length(bad4rcpp) + length(bad4notrcpp) +stopifnot(all.equal(bad,length(badPkg))) ## account for GeoBIO + +cat("Good ", good, "\n") +cat("Bad ", bad, "\n") +cat(" RcppErr ", length(bad4rcpp), "\n") +cat(" MissDep ", length(bad4missing), "\n") +cat(" NotRcpp ", length(bad4notrcpp), "\n") +cat("Total ", good + bad, "\n") +cat("Error Pct ", length(bad4rcpp) / (good + bad), "\n") Added: testlogs/result-20130928-094524.RData =================================================================== (Binary files differ) Property changes on: testlogs/result-20130928-094524.RData ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: testlogs/result-20130928-094524.txt =================================================================== --- testlogs/result-20130928-094524.txt (rev 0) +++ testlogs/result-20130928-094524.txt 2013-09-28 15:16:23 UTC (rev 4543) @@ -0,0 +1,138 @@ +"pkg","res" +"1","accelerometry",0 +"2","acer",0 +"3","AdaptiveSparsity",0 +"4","ALDqr",1 +"5","ALKr",0 +"6","Amelia",0 +"7","apcluster",0 +"8","BayesComm",0 +"9","bcp",0 +"10","bfa",0 +"11","bfp",0 +"12","bifactorial",0 +"13","BioGeoBEARS",1 +"14","blockcluster",0 +"15","ccaPP",0 +"16","cda",0 +"17","CDM",1 +"18","cladoRcpp",0 +"19","classify",1 +"20","climdex.pcic",1 +"21","clogitL1",0 +"22","clusteval",0 +"23","ConConPiWiFun",0 +"24","coneproj",0 +"25","Delaporte",0 +"26","diversitree",1 +"27","ecp",0 +"28","EpiContactTrace",0 +"29","ExactNumCI",1 +"30","fastGHQuad",0 +"31","FastPCS",0 +"32","FastRCS",0 +"33","FBFsearch",0 +"34","fdaMixed",0 +"35","forecast",0 +"36","fugeR",1 +"37","Funclustering",1 +"38","geiger",1 +"39","GeneticTools",1 +"40","gMWT",1 +"41","GOsummaries",1 +"42","gRbase",0 +"43","gRim",0 +"44","growcurves",0 +"45","GSE",0 +"46","GUTS",0 +"47","HLMdiag",0 +"48","httpuv",0 +"49","inarmix",0 +"50","jaatha",0 +"51","KernSmoothIRT",1 +"52","Kmisc",0 +"53","LaF",1 +"54","lme4",1 +"55","marked",1 +"56","maxent",0 +"57","mets",1 +"58","minqa",0 +"59","mirt",1 +"60","miscF",1 +"61","MPTinR",0 +"62","msgl",0 +"63","multmod",0 +"64","mvabund",0 +"65","MVB",0 +"66","NetSim",0 +"67","NetworkAnalysis",0 +"68","ngspatial",1 +"69","oem",0 +"70","openair",1 +"71","orQA",1 +"72","phom",0 +"73","phylobase",0 +"74","planar",0 +"75","PReMiuM",1 +"76","prospectr",0 +"77","psgp",0 +"78","Rankcluster",0 +"79","RcppArmadillo",0 +"80","RcppBDT",0 +"81","rcppbugs",0 +"82","RcppClassic",0 +"83","RcppClassicExamples",0 +"84","RcppCNPy",0 +"85","RcppDE",0 +"86","RcppEigen",0 +"87","RcppExamples",0 +"88","RcppGSL",0 +"89","RcppOctave",0 +"90","RcppProgress",0 +"91","RcppRoll",0 +"92","RcppSMC",0 +"93","RcppXts",0 +"94","rexpokit",0 +"95","rforensicbatwing",0 +"96","rgam",0 +"97","RInside",0 +"98","Rmalschains",0 +"99","RMessenger",0 +"100","rmgarch",0 +"101","Rmixmod",0 +"102","robustgam",0 +"103","robustHD",0 +"104","rococo",0 +"105","rotations",0 +"106","RProtoBuf",0 +"107","RQuantLib",0 +"108","RSNNS",0 +"109","RSofia",0 +"110","rugarch",0 +"111","RVowpalWabbit",0 +"112","SBSA",0 +"113","sdcMicro",0 +"114","sdcTable",1 +"115","sequences",0 +"116","simFrame",0 +"117","sirt",1 +"118","spacodiR",1 +"119","sparseHessianFD",0 +"120","sparseLTSEigen",0 +"121","SpatialTools",0 +"122","stochvol",0 +"123","surveillance",1 +"124","survSNP",0 +"125","tagcloud",0 +"126","TAM",1 +"127","tbart",1 +"128","termstrc",0 +"129","tmg",0 +"130","transmission",0 +"131","trustOptim",0 +"132","unmarked",0 +"133","VIM",0 +"134","waffect",0 +"135","WideLM",0 +"136","wordcloud",0 +"137","zic",0 From noreply at r-forge.r-project.org Sat Sep 28 17:33:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 17:33:31 +0200 (CEST) Subject: [Rcpp-commits] r4544 - scripts Message-ID: <20130928153331.8C8F0184511@r-forge.r-project.org> Author: edd Date: 2013-09-28 17:33:31 +0200 (Sat, 28 Sep 2013) New Revision: 4544 Modified: scripts/runBuild.sh Log: updated to inst/doc -> vignettes/ move Modified: scripts/runBuild.sh =================================================================== --- scripts/runBuild.sh 2013-09-28 15:16:23 UTC (rev 4543) +++ scripts/runBuild.sh 2013-09-28 15:33:31 UTC (rev 4544) @@ -57,8 +57,8 @@ export RunAllRcppTests="yes" -## remove old pdf vignettes and make fresh ones -cd Rcpp/inst/doc && make pdfclean && make pdfall && cd - +## remove old pdf vignettes and make fresh ones -- no longer needed with vignette scheme +## cd Rcpp/inst/doc && make pdfclean && make pdfall && cd - R CMD build --force Rcpp @@ -70,4 +70,4 @@ test -d ~/www/code/rcpp && cp -vax Rcpp_${version}.tar.gz ~/www/code/rcpp fi -echo "Done with $encodedversion -- $version" \ No newline at end of file +echo "Done with $encodedversion -- $version" From noreply at r-forge.r-project.org Sat Sep 28 17:56:33 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 17:56:33 +0200 (CEST) Subject: [Rcpp-commits] r4545 - scripts Message-ID: <20130928155633.6D6F818635E@r-forge.r-project.org> Author: edd Date: 2013-09-28 17:56:33 +0200 (Sat, 28 Sep 2013) New Revision: 4545 Modified: scripts/runDoxygenAndZip.sh Log: also updated to inst/doc -> vignettes/ move Modified: scripts/runDoxygenAndZip.sh =================================================================== --- scripts/runDoxygenAndZip.sh 2013-09-28 15:33:31 UTC (rev 4544) +++ scripts/runDoxygenAndZip.sh 2013-09-28 15:56:33 UTC (rev 4545) @@ -45,8 +45,13 @@ cd ${cwd} if [ -d ~/www/code/rcpp/ ]; then - cp -vax Rcpp/inst/doc/Rcpp-*.pdf ~/www/code/rcpp + cd ~/www/code/rcpp/ + tarball=`ls -1tr Rcpp_*.tar.gz|tail -1` + #cp -vax Rcpp/inst/doc/Rcpp-*.pdf ~/www/code/rcpp + tar xvzf ${tarball} "Rcpp/inst/doc/" + mv -v Rcpp/inst/doc/*.pdf . + rm -rf Rcpp/ fi cd ${cwd} -fi \ No newline at end of file +fi From noreply at r-forge.r-project.org Sat Sep 28 19:21:45 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 19:21:45 +0200 (CEST) Subject: [Rcpp-commits] r4546 - pkg/Rcpp/inst/unitTests Message-ID: <20130928172145.E9D1718636F@r-forge.r-project.org> Author: edd Date: 2013-09-28 19:21:45 +0200 (Sat, 28 Sep 2013) New Revision: 4546 Modified: pkg/Rcpp/inst/unitTests/runit.Vector.R Log: re-indent to make it plain that the last few tests (which were added since 0.10.4) are executed conditionally of 'are we doing CRAN testing or not' Modified: pkg/Rcpp/inst/unitTests/runit.Vector.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.Vector.R 2013-09-28 15:56:33 UTC (rev 4545) +++ pkg/Rcpp/inst/unitTests/runit.Vector.R 2013-09-28 17:21:45 UTC (rev 4546) @@ -22,671 +22,670 @@ if (.runThisTest) { -.setUp <- Rcpp:::unit_test_setup("Vector.cpp") + .setUp <- Rcpp:::unit_test_setup("Vector.cpp") -test.RawVector <- function(){ - funx <- raw_ - checkEquals( funx(), as.raw(0:9), msg = "RawVector(int)" ) -} + test.RawVector <- function(){ + funx <- raw_ + checkEquals( funx(), as.raw(0:9), msg = "RawVector(int)" ) + } -test.RawVector.REALSXP <- function(){ - funx <- raw_REALSXP - checkEquals( funx(as.raw(0:9)), as.raw(2*0:9), msg = "RawVector( RAWSXP) " ) -} + test.RawVector.REALSXP <- function(){ + funx <- raw_REALSXP + checkEquals( funx(as.raw(0:9)), as.raw(2*0:9), msg = "RawVector( RAWSXP) " ) + } -test.ExpressionVector <- function(){ - funx <- expression_ - ex <- parse( text = "rnorm; rnorm(10)" ) - # get rid of the srcref stuff so that we can compare - # more easily - attributes(ex) <- NULL - checkEquals( funx(), ex , msg = "ExpressionVector" ) -} + test.ExpressionVector <- function(){ + funx <- expression_ + ex <- parse( text = "rnorm; rnorm(10)" ) + # get rid of the srcref stuff so that we can compare + # more easily + attributes(ex) <- NULL + checkEquals( funx(), ex , msg = "ExpressionVector" ) + } -test.ExpressionVector.variadic <- function(){ - funx <- expression_variadic - ex <- parse( text = "rnorm; rnorm(10)" ) - attributes(ex) <- NULL - checkEquals( funx(), ex , msg = "ExpressionVector (using variadic templates) " ) -} + test.ExpressionVector.variadic <- function(){ + funx <- expression_variadic + ex <- parse( text = "rnorm; rnorm(10)" ) + attributes(ex) <- NULL + checkEquals( funx(), ex , msg = "ExpressionVector (using variadic templates) " ) + } -test.ExpressionVector.parse <- function( ){ - funx <- expression_parse - code <- funx() - results <- eval( code ) - checkEquals( results, 1:10, msg = "ExpressionVector parsing" ) -} + test.ExpressionVector.parse <- function( ){ + funx <- expression_parse + code <- funx() + results <- eval( code ) + checkEquals( results, 1:10, msg = "ExpressionVector parsing" ) + } -test.ExpressionVector.parse.error <- function(){ - funx <- expression_parseerror - checkException( funx(), msg = "parse error" ) -} + test.ExpressionVector.parse.error <- function(){ + funx <- expression_parseerror + checkException( funx(), msg = "parse error" ) + } -test.ExpressionVector.eval <- function(){ - funx <- expression_eval - checkEquals( funx(), 1:10, msg = "ExpressionVector::eval" ) -} + test.ExpressionVector.eval <- function(){ + funx <- expression_eval + checkEquals( funx(), 1:10, msg = "ExpressionVector::eval" ) + } -test.ExpressionVector.eval.env <- function(){ - funx <- expression_evalenv - e <- new.env() - e[["x"]] <- sample(1:10) - checkEquals( funx(e), 1:10, msg = "ExpressionVector::eval in specific environment" ) -} + test.ExpressionVector.eval.env <- function(){ + funx <- expression_evalenv + e <- new.env() + e[["x"]] <- sample(1:10) + checkEquals( funx(e), 1:10, msg = "ExpressionVector::eval in specific environment" ) + } -test.ComplexVector <- function(){ - funx <- complex_ - checkEquals( funx(), 0:9*(1+1i), msg = "ComplexVector" ) -} -test.ComplexVector.CPLXSXP <- function(){ - funx <- complex_CPLXSXP - vv = (0:9)*(1+1i) ## not working - funx changes its argument - #checkEquals( funx(vv), 2*vv, msg = "ComplexVector( CPLXSXP) " ) - checkEquals( funx((0:9)*(1+1i)), 2*(0:9)*(1+1i), msg = "ComplexVector( CPLXSXP) " ) -} -test.ComplexVector.INTSXP <- function(){ - funx <- complex_INTSXP - vv <- 0L:9L - checkEquals( funx(vv), (2+0i)*vv, msg = "ComplexVector( INTSXP) " ) -} -test.ComplexVector.REALSXP <- function(){ - funx <- complex_REALSXP - vv <- as.numeric(0:9) - checkEquals( funx(vv), (3+0i)*vv, msg = "ComplexVector( REALSXP) " ) -} + test.ComplexVector <- function(){ + funx <- complex_ + checkEquals( funx(), 0:9*(1+1i), msg = "ComplexVector" ) + } + test.ComplexVector.CPLXSXP <- function(){ + funx <- complex_CPLXSXP + vv = (0:9)*(1+1i) ## not working - funx changes its argument + #checkEquals( funx(vv), 2*vv, msg = "ComplexVector( CPLXSXP) " ) + checkEquals( funx((0:9)*(1+1i)), 2*(0:9)*(1+1i), msg = "ComplexVector( CPLXSXP) " ) + } + test.ComplexVector.INTSXP <- function(){ + funx <- complex_INTSXP + vv <- 0L:9L + checkEquals( funx(vv), (2+0i)*vv, msg = "ComplexVector( INTSXP) " ) + } + test.ComplexVector.REALSXP <- function(){ + funx <- complex_REALSXP + vv <- as.numeric(0:9) + checkEquals( funx(vv), (3+0i)*vv, msg = "ComplexVector( REALSXP) " ) + } -test.IntegerVector <- function(){ - fun <- integer_ctor - checkEquals( fun(), 0:9, msg = "IntegerVector" ) -} + test.IntegerVector <- function(){ + fun <- integer_ctor + checkEquals( fun(), 0:9, msg = "IntegerVector" ) + } -test.IntegerVector.INTSXP_ <- function(){ - fun <- integer_INTSXP - checkEquals( fun(0:9), 2*0:9, msg = "IntegerVector( INTSXP) " ) -} + test.IntegerVector.INTSXP_ <- function(){ + fun <- integer_INTSXP + checkEquals( fun(0:9), 2*0:9, msg = "IntegerVector( INTSXP) " ) + } -test.IntegerVector.Dimension.constructor <- function(){ - fun <- integer_dimension_ctor_1 - checkEquals(fun(), - integer(5) , - msg = "IntegerVector( Dimension(5))" ) + test.IntegerVector.Dimension.constructor <- function(){ + fun <- integer_dimension_ctor_1 + checkEquals(fun(), + integer(5) , + msg = "IntegerVector( Dimension(5))" ) - fun <- integer_dimension_ctor_2 - checkEquals(fun(), - matrix( 0L, ncol = 5, nrow = 5) , - msg = "IntegerVector( Dimension(5,5))" ) + fun <- integer_dimension_ctor_2 + checkEquals(fun(), + matrix( 0L, ncol = 5, nrow = 5) , + msg = "IntegerVector( Dimension(5,5))" ) - fun <- integer_dimension_ctor_3 - checkEquals(fun(), - array( 0L, dim = c(2,3,4) ) , - msg = "IntegerVector( Dimension(2,3,4))" ) -} + fun <- integer_dimension_ctor_3 + checkEquals(fun(), + array( 0L, dim = c(2,3,4) ) , + msg = "IntegerVector( Dimension(2,3,4))" ) + } -test.IntegerVector.range.constructors <- function(){ - fun <- integer_range_ctor_1 - checkEquals( fun(), 0:3, msg = "assign(int*, int*)" ) + test.IntegerVector.range.constructors <- function(){ + fun <- integer_range_ctor_1 + checkEquals( fun(), 0:3, msg = "assign(int*, int*)" ) - fun <- integer_range_ctor_2 - checkEquals( fun(), 0:3, msg = "assign(int*, int*)" ) -} + fun <- integer_range_ctor_2 + checkEquals( fun(), 0:3, msg = "assign(int*, int*)" ) + } -test.IntegerVector.names.set <- function(){ - fun <- integer_names_set - checkEquals(names(fun()), c("foo", "bar"), msg = "Vector::names" ) -} + test.IntegerVector.names.set <- function(){ + fun <- integer_names_set + checkEquals(names(fun()), c("foo", "bar"), msg = "Vector::names" ) + } -test.IntegerVector.names.get <- function(){ - fun <- integer_names_get - checkEquals(fun( c("foo" = 1L, "bar" = 2L) ), - c("foo", "bar"), - msg = "Vector::names get" ) -} + test.IntegerVector.names.get <- function(){ + fun <- integer_names_get + checkEquals(fun( c("foo" = 1L, "bar" = 2L) ), + c("foo", "bar"), + msg = "Vector::names get" ) + } -test.IntegerVector.names.indexing <- function(){ - fun <- integer_names_indexing - x <- c( "foo" = 1L, "bar" = 2L ) - checkEquals( fun( x ), 1L, msg = "IntegerVector names based indexing" ) -} + test.IntegerVector.names.indexing <- function(){ + fun <- integer_names_indexing + x <- c( "foo" = 1L, "bar" = 2L ) + checkEquals( fun( x ), 1L, msg = "IntegerVector names based indexing" ) + } -test.IntegerVector.comma <- function(){ - fun <- integer_comma - checkEquals( fun(), 0:3, msg = "IntegerVector comma initialization" ) -} + test.IntegerVector.comma <- function(){ + fun <- integer_comma + checkEquals( fun(), 0:3, msg = "IntegerVector comma initialization" ) + } -test.IntegerVector.push.back <- function(){ - fun <- integer_push_back - checkEquals( fun(1:4), 1:5, msg = "IntegerVector push back" ) + test.IntegerVector.push.back <- function(){ + fun <- integer_push_back + checkEquals( fun(1:4), 1:5, msg = "IntegerVector push back" ) - x <- 1:4 - names(x) <- letters[1:4] + x <- 1:4 + names(x) <- letters[1:4] - target <- 1:5 - names(target) <- c( letters[1:4], "") - checkEquals( fun(x), target, msg = "IntegerVector push back names" ) -} + target <- 1:5 + names(target) <- c( letters[1:4], "") + checkEquals( fun(x), target, msg = "IntegerVector push back names" ) + } -test.IntegerVector.push.front <- function(){ - fun <- integer_push_front - checkEquals( fun(1:4), c(5L,1:4), msg = "IntegerVector push front" ) + test.IntegerVector.push.front <- function(){ + fun <- integer_push_front + checkEquals( fun(1:4), c(5L,1:4), msg = "IntegerVector push front" ) - x <- 1:4 - names(x) <- letters[1:4] + x <- 1:4 + names(x) <- letters[1:4] - target <- c( 5L, 1:4 ) - names(target) <- c( "", letters[1:4]) + target <- c( 5L, 1:4 ) + names(target) <- c( "", letters[1:4]) - checkEquals( fun(x), target, msg = "IntegerVector push front names" ) -} + checkEquals( fun(x), target, msg = "IntegerVector push front names" ) + } -test.IntegerVector.insert <- function(){ - fun <- integer_insert - checkEquals( fun(1:4), c(5L,1L, 7L, 2:4), msg = "IntegerVector insert" ) + test.IntegerVector.insert <- function(){ + fun <- integer_insert + checkEquals( fun(1:4), c(5L,1L, 7L, 2:4), msg = "IntegerVector insert" ) - x <- 1:4 - names(x) <- letters[1:4] + x <- 1:4 + names(x) <- letters[1:4] - target <- c( 5L, 1L, 7L, 2:4 ) - names(target) <- c( "", "a", "", letters[2:4]) + target <- c( 5L, 1L, 7L, 2:4 ) + names(target) <- c( "", "a", "", letters[2:4]) - checkEquals( fun(x), target, msg = "IntegerVector insert names" ) -} + checkEquals( fun(x), target, msg = "IntegerVector insert names" ) + } -test.IntegerVector.erase <- function(){ - fun <- integer_erase - checkEquals( fun(1:4), c(1L, 2L, 4L), msg = "IntegerVector erase" ) + test.IntegerVector.erase <- function(){ + fun <- integer_erase + checkEquals( fun(1:4), c(1L, 2L, 4L), msg = "IntegerVector erase" ) - x <- 1:4 - names(x) <- letters[1:4] + x <- 1:4 + names(x) <- letters[1:4] - target <- c(1L, 2L, 4L) - names(target) <- c( "a", "b", "d" ) + target <- c(1L, 2L, 4L) + names(target) <- c( "a", "b", "d" ) - checkEquals( fun(x), target, msg = "IntegerVector erase" ) -} + checkEquals( fun(x), target, msg = "IntegerVector erase" ) + } -test.IntegerVector.erase.range <- function(){ - x <- y <- 1:10 - names(y) <- letters[1:10] - res <- integer_erase_range( x, y ) - checkEquals( res[[1L]], c(1:5, 10L) , msg = "IntegerVector erase range unnamed" ) + test.IntegerVector.erase.range <- function(){ + x <- y <- 1:10 + names(y) <- letters[1:10] + res <- integer_erase_range( x, y ) + checkEquals( res[[1L]], c(1:5, 10L) , msg = "IntegerVector erase range unnamed" ) - z <- y[-(6:9)] - checkEquals( res[[2L]], z , msg = "IntegerVector erase range named" ) -} + z <- y[-(6:9)] + checkEquals( res[[2L]], z , msg = "IntegerVector erase range named" ) + } -test.IntegerVector.erase.range.2 <- function(){ - x <- y <- 1:10 - names(y) <- letters[1:10] - res <- integer_erase_range_2( x, y ) - checkEquals( res[[1L]], 1L , msg = "IntegerVector erase range 2 unnamed" ) - checkEquals( res[[2L]], c("a" = 1L ) , msg = "IntegerVector erase range 2 named" ) -} + test.IntegerVector.erase.range.2 <- function(){ + x <- y <- 1:10 + names(y) <- letters[1:10] + res <- integer_erase_range_2( x, y ) + checkEquals( res[[1L]], 1L , msg = "IntegerVector erase range 2 unnamed" ) + checkEquals( res[[2L]], c("a" = 1L ) , msg = "IntegerVector erase range 2 named" ) + } -test.IntegerVector.erase.range.2 <- function(){ - x <- y <- as.list(1:10) - names(y) <- letters[1:10] - res <- List_erase_range_2( x, y ) - checkEquals( res[[1L]], list( 1L ) , msg = "List erase range 2 unnamed" ) - checkEquals( res[[2L]], list("a" = 1L ) , msg = "List erase range 2 named" ) -} + test.IntegerVector.erase.range.2 <- function(){ + x <- y <- as.list(1:10) + names(y) <- letters[1:10] + res <- List_erase_range_2( x, y ) + checkEquals( res[[1L]], list( 1L ) , msg = "List erase range 2 unnamed" ) + checkEquals( res[[2L]], list("a" = 1L ) , msg = "List erase range 2 named" ) + } -test.IntegerVector.erase2 <- function(){ - checkEquals( integer_erase2(1:4), c(1L, 3L, 4L), msg = "IntegerVector erase2" ) + test.IntegerVector.erase2 <- function(){ + checkEquals( integer_erase2(1:4), c(1L, 3L, 4L), msg = "IntegerVector erase2" ) - x <- 1:4 - names(x) <- letters[1:4] + x <- 1:4 + names(x) <- letters[1:4] - target <- c(1L, 3L, 4L) - names(target) <- c( "a", "c", "d" ) + target <- c(1L, 3L, 4L) + names(target) <- c( "a", "c", "d" ) - checkEquals( integer_erase2(x), target, msg = "IntegerVector erase2" ) -} + checkEquals( integer_erase2(x), target, msg = "IntegerVector erase2" ) + } -test.IntegerVector.fill <- function(){ - fun <- integer_fill - x <- 1:10 - checkEquals( fun(x), rep(10L, 10 ), msg = "IntegerVector.fill" ) -} + test.IntegerVector.fill <- function(){ + fun <- integer_fill + x <- 1:10 + checkEquals( fun(x), rep(10L, 10 ), msg = "IntegerVector.fill" ) + } -test.IntegerVector.zero <- function( ){ - fun <- integer_zero - checkEquals( fun(), integer(0), msg = "IntegerVector(0)" ) -} + test.IntegerVector.zero <- function( ){ + fun <- integer_zero + checkEquals( fun(), integer(0), msg = "IntegerVector(0)" ) + } -test.IntegerVector.create.zero <- function( ){ - fun <- integer_create_zero - checkEquals( fun(), integer(0), msg = "IntegerVector::create()" ) -} + test.IntegerVector.create.zero <- function( ){ + fun <- integer_create_zero + checkEquals( fun(), integer(0), msg = "IntegerVector::create()" ) + } -test.IntegerVector.create <- function(){ - fun <- integer_create_ - checkEquals( fun(), list( c( 10L, 20L) , c(foo = 20L, bar = 30L) ), - msg = "IntegerVector::create" ) -} + test.IntegerVector.create <- function(){ + fun <- integer_create_ + checkEquals( fun(), list( c( 10L, 20L) , c(foo = 20L, bar = 30L) ), + msg = "IntegerVector::create" ) + } -test.IntegerVector.clone <- function(){ - x <- 1:10 - fun <- integer_clone_ - y <- fun(x) - checkEquals( x, 1:10, msg = "clone" ) - checkEquals( y, 10:1, msg = "clone" ) -} + test.IntegerVector.clone <- function(){ + x <- 1:10 + fun <- integer_clone_ + y <- fun(x) + checkEquals( x, 1:10, msg = "clone" ) + checkEquals( y, 10:1, msg = "clone" ) + } -test.NumericVector <- function(){ - funx <- numeric_ - checkEquals( funx(), as.numeric(0:9), msg = "NumericVector(int)" ) -} + test.NumericVector <- function(){ + funx <- numeric_ + checkEquals( funx(), as.numeric(0:9), msg = "NumericVector(int)" ) + } -test.NumericVector.REALSXP <- function(){ - funx <- numeric_REALSXP - checkEquals( funx(as.numeric(0:9)), 2*0:9, msg = "NumericVector( REALSXP) " ) -} + test.NumericVector.REALSXP <- function(){ + funx <- numeric_REALSXP + checkEquals( funx(as.numeric(0:9)), 2*0:9, msg = "NumericVector( REALSXP) " ) + } -test.NumericVector.import <- function(){ - funx <- numeric_import - checkEquals( funx(), 0:9, msg = "IntegerVector::import" ) -} + test.NumericVector.import <- function(){ + funx <- numeric_import + checkEquals( funx(), 0:9, msg = "IntegerVector::import" ) + } -test.NumericVector.import.transform <- function(){ - funx <- numeric_importtransform - checkEquals( funx(), (0:9)^2, msg = "NumericVector::import_transform" ) -} + test.NumericVector.import.transform <- function(){ + funx <- numeric_importtransform + checkEquals( funx(), (0:9)^2, msg = "NumericVector::import_transform" ) + } -test.List <- function(){ - fun <- list_ctor - checkEquals( fun(), as.list( 2*0:9), msg = "GenericVector" ) -} + test.List <- function(){ + fun <- list_ctor + checkEquals( fun(), as.list( 2*0:9), msg = "GenericVector" ) + } -test.List.template <- function(){ - fun <- list_template_ - checkEquals(fun(), list( "foo", 10L, 10.2, FALSE), msg = "GenericVector" ) -} + test.List.template <- function(){ + fun <- list_template_ + checkEquals(fun(), list( "foo", 10L, 10.2, FALSE), msg = "GenericVector" ) + } -test.List.VECSXP <- function(){ - fun <- list_VECSXP_ - checkEquals( fun(list(1,2)), list(1,2), msg = "GenericVector( VECSXP) " ) -} + test.List.VECSXP <- function(){ + fun <- list_VECSXP_ + checkEquals( fun(list(1,2)), list(1,2), msg = "GenericVector( VECSXP) " ) + } -test.List.matrix.indexing <- function(){ - fun <- list_matrix_indexing_1 - ## a matrix of integer vectors - x <- structure( lapply( 1:16, function(x) seq.int(x) ), dim = c( 4, 4) ) - checkEquals( fun(x), diag(x), msg = "matrix indexing 1" ) + test.List.matrix.indexing <- function(){ + fun <- list_matrix_indexing_1 + ## a matrix of integer vectors + x <- structure( lapply( 1:16, function(x) seq.int(x) ), dim = c( 4, 4) ) + checkEquals( fun(x), diag(x), msg = "matrix indexing 1" ) - fun <- list_matrix_indexing_2 - checkEquals(diag(fun(x)), rep(list("foo"), 4) , msg = "matrix indexing lhs" ) + fun <- list_matrix_indexing_2 + checkEquals(diag(fun(x)), rep(list("foo"), 4) , msg = "matrix indexing lhs" ) - ## drop dimensions - dim(x) <- NULL - checkException( fun(x) , msg = "not a matrix" ) -} + ## drop dimensions + dim(x) <- NULL + checkException( fun(x) , msg = "not a matrix" ) + } -test.List.Dimension.constructor <- function(){ - fun <- list_Dimension_constructor_1 - checkEquals(fun(), - rep(list(NULL),5) , - msg = "List( Dimension(5))" ) + test.List.Dimension.constructor <- function(){ + fun <- list_Dimension_constructor_1 + checkEquals(fun(), + rep(list(NULL),5) , + msg = "List( Dimension(5))" ) - fun <- list_Dimension_constructor_2 - checkEquals(fun(), - structure( rep( list(NULL), 25), dim = c(5,5) ), - msg = "List( Dimension(5,5))" ) + fun <- list_Dimension_constructor_2 + checkEquals(fun(), + structure( rep( list(NULL), 25), dim = c(5,5) ), + msg = "List( Dimension(5,5))" ) - fun <- list_Dimension_constructor_3 - checkEquals(fun(), - array( rep(list(NULL)), dim = c(2,3,4) ) , - msg = "List( Dimension(2,3,4))" ) -} + fun <- list_Dimension_constructor_3 + checkEquals(fun(), + array( rep(list(NULL)), dim = c(2,3,4) ) , + msg = "List( Dimension(2,3,4))" ) + } -test.List.iterator <- function() { - fun <- list_iterator_ - data <- list( x = letters, y = LETTERS, z = 1:4 ) - checkEquals(fun( data, length ), - list( x = 26L, y = 26L, z = 4L), - msg = "c++ version of lapply" ) -} + test.List.iterator <- function() { + fun <- list_iterator_ + data <- list( x = letters, y = LETTERS, z = 1:4 ) + checkEquals(fun( data, length ), + list( x = 26L, y = 26L, z = 4L), + msg = "c++ version of lapply" ) + } -test.List.name.indexing <- function(){ - fun <- list_name_indexing - d <- data.frame( x = 1:10, y = letters[1:10] ) - checkEquals( fun( d ), sum(1:10), msg = "List names based indexing" ) -} + test.List.name.indexing <- function(){ + fun <- list_name_indexing + d <- data.frame( x = 1:10, y = letters[1:10] ) + checkEquals( fun( d ), sum(1:10), msg = "List names based indexing" ) + } -test.List.push.back <- function(){ - fun <- list_push_back - d <- list( x = 1:10, y = letters[1:10] ) - checkEquals(fun( d ), - list( x = 1:10, y = letters[1:10], 10L, foo = "bar" ), - msg = "List.push_back" ) -} + test.List.push.back <- function(){ + fun <- list_push_back + d <- list( x = 1:10, y = letters[1:10] ) + checkEquals(fun( d ), + list( x = 1:10, y = letters[1:10], 10L, foo = "bar" ), + msg = "List.push_back" ) + } -test.List.push.front <- function(){ - fun <- list_push_front - d <- list( x = 1:10, y = letters[1:10] ) - checkEquals(fun(d), - list( foo = "bar", 10L, x = 1:10, y = letters[1:10] ), - msg = "List.push_front" ) -} + test.List.push.front <- function(){ + fun <- list_push_front + d <- list( x = 1:10, y = letters[1:10] ) + checkEquals(fun(d), + list( foo = "bar", 10L, x = 1:10, y = letters[1:10] ), + msg = "List.push_front" ) + } -test.List.erase <- function(){ - fun <- list_erase - d <- list( x = 1:10, y = letters[1:10] ) - checkEquals(fun(d), - list( y = letters[1:10] ), - msg = "List.erase" ) -} + test.List.erase <- function(){ + fun <- list_erase + d <- list( x = 1:10, y = letters[1:10] ) + checkEquals(fun(d), + list( y = letters[1:10] ), + msg = "List.erase" ) + } -test.List.erase.range <- function(){ - fun <- list_erase_range - d <- list( x = 1:10, y = letters[1:10], z = 1:10 ) - checkEquals(fun(d), - list( z = 1:10 ), - msg = "List.erase (range version)" ) -} + test.List.erase.range <- function(){ + fun <- list_erase_range + d <- list( x = 1:10, y = letters[1:10], z = 1:10 ) + checkEquals(fun(d), + list( z = 1:10 ), + msg = "List.erase (range version)" ) + } -test.List.implicit.push.back <- function(){ - fun <- list_implicit_push_back - checkEquals( fun(), list( foo = 10, bar = "foobar" ), msg = "List implicit push back" ) -} + test.List.implicit.push.back <- function(){ + fun <- list_implicit_push_back + checkEquals( fun(), list( foo = 10, bar = "foobar" ), msg = "List implicit push back" ) + } -test.List.create <- function(){ - fun <- list_create_ - checkEquals( fun(), list( list( 10L, "foo" ), list(foo = 10L, bar = TRUE ) ), - msg = "List::create" ) -} + test.List.create <- function(){ + fun <- list_create_ + checkEquals( fun(), list( list( 10L, "foo" ), list(foo = 10L, bar = TRUE ) ), + msg = "List::create" ) + } -test.List.stdcomplex <- function(){ - fun <- list_stdcomplex - checkEquals( - fun(), - list( float = rep(0+0i, 10), double = rep(0+0i, 10) ), - msg = "range wrap over std::complex" ) -} + test.List.stdcomplex <- function(){ + fun <- list_stdcomplex + checkEquals( + fun(), + list( float = rep(0+0i, 10), double = rep(0+0i, 10) ), + msg = "range wrap over std::complex" ) + } -test.CharacterVector <- function(){ - fun <- character_ctor - checkEquals( fun(), rep("foo",10L), msg = "CharacterVector" ) -} + test.CharacterVector <- function(){ + fun <- character_ctor + checkEquals( fun(), rep("foo",10L), msg = "CharacterVector" ) + } -test.CharacterVector.STRSXP <- function(){ - fun <- character_STRSXP_ - checkEquals( fun(letters), paste(letters,collapse="" ), msg = "CharacterVector( STRSXP) " ) -} + test.CharacterVector.STRSXP <- function(){ + fun <- character_STRSXP_ + checkEquals( fun(letters), paste(letters,collapse="" ), msg = "CharacterVector( STRSXP) " ) + } -test.CharacterVector.plusequals <- function(){ - fun <- character_plusequals - checkEquals( fun(), c("foobar", "barfoobar"), msg = "StringProxy::operator+=" ) -} + test.CharacterVector.plusequals <- function(){ + fun <- character_plusequals + checkEquals( fun(), c("foobar", "barfoobar"), msg = "StringProxy::operator+=" ) + } -test.CharacterVector.matrix.indexing <- function() { - fun <- character_matrix_indexing - x <- matrix( as.character(1:16), ncol = 4 ) - checkEquals( fun(x), paste(diag(x), collapse = ""), msg = "matrix indexing" ) + test.CharacterVector.matrix.indexing <- function() { + fun <- character_matrix_indexing + x <- matrix( as.character(1:16), ncol = 4 ) + checkEquals( fun(x), paste(diag(x), collapse = ""), msg = "matrix indexing" ) - y <- as.vector( x ) - checkException( fun(y) , msg = "not a matrix" ) + y <- as.vector( x ) + checkException( fun(y) , msg = "not a matrix" ) - fun <- character_matrix_indexing_lhs - checkEquals( diag(fun(x)), rep("foo", 4) , msg = "matrix indexing lhs" ) -} + fun <- character_matrix_indexing_lhs + checkEquals( diag(fun(x)), rep("foo", 4) , msg = "matrix indexing lhs" ) + } -test.CharacterVector.matrix.row.iteration <- function() { - x <- matrix(letters[1:16], nrow = 4) + test.CharacterVector.matrix.row.iteration <- function() { + x <- matrix(letters[1:16], nrow = 4) - fun <- character_matrix_row_iteration_incr - checkEquals( fun(x), "bfjn", msg = "matrix row iteration post-incr" ) + fun <- character_matrix_row_iteration_incr + checkEquals( fun(x), "bfjn", msg = "matrix row iteration post-incr" ) - fun <- character_matrix_row_iteration_decr - checkEquals( fun(x), "njf", msg = "matrix row iteration post-decr" ) -} + fun <- character_matrix_row_iteration_decr + checkEquals( fun(x), "njf", msg = "matrix row iteration post-decr" ) + } -test.CharacterVector.assign <- function(){ - fun <- character_assign1 - checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) + test.CharacterVector.assign <- function(){ + fun <- character_assign1 + checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) - fun <- character_assign2 - checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) + fun <- character_assign2 + checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) -} + } -test.CharacterVector.range.constructors <- function(){ - fun <- character_range_ctor1 - checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) + test.CharacterVector.range.constructors <- function(){ + fun <- character_range_ctor1 + checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) - fun <- character_range_ctor2 - checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) -} + fun <- character_range_ctor2 + checkEquals( fun(), c("foo", "bar", "bling", "boom"), msg = "assign(char**, char**)" ) + } -test.CharacterVector.Dimension.constructor <- function(){ - fun <- character_dimension_ctor1 - checkEquals(fun(), - character(5), - msg = "CharacterVector( Dimension(5))" ) + test.CharacterVector.Dimension.constructor <- function(){ + fun <- character_dimension_ctor1 + checkEquals(fun(), + character(5), + msg = "CharacterVector( Dimension(5))" ) - fun <- character_dimension_ctor2 - checkEquals(fun(), - matrix( "", ncol = 5, nrow = 5), - msg = "CharacterVector( Dimension(5,5))" ) + fun <- character_dimension_ctor2 + checkEquals(fun(), + matrix( "", ncol = 5, nrow = 5), + msg = "CharacterVector( Dimension(5,5))" ) - fun <- character_dimension_ctor3 - checkEquals(fun(), - array( "", dim = c(2,3,4) ) , - msg = "CharacterVector( Dimension(2,3,4))" ) -} + fun <- character_dimension_ctor3 + checkEquals(fun(), + array( "", dim = c(2,3,4) ) , + msg = "CharacterVector( Dimension(2,3,4))" ) + } -test.CharacterVector.iterator <- function(){ - fun <- character_iterator1 - checkEquals(fun(letters), - paste(letters, collapse=""), - msg = "CharacterVector::iterator explicit looping" ) + test.CharacterVector.iterator <- function(){ + fun <- character_iterator1 + checkEquals(fun(letters), + paste(letters, collapse=""), + msg = "CharacterVector::iterator explicit looping" ) - fun <- character_iterator2 - checkEquals(fun(letters), - paste(letters, collapse=""), - msg = "CharacterVector::iterator using std::accumulate" ) -} + fun <- character_iterator2 + checkEquals(fun(letters), + paste(letters, collapse=""), + msg = "CharacterVector::iterator using std::accumulate" ) + } -test.CharacterVector.reverse <- function(){ - fun <- character_reverse - x <- c("foo", "bar", "bling") - x <- fun(x) - checkEquals( x, c("bling", "bar", "foo"), msg = "reverse" ) - x <- fun(x) - checkEquals( x, c("foo", "bar", "bling"), msg = "reverse" ) -} + test.CharacterVector.reverse <- function(){ + fun <- character_reverse + x <- c("foo", "bar", "bling") + x <- fun(x) + checkEquals( x, c("bling", "bar", "foo"), msg = "reverse" ) + x <- fun(x) + checkEquals( x, c("foo", "bar", "bling"), msg = "reverse" ) + } -test.CharacterVector.names.indexing <- function(){ - fun <- character_names_indexing - x <- c( foo = "foo", bar = "bar" ) - checkEquals( fun(x), "foo", msg = "CharacterVector names based indexing" ) -} + test.CharacterVector.names.indexing <- function(){ + fun <- character_names_indexing + x <- c( foo = "foo", bar = "bar" ) + checkEquals( fun(x), "foo", msg = "CharacterVector names based indexing" ) + } -test.CharacterVector.comma <- function(){ - fun <- character_comma - checkEquals( fun(), c("foo","bar", "bling" ), msg = "CharacterVector comma operator" ) -} + test.CharacterVector.comma <- function(){ + fun <- character_comma + checkEquals( fun(), c("foo","bar", "bling" ), msg = "CharacterVector comma operator" ) + } -test.CharacterVector.listOf <- function() { - fun <- character_listOf - checkEquals(fun(list(foo=c("tic","tac","toe"), - bar=c("Eenie","Meenie","Moe"))), - list(foo="tictactoe", bar="EenieMeenieMoe"), - msg="CharacterVector from list") -} + test.CharacterVector.listOf <- function() { + fun <- character_listOf + checkEquals(fun(list(foo=c("tic","tac","toe"), + bar=c("Eenie","Meenie","Moe"))), + list(foo="tictactoe", bar="EenieMeenieMoe"), + msg="CharacterVector from list") + } -test.CharacterVector.find <- function(){ - fun <- character_find_ - checkEquals( fun( c("bar", "foo", "bob") ), 1L, msg = "support for std::find in CharacterVector" ) -} + test.CharacterVector.find <- function(){ + fun <- character_find_ + checkEquals( fun( c("bar", "foo", "bob") ), 1L, msg = "support for std::find in CharacterVector" ) + } -test.CharacterVector.create <- function(){ - fun <- character_create_ - checkEquals( fun(), list( c( "foo", "bar" ), c(foo = "bar", bar = "foo" ) ), - msg = "CharacterVector::create" ) -} + test.CharacterVector.create <- function(){ + fun <- character_create_ + checkEquals( fun(), list( c( "foo", "bar" ), c(foo = "bar", bar = "foo" ) ), + msg = "CharacterVector::create" ) + } -test.ComplexVector.binary.operators <- function(){ - fun <- complex_binary_sugar - x <- (1+1i) * 1:10 - y <- (2-3i) * 1:10 + test.ComplexVector.binary.operators <- function(){ + fun <- complex_binary_sugar + x <- (1+1i) * 1:10 + y <- (2-3i) * 1:10 - checkEquals( - fun(x, y), - list( - "+" = x + y, - "-" = x - y, - "*" = x * y, - "/" = x / y - ), msg = "complex binary operators" ) -} + checkEquals( + fun(x, y), + list( + "+" = x + y, + "-" = x - y, + "*" = x * y, + "/" = x / y + ), msg = "complex binary operators" ) + } [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4546 From noreply at r-forge.r-project.org Sat Sep 28 19:49:51 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 19:49:51 +0200 (CEST) Subject: [Rcpp-commits] r4547 - in pkg/Rcpp: . debian inst inst/include/Rcpp vignettes Message-ID: <20130928174951.91B8C183B9C@r-forge.r-project.org> Author: edd Date: 2013-09-28 19:49:51 +0200 (Sat, 28 Sep 2013) New Revision: 4547 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/debian/changelog pkg/Rcpp/debian/control pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/config.h pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw Log: Rcpp release 0.10.5 Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/ChangeLog 2013-09-28 17:49:51 UTC (rev 4547) @@ -1,11 +1,21 @@ +2013-09-28 Dirk Eddelbuettel + + * DESCRIPTION: Release 0.10.5 + * inst/NEWS.Rd: Release 0.10.5 + * inst/include/Rcpp/config.h: Release 0.10.5 + * debian/*: Similarly updated for new release to Debian + + * vignettes/Rcpp-unitTests.Rnw: Switched to Charter font just like + the other eight vignettes + 2013-09-28 Romain Francois - * include/Rcpp/module/Module_generated_CppMethod.h : more code bloat to handle - flexible semantics for passing parameters in methods - * include/Rcpp/module/Module_generated_Pointer_CppMethod.h : same + * include/Rcpp/module/Module_generated_CppMethod.h : more code bloat + to handle flexible semantics for passing parameters in methods + * include/Rcpp/module/Module_generated_Pointer_CppMethod.h : same * inst/unitTests/cpp/Module.cpp: testing the above - * unitTests/runit.Module.R: testing - + * unitTests/runit.Module.R: testing + 2013-09-27 Dirk Eddelbuettel * vignettes/Rcpp-unitTests.Rnw: Re-activated vignette @@ -13,11 +23,11 @@ 2013-09-27 Romain Francois - * include/Rcpp/module/Module_generated_CppFunction.h : regenerated to + * include/Rcpp/module/Module_generated_CppFunction.h : regenerated to use input_parameter traits for more flexible parameter passing strategy * unitTests/cpp/Module.cpp : more testing - * unitTests/runit.Module.R : more testing - + * unitTests/runit.Module.R : more testing + 2013-09-22 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/diff.h: Declare set_previous Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/DESCRIPTION 2013-09-28 17:49:51 UTC (rev 4547) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.4.6 +Version: 0.10.5 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire @@ -37,7 +37,7 @@ package development. Attributes are built on top of Rcpp modules and their implementation is based on previous work in the inline package. . - Many examples are included, and around 881 unit tests in 412 unit + Many examples are included, and around 872 unit tests in 422 unit test functions provide additional usage examples. . An earlier version of Rcpp, containing what we now call the 'classic Rcpp Modified: pkg/Rcpp/debian/changelog =================================================================== --- pkg/Rcpp/debian/changelog 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/debian/changelog 2013-09-28 17:49:51 UTC (rev 4547) @@ -1,3 +1,11 @@ +rcpp (0.10.5-1) unstable; urgency=low + + * New release + + * debian/control: Set Build-Depends: to current R version + + -- Dirk Eddelbuettel Sat, 28 Sep 2013 07:28:48 -0500 + rcpp (0.10.4-1) unstable; urgency=low * New release Modified: pkg/Rcpp/debian/control =================================================================== --- pkg/Rcpp/debian/control 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/debian/control 2013-09-28 17:49:51 UTC (rev 4547) @@ -2,7 +2,7 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.1), cdbs +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.2), cdbs Standards-Version: 3.9.4 Homepage: http://dirk.eddelbuettel.com/code/rcpp.html @@ -43,7 +43,7 @@ package development. Attributes are built on top of Rcpp modules and their implementation is based on previous work in the inline package. . - Many examples are included, and around 881 unit tests in 412 unit + Many examples are included, and around 872 unit tests in 422 unit test functions provide additional usage examples. . An earlier version of Rcpp, containing what we now call the 'classic Rcpp Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/inst/NEWS.Rd 2013-09-28 17:49:51 UTC (rev 4547) @@ -2,7 +2,7 @@ \title{News for Package 'Rcpp'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{Changes in Rcpp version 0.10.5 (future)}{ +\section{Changes in Rcpp version 0.10.5 (2013-09-28)}{ \itemize{ \item Changes in R code: \itemize{ Modified: pkg/Rcpp/inst/include/Rcpp/config.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/config.h 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/inst/include/Rcpp/config.h 2013-09-28 17:49:51 UTC (rev 4547) @@ -25,7 +25,7 @@ #define Rcpp_Version(v,p,s) (((v) * 65536) + ((p) * 256) + (s)) // All three digits have to be integers for g++-4.7 or later -#define RCPP_VERSION Rcpp_Version(0,10,4) +#define RCPP_VERSION Rcpp_Version(0,10,5) // Rcpp 0.10.3 has initial support for new preserve/release semantics // This switch enables a rollback to the standard R preserve/release semantics Modified: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-09-28 17:21:45 UTC (rev 4546) +++ pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-09-28 17:49:51 UTC (rev 4547) @@ -6,8 +6,9 @@ \usepackage{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} -\RequirePackage{ae,mathpple} % ae as a default font pkg works with Sweave -\RequirePackage[T1]{fontenc} +\usepackage{microtype} %% cf http://www.khirevich.com/latex/microtype/ +\usepackage[T1]{fontenc} %% cf http://www.khirevich.com/latex/font/ +\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/ <>= require(Rcpp) From noreply at r-forge.r-project.org Sat Sep 28 20:38:32 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 20:38:32 +0200 (CEST) Subject: [Rcpp-commits] r4548 - pkg/RcppArmadillo/vignettes Message-ID: <20130928183832.E049F184F87@r-forge.r-project.org> Author: edd Date: 2013-09-28 20:38:32 +0200 (Sat, 28 Sep 2013) New Revision: 4548 Removed: pkg/RcppArmadillo/vignettes/unitTests-results/ Log: do not keep unit test results in svn From noreply at r-forge.r-project.org Sat Sep 28 20:40:27 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 20:40:27 +0200 (CEST) Subject: [Rcpp-commits] r4549 - pkg/RcppArmadillo Message-ID: <20130928184027.6167F184F87@r-forge.r-project.org> Author: edd Date: 2013-09-28 20:40:27 +0200 (Sat, 28 Sep 2013) New Revision: 4549 Modified: pkg/RcppArmadillo/cleanup Log: also prune vignettes on cleanup Modified: pkg/RcppArmadillo/cleanup =================================================================== --- pkg/RcppArmadillo/cleanup 2013-09-28 18:38:32 UTC (rev 4548) +++ pkg/RcppArmadillo/cleanup 2013-09-28 18:40:27 UTC (rev 4549) @@ -10,6 +10,7 @@ vignettes/RcppArmadillo*.aux \ vignettes/RcppArmadillo*.out \ vignettes/RcppArmadillo*.tex \ + vignettes/RcppArmadillo-*.pdf \ vignettes/*.blg \ vignettes/*.bbl \ vignettes/*~ \ From noreply at r-forge.r-project.org Sat Sep 28 21:03:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 28 Sep 2013 21:03:31 +0200 (CEST) Subject: [Rcpp-commits] r4550 - pkg/RcppArmadillo Message-ID: <20130928190331.B12BA183D86@r-forge.r-project.org> Author: edd Date: 2013-09-28 21:03:31 +0200 (Sat, 28 Sep 2013) New Revision: 4550 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION Log: RcppArmadillo release 0.3.920.1 Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-28 18:40:27 UTC (rev 4549) +++ pkg/RcppArmadillo/ChangeLog 2013-09-28 19:03:31 UTC (rev 4550) @@ -1,10 +1,12 @@ -2013-09-27 Dirk Eddelbuettel +2013-09-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.920.1 * inst/NEWS: Release 0.3.920.1 * inst/include/*: Upgraded to new release 3.920.1 of Armadillo * debian/*: Similarly updated for new release to Debian + * DESCRIPTION: Depends on Rcpp (>= 0.10.5) which shipped to CRAN + 2013-09-27 Romain Francois * include/RcppArmadilloAs.h : handle cx_mat, using that Rcomplex is Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-09-28 18:40:27 UTC (rev 4549) +++ pkg/RcppArmadillo/DESCRIPTION 2013-09-28 19:03:31 UTC (rev 4550) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.920.0 +Version: 0.3.920.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel @@ -21,7 +21,7 @@ (due to speed and/or integration capabilities), rather than another language. . The RcppArmadillo package includes the header files from the templated - Armadillo library (currently version 3.920.0). Thus users do not need to + Armadillo library (currently version 3.920.1). Thus users do not need to install Armadillo itself in order to use RcppArmadillo. . This Armadillo integration provides a nice illustration of the @@ -32,7 +32,7 @@ or later, as is the rest of Rcpp. License: GPL (>= 2) LazyLoad: yes -Depends: R (>= 2.14.0), Rcpp (>= 0.10.4.4) +Depends: R (>= 2.14.0), Rcpp (>= 0.10.5) LinkingTo: Rcpp Suggests: RUnit URL: http://arma.sourceforge.net/, http://dirk.eddelbuettel.com/code/rcpp.armadillo.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/RcppArmadillo From noreply at r-forge.r-project.org Mon Sep 30 03:05:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 30 Sep 2013 03:05:04 +0200 (CEST) Subject: [Rcpp-commits] r4551 - pkg/RcppArmadillo/debian Message-ID: <20130930010504.2AD3518010D@r-forge.r-project.org> Author: edd Date: 2013-09-30 03:05:03 +0200 (Mon, 30 Sep 2013) New Revision: 4551 Modified: pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/debian/control Log: require Rcpp 0.10.5 for Debian builds as well Modified: pkg/RcppArmadillo/debian/changelog =================================================================== --- pkg/RcppArmadillo/debian/changelog 2013-09-28 19:03:31 UTC (rev 4550) +++ pkg/RcppArmadillo/debian/changelog 2013-09-30 01:05:03 UTC (rev 4551) @@ -1,8 +1,10 @@ -r-cran-rcpparmadillo (0.3.920.0-1) unstable; urgency=low +r-cran-rcpparmadillo (0.3.920.1-1) unstable; urgency=low * New upstream release + + * debian/control: Tightened Build-Depends on r-cran-rcpp to (>= 0.10.5) - -- Dirk Eddelbuettel Thu, 26 Sep 2013 14:27:51 -0500 + -- Dirk Eddelbuettel Sun, 29 Sep 2013 16:03:43 -0500 r-cran-rcpparmadillo (0.3.910.0-1) unstable; urgency=low Modified: pkg/RcppArmadillo/debian/control =================================================================== --- pkg/RcppArmadillo/debian/control 2013-09-28 19:03:31 UTC (rev 4550) +++ pkg/RcppArmadillo/debian/control 2013-09-30 01:05:03 UTC (rev 4551) @@ -2,7 +2,7 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.1), r-cran-rcpp, cdbs +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.1), r-cran-rcpp (>= 0.10.5), cdbs Standards-Version: 3.9.4 Homepage: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html From noreply at r-forge.r-project.org Mon Sep 30 03:05:26 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 30 Sep 2013 03:05:26 +0200 (CEST) Subject: [Rcpp-commits] r4552 - in pkg/RcppArmadillo: . inst/examples Message-ID: <20130930010526.4BCBD18010D@r-forge.r-project.org> Author: edd Date: 2013-09-30 03:05:25 +0200 (Mon, 30 Sep 2013) New Revision: 4552 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/examples/fastLm.r pkg/RcppArmadillo/inst/examples/varSimulation.r Log: use 'const ref' in two example files Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-09-30 01:05:03 UTC (rev 4551) +++ pkg/RcppArmadillo/ChangeLog 2013-09-30 01:05:25 UTC (rev 4552) @@ -1,3 +1,9 @@ +2013-09-29 Dirk Eddelbuettel + + * inst/examples/fastLm.r: Added a 'const ref' example + * inst/examples/varSimulation.r: Use 'const ref', skip one + superfluous transpose + 2013-09-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.920.1 Modified: pkg/RcppArmadillo/inst/examples/fastLm.r =================================================================== --- pkg/RcppArmadillo/inst/examples/fastLm.r 2013-09-30 01:05:03 UTC (rev 4551) +++ pkg/RcppArmadillo/inst/examples/fastLm.r 2013-09-30 01:05:25 UTC (rev 4552) @@ -67,7 +67,28 @@ ' cppFunction(code=src, depends="RcppArmadillo") +src <- ' +Rcpp::List fLmConstRef(const arma::mat & X, const arma::colvec & y) { + int df = X.n_rows - X.n_cols; + // fit model y ~ X, extract residuals + arma::colvec coef = arma::solve(X, y); + arma::colvec res = y - X*coef; + + double s2 = std::inner_product(res.begin(), res.end(), + res.begin(), 0.0)/df; + // std.errors of coefficients + arma::colvec sderr = arma::sqrt(s2 * + arma::diagvec(arma::pinv(arma::trans(X)*X))); + + return Rcpp::List::create(Rcpp::Named("coefficients")=coef, + Rcpp::Named("stderr") =sderr, + Rcpp::Named("df") =df); +} +' +cppFunction(code=src, depends="RcppArmadillo") + + fastLmPureDotCall <- function(X, y) { .Call("fastLm", X, y, PACKAGE = "RcppArmadillo") } @@ -79,6 +100,7 @@ res <- benchmark(fLmOneCast(X, y), # inline'd above fLmTwoCasts(X, y), # inline'd above + fLmConstRef(X, y), # inline'd above fastLmPure(X, y), # similar, but with 2 error checks fastLmPureDotCall(X, y), # now without the 2 error checks fastLm(frm, data=trees), # using model matrix @@ -89,4 +111,4 @@ order="relative", replications=5000) -print(res) +print(res[,1:4]) Modified: pkg/RcppArmadillo/inst/examples/varSimulation.r =================================================================== --- pkg/RcppArmadillo/inst/examples/varSimulation.r 2013-09-30 01:05:03 UTC (rev 4551) +++ pkg/RcppArmadillo/inst/examples/varSimulation.r 2013-09-30 01:05:25 UTC (rev 4552) @@ -52,13 +52,13 @@ ## C++ variant: code passed as a text variable ... code <- ' -arma::mat rcppSim(arma::mat coeff, arma::mat errors) { +arma::mat rcppSim(const arma::mat& coeff, const arma::mat& errors) { int m = errors.n_rows; int n = errors.n_cols; arma::mat simdata(m,n); simdata.row(0) = arma::zeros(1,n); for (int row=1; row