From noreply at r-forge.r-project.org Thu Aug 1 00:00:27 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 00:00:27 +0200 (CEST) Subject: [Rcpp-commits] r4409 - in pkg/RcppArmadillo: . debian inst inst/include inst/include/armadillo_bits Message-ID: <20130731220028.09B991813EE@r-forge.r-project.org> Author: edd Date: 2013-08-01 00:00:27 +0200 (Thu, 01 Aug 2013) New Revision: 4409 Added: pkg/RcppArmadillo/.Rbuildignore pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/include/armadillo pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_meat.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/compiler_setup.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/memory.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/xvec_htrans_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/xvec_htrans_meat.hpp Log: RcppArmadillo 0.3.900.7 with Armadillo 3.900.7 Added .Rbuildignore to exclude debian/ directory from CRAN tarballs Added: pkg/RcppArmadillo/.Rbuildignore =================================================================== --- pkg/RcppArmadillo/.Rbuildignore (rev 0) +++ pkg/RcppArmadillo/.Rbuildignore 2013-07-31 22:00:27 UTC (rev 4409) @@ -0,0 +1 @@ +debian Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/ChangeLog 2013-07-31 22:00:27 UTC (rev 4409) @@ -1,3 +1,10 @@ +2013-07-31 Dirk Eddelbuettel + + * DESCRIPTION: Release 0.3.900.7 + * inst/NEWS: Release 0.3.900.7 + * inst/include/*: Upgraded to new release 3.900.7 of Armadillo + * debian/*: Similarly updated for new release to Debian + 2013-07-12 Dirk Eddelbuettel * inst/unitTests/runTests.R: No longer need to test minimal versions Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/DESCRIPTION 2013-07-31 22:00:27 UTC (rev 4409) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.900.0 +Version: 0.3.900.7 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.900.0). Thus users do not need to + Armadillo library (currently version 3.900.7). 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-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/debian/changelog 2013-07-31 22:00:27 UTC (rev 4409) @@ -1,3 +1,9 @@ +r-cran-rcpparmadillo (0.3.900.7-1) unstable; urgency=low + + * New upstream release + + -- Dirk Eddelbuettel Wed, 31 Jul 2013 16:40:01 -0500 + r-cran-rcpparmadillo (0.3.900.0-1) unstable; urgency=low * New upstream release Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-07-31 22:00:27 UTC (rev 4409) @@ -2,10 +2,17 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{Changes in RcppArmadillo version 0.3.abc (2013-xx-yy)}{ +\section{Changes in RcppArmadillo version 0.3.900.7 (2013-07-31)}{ \itemize{ + \item Upgraded to Armadillo release Version 3.900.7 (Bavarian + Sunflower) + \itemize{ + \item minor fix for inplace \code{reshape()} + \item minor corrections for compilation issues under GCC 4.8+ and MSVC + } \item The \pkg{inline} package is no longer used in the examples and - unit tests which have all been converted to Rcpp attributes use + unit tests which have all been converted to using Rcpp attributes + } } \section{Changes in RcppArmadillo version 0.3.900 (2013-06-04)}{ Modified: pkg/RcppArmadillo/inst/include/armadillo =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo 2013-07-31 22:00:27 UTC (rev 4409) @@ -534,6 +534,9 @@ #include "armadillo_bits/spglue_minus_meat.hpp" #include "armadillo_bits/spglue_times_meat.hpp" } - + + + +#include "armadillo_bits/compiler_setup_post.hpp" + #endif - Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -46,7 +46,7 @@ arma_aligned const eT* const mem; //!< pointer to the memory used by the cube (memory is read-only) protected: - arma_aligned Mat* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; + arma_align_mem Mat* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -20,6 +20,7 @@ typedef typename get_pod_type::result pod_type; static const bool prefer_at_accessor = false; + static const bool is_simple = (is_same_type::value) || (is_same_type::value); arma_aligned const uword n_rows; arma_aligned const uword n_cols; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -20,6 +20,7 @@ typedef typename get_pod_type::result pod_type; static const bool prefer_at_accessor = (is_same_type::value) ? true : false; + static const bool is_simple = (is_same_type::value) || (is_same_type::value); static const bool is_row = T1::is_row; static const bool is_col = T1::is_col; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -22,10 +22,6 @@ typedef eT elem_type; //!< the type of elements stored in the matrix typedef typename get_pod_type::result pod_type; //!< if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex - static const bool is_col = false; - static const bool is_row = false; - - const uword n_rows; //!< number of rows in the matrix (read-only) const uword n_cols; //!< number of columns in the matrix (read-only) const uword n_elem; //!< number of elements in the matrix (read-only) @@ -45,6 +41,9 @@ public: + static const bool is_col = false; + static const bool is_row = false; + inline ~Mat(); inline Mat(); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -279,7 +279,7 @@ template arma_inline bool is_alias(const Mat&) const { return false; } - arma_inline bool is_aligned() const { return false; } + arma_inline bool is_aligned() const { return Gen::is_simple; } }; @@ -1459,6 +1459,52 @@ +template +class Proxy< xvec_htrans > + { + public: + + typedef eT elem_type; + typedef typename get_pod_type::result pod_type; + typedef Mat stored_type; + typedef const eT* ea_type; + typedef const Mat& aligned_ea_type; + + static const bool prefer_at_accessor = false; + static const bool has_subview = false; + static const bool is_fixed = false; + static const bool fake_mat = false; + + static const bool is_row = false; + static const bool is_col = false; + + arma_aligned const Mat Q; + + inline explicit Proxy(const xvec_htrans& A) + : Q(A) + { + arma_extra_debug_sigprint(); + } + + arma_inline uword get_n_rows() const { return Q.n_rows; } + arma_inline uword get_n_cols() const { return Q.n_cols; } + arma_inline uword get_n_elem() const { return Q.n_elem; } + + arma_inline elem_type operator[] (const uword i) const { return Q[i]; } + arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row,col); } + arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } + + arma_inline ea_type get_ea() const { return Q.memptr(); } + arma_inline aligned_ea_type get_aligned_ea() const { return Q; } + + template + arma_inline bool is_alias(const Mat& X) const { return false; } + + arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } + }; + + + template class Proxy< subview_elem1 > { Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -99,7 +99,7 @@ arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); } - arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } + arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } @@ -107,7 +107,7 @@ template arma_inline bool is_alias(const Cube&) const { return false; } - arma_inline bool is_aligned() const { return false; } + arma_inline bool is_aligned() const { return GenCube::is_simple; } }; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -3199,7 +3199,7 @@ eop_aux_randu::fill( access::rwp(values), n_nonzero ); - uvec indices = linspace( 0, in_rows*in_cols-1, n_nonzero ); + uvec indices = linspace( 0u, in_rows*in_cols-1, n_nonzero ); // perturb the indices for(uword i=1; i < n_nonzero-1; ++i) @@ -3276,7 +3276,7 @@ eop_aux_randn::fill( access::rwp(values), n_nonzero ); - uvec indices = linspace( 0, in_rows*in_cols-1, n_nonzero ); + uvec indices = linspace( 0u, in_rows*in_cols-1, n_nonzero ); // perturb the indices for(uword i=1; i < n_nonzero-1; ++i) Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -45,8 +45,8 @@ arma_inline SpValProxy& operator++(); arma_inline SpValProxy& operator--(); - arma_inline eT operator++(const int unused); - arma_inline eT operator--(const int unused); + arma_inline eT operator++(const int); + arma_inline eT operator--(const int); //! This will work for any other operations that do not modify a value. arma_inline operator eT() const; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpValProxy_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -258,7 +258,7 @@ template arma_inline typename T1::elem_type -SpValProxy::operator++(const int unused) +SpValProxy::operator++(const int) { if (val_ptr) { @@ -286,7 +286,7 @@ template arma_inline typename T1::elem_type -SpValProxy::operator--(const int unused) +SpValProxy::operator--(const int) { if (val_ptr) { Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -13,7 +13,7 @@ #define ARMA_VERSION_MAJOR 3 #define ARMA_VERSION_MINOR 900 -#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_PATCH 7 #define ARMA_VERSION_NAME "Bavarian Sunflower" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -20,8 +20,8 @@ template - static inline void - copy_big(eT* dest, const eT* src, const uword n_elem); + arma_hot inline static void + copy_small(eT* dest, const eT* src, const uword n_elem); template Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -17,106 +17,43 @@ void arrayops::copy(eT* dest, const eT* src, const uword n_elem) { - switch(n_elem) + if(n_elem <= 16) { - default: - arrayops::copy_big(dest, src, n_elem); - break; - case 8: - dest[7] = src[7]; - case 7: - dest[6] = src[6]; - case 6: - dest[5] = src[5]; - case 5: - dest[4] = src[4]; - case 4: - dest[3] = src[3]; - case 3: - dest[2] = src[2]; - case 2: - dest[1] = src[1]; - case 1: - dest[0] = src[0]; + arrayops::copy_small(dest, src, n_elem); } + else + { + std::memcpy(dest, src, n_elem*sizeof(eT)); + } } template +arma_hot inline void -arrayops::copy_big(eT* dest, const eT* src, const uword n_elem) +arrayops::copy_small(eT* dest, const eT* src, const uword n_elem) { switch(n_elem) { - default: - std::memcpy(dest, src, n_elem*sizeof(eT)); - break; - case 32: - dest[31] = src[31]; - case 31: - dest[30] = src[30]; - case 30: - dest[29] = src[29]; - case 29: - dest[28] = src[28]; - case 28: - dest[27] = src[27]; - case 27: - dest[26] = src[26]; - case 26: - dest[25] = src[25]; - case 25: - dest[24] = src[24]; - case 24: - dest[23] = src[23]; - case 23: - dest[22] = src[22]; - case 22: - dest[21] = src[21]; - case 21: - dest[20] = src[20]; - case 20: - dest[19] = src[19]; - case 19: - dest[18] = src[18]; - case 18: - dest[17] = src[17]; - case 17: - dest[16] = src[16]; - case 16: - dest[15] = src[15]; - case 15: - dest[14] = src[14]; - case 14: - dest[13] = src[13]; - case 13: - dest[12] = src[12]; - case 12: - dest[11] = src[11]; - case 11: - dest[10] = src[10]; - case 10: - dest[9] = src[9]; - case 9: - dest[8] = src[8]; - case 8: - dest[7] = src[7]; - case 7: - dest[6] = src[6]; - case 6: - dest[5] = src[5]; - case 5: - dest[4] = src[4]; - case 4: - dest[3] = src[3]; - case 3: - dest[2] = src[2]; - case 2: - dest[1] = src[1]; - case 1: - dest[0] = src[0]; + case 16: dest[15] = src[15]; + case 15: dest[14] = src[14]; + case 14: dest[13] = src[13]; + case 13: dest[12] = src[12]; + case 12: dest[11] = src[11]; + case 11: dest[10] = src[10]; + case 10: dest[ 9] = src[ 9]; + case 9: dest[ 8] = src[ 8]; + case 8: dest[ 7] = src[ 7]; + case 7: dest[ 6] = src[ 6]; + case 6: dest[ 5] = src[ 5]; + case 5: dest[ 4] = src[ 4]; + case 4: dest[ 3] = src[ 3]; + case 3: dest[ 2] = src[ 2]; + case 2: dest[ 1] = src[ 1]; + case 1: dest[ 0] = src[ 0]; + default: ; } } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -49,6 +49,11 @@ #endif +#if defined(__APPLE__) + #define ARMA_BLAS_SDOT_BUG +#endif + + #if (__cplusplus >= 201103L) #if !defined(ARMA_USE_CXX11) #define ARMA_USE_CXX11 @@ -76,22 +81,48 @@ #error "*** Need a newer compiler ***" #endif - #define ARMA_GOOD_COMPILER - #undef ARMA_HAVE_STD_TR1 - #if (__INTEL_COMPILER <= 1110) #undef ARMA_HAVE_STD_ISFINITE #endif - #undef arma_aligned - #undef arma_align_mem + #undef ARMA_HAVE_STD_TR1 - #define arma_aligned __attribute__((aligned(16))); - #define arma_align_mem __attribute__((aligned(16))); - - #define ARMA_HAVE_ALIGNED_ATTRIBUTE + #define ARMA_GOOD_COMPILER #define ARMA_HAVE_ICC_ASSUME_ALIGNED + #if defined(__GNUG__) + + // #undef arma_aligned + // #define arma_aligned __attribute__((aligned)) + + #undef arma_align_mem + #define arma_align_mem __attribute__((aligned(16))) + + #define ARMA_HAVE_ALIGNED_ATTRIBUTE + + #elif defined(_MSC_VER) + + // #if (_MANAGED == 1) || (_M_CEE == 1) + // + // // don't do any alignment when compiling in "managed code" mode + // + // #undef arma_aligned + // #define arma_aligned + // + // #undef arma_align_mem + // #define arma_align_mem + // + // #elif (_MSC_VER >= 1700) + // + // #undef arma_align_mem + // #define arma_align_mem __declspec(align(16)) + // + // #define ARMA_HAVE_ALIGNED_ATTRIBUTE + // + // #endif + + #endif + #elif defined(__GNUG__) #if (__GNUC__ < 4) @@ -167,11 +198,6 @@ #endif -#if defined(__APPLE__) - #define ARMA_BLAS_SDOT_BUG -#endif - - #if defined(_MSC_VER) #if (_MSC_VER < 1500) @@ -186,16 +212,47 @@ #undef ARMA_HAVE_STD_ISNAN #undef ARMA_HAVE_STD_TR1 - #undef arma_inline - #define arma_inline inline __forceinline + // #undef arma_inline + // #define arma_inline inline __forceinline - #undef arma_aligned - #undef arma_align_mem + #pragma warning(push) - #define arma_aligned __declspec(align(16)) - #define arma_align_mem __declspec(align(16)) + #pragma warning(disable: 4127) // conditional expression is constant + #pragma warning(disable: 4510) // default constructor could not be generated + #pragma warning(disable: 4511) // copy constructor can't be generated + #pragma warning(disable: 4512) // assignment operator can't be generated + #pragma warning(disable: 4513) // destructor can't be generated + #pragma warning(disable: 4514) // unreferenced inline function has been removed + #pragma warning(disable: 4522) // multiple assignment operators specified + #pragma warning(disable: 4623) // default constructor can't be generated + #pragma warning(disable: 4624) // destructor can't be generated + #pragma warning(disable: 4625) // copy constructor can't be generated + #pragma warning(disable: 4626) // assignment operator can't be generated + #pragma warning(disable: 4710) // function not inlined + #pragma warning(disable: 4711) // call was inlined + #pragma warning(disable: 4714) // __forceinline can't be inlined - #define ARMA_HAVE_ALIGNED_ATTRIBUTE + // #if (_MANAGED == 1) || (_M_CEE == 1) + // + // // don't do any alignment when compiling in "managed code" mode + // + // #undef arma_aligned + // #define arma_aligned + // + // #undef arma_align_mem + // #define arma_align_mem + // + // #elif (_MSC_VER >= 1700) + // + // #undef arma_align_mem + // #define arma_align_mem __declspec(align(16)) + // + // #define ARMA_HAVE_ALIGNED_ATTRIBUTE + // + // // disable warnings: "structure was padded due to __declspec(align(16))" + // #pragma warning(disable: 4324) + // + // #endif #endif Added: pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp (rev 0) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -0,0 +1,14 @@ +// Copyright (C) 2013 NICTA (www.nicta.com.au) +// Copyright (C) 2013 Conrad Sanderson +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + +#if defined(_MSC_VER) + + #pragma warning(pop) + +#endif Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -95,10 +95,13 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1[i] + P2[i]; } else if(is_same_type::value == true) { return P1[i] - P2[i]; } else if(is_same_type::value == true) { return P1[i] / P2[i]; } else if(is_same_type::value == true) { return P1[i] * P2[i]; } + else return eT(0); } @@ -109,10 +112,13 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1.at(row,col,slice) + P2.at(row,col,slice); } else if(is_same_type::value == true) { return P1.at(row,col,slice) - P2.at(row,col,slice); } else if(is_same_type::value == true) { return P1.at(row,col,slice) / P2.at(row,col,slice); } else if(is_same_type::value == true) { return P1.at(row,col,slice) * P2.at(row,col,slice); } + else return eT(0); } @@ -124,10 +130,13 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1.at_alt(i) + P2.at_alt(i); } else if(is_same_type::value == true) { return P1.at_alt(i) - P2.at_alt(i); } else if(is_same_type::value == true) { return P1.at_alt(i) / P2.at_alt(i); } else if(is_same_type::value == true) { return P1.at_alt(i) * P2.at_alt(i); } + else return eT(0); } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -76,13 +76,17 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1[ii] + P2[ii]; } else if(is_same_type::value == true) { return P1[ii] - P2[ii]; } else if(is_same_type::value == true) { return P1[ii] / P2[ii]; } else if(is_same_type::value == true) { return P1[ii] * P2[ii]; } + else return eT(0); } + template arma_inline typename T1::elem_type @@ -90,10 +94,13 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1.at(row,col) + P2.at(row,col); } else if(is_same_type::value == true) { return P1.at(row,col) - P2.at(row,col); } else if(is_same_type::value == true) { return P1.at(row,col) / P2.at(row,col); } else if(is_same_type::value == true) { return P1.at(row,col) * P2.at(row,col); } + else return eT(0); } @@ -105,10 +112,13 @@ { // the optimiser will keep only one return statement + typedef typename T1::elem_type eT; + if(is_same_type::value == true) { return P1.at_alt(ii) + P2.at_alt(ii); } else if(is_same_type::value == true) { return P1.at_alt(ii) - P2.at_alt(ii); } else if(is_same_type::value == true) { return P1.at_alt(ii) / P2.at_alt(ii); } else if(is_same_type::value == true) { return P1.at_alt(ii) * P2.at_alt(ii); } + else return eT(0); } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -174,7 +174,8 @@ { const uword n_elem = (Proxy::is_fixed || Proxy::is_fixed) ? x.get_n_elem() : out.n_elem; - if(memory::is_aligned(out_mem)) + //if( memory::is_aligned(out_mem) ) + if( memory::is_aligned(out_mem) && ((Proxy::is_fixed && Proxy::is_fixed) ? (x.get_n_elem() >= 32) : true) ) { memory::mark_as_aligned(out_mem); @@ -192,7 +193,7 @@ { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); - + if(is_same_type::value == true) { arma_applier_1u(=, +); } else if(is_same_type::value == true) { arma_applier_1u(=, -); } else if(is_same_type::value == true) { arma_applier_1u(=, /); } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -1,5 +1,5 @@ -// Copyright (C) 2010-2012 NICTA (www.nicta.com.au) -// Copyright (C) 2010-2012 Conrad Sanderson +// Copyright (C) 2010-2013 NICTA (www.nicta.com.au) +// Copyright (C) 2010-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,7 +17,10 @@ arma_inline operator eT () { - return eT(std::rand()) * ( eT(1) / eT(RAND_MAX) ); + // make sure we are internally using at least floats + typedef typename promote_type::result eTp; + + return eT( eTp(std::rand()) * ( eTp(1) / eTp(RAND_MAX) ) ); } @@ -138,8 +141,8 @@ const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w); - out1 = tmp1*k; - out2 = tmp2*k; + out1 = eT(tmp1*k); + out2 = eT(tmp2*k); } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -155,7 +155,8 @@ { const uword n_elem = (Proxy::is_fixed) ? x.get_n_elem() : out.n_elem; - if(memory::is_aligned(out_mem)) + //if(memory::is_aligned(out_mem)) + if( memory::is_aligned(out_mem) && ((Proxy::is_fixed) ? (x.get_n_elem() >= 32) : true) ) { memory::mark_as_aligned(out_mem); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -19,7 +19,7 @@ -//! A lightweight 2D container for abitrary objects +//! A lightweight 2D container for arbitrary objects //! (the objects must have a copy constructor) template Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -27,9 +27,6 @@ if(arma_config::debug == true) { // try to expose buggy user code that accesses deleted objects - access::rw(n_rows) = 0; - access::rw(n_cols) = 0; - access::rw(n_elem) = 0; mem = 0; } } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -45,7 +45,7 @@ { arma_extra_debug_sigprint(); - typedef typename T1::elem_type eT; + // typedef typename T1::elem_type eT; const Proxy P(X); @@ -316,7 +316,7 @@ { arma_extra_debug_sigprint(); - typedef typename T1::elem_type eT; + // typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); @@ -380,7 +380,7 @@ { arma_extra_debug_sigprint(); - typedef typename T1::elem_type eT; + // typedef typename T1::elem_type eT; const ProxyCube P(X.get_ref()); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp 2013-07-27 11:59:22 UTC (rev 4408) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp 2013-07-31 22:00:27 UTC (rev 4409) @@ -1,5 +1,5 @@ -// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) -// Copyright (C) 2010-2011 Conrad Sanderson +// Copyright (C) 2010-2013 NICTA (www.nicta.com.au) +// Copyright (C) 2010-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -19,32 +19,54 @@ { arma_extra_debug_sigprint(); - typedef typename T1::elem_type eT; - typedef typename Proxy::ea_type ea_type1; - typedef typename Proxy::ea_type ea_type2; + typedef typename T1::elem_type eT; - const Proxy A(X.A); - const Proxy B(X.B); + const Proxy PA(X.A); + const Proxy PB(X.B); - arma_debug_check( ((A.get_n_elem() != 3) || (B.get_n_elem() != 3)), "cross(): input vectors must have 3 elements" ); + arma_debug_check( ((PA.get_n_elem() != 3) || (PB.get_n_elem() != 3)), "cross(): input vectors must have 3 elements" ); - out.set_size(A.get_n_rows(), A.get_n_cols()); + const uword PA_n_rows = Proxy::is_row ? 1 : PA.get_n_rows(); + const uword PA_n_cols = Proxy::is_col ? 1 : PA.get_n_cols(); - eT* out_mem = out.memptr(); - ea_type1 PA = A.get_ea(); - ea_type2 PB = B.get_ea(); + out.set_size(PA_n_rows, PA_n_cols); - const eT ax = PA[0]; - const eT ay = PA[1]; - const eT az = PA[2]; + eT* out_mem = out.memptr(); [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4409 From noreply at r-forge.r-project.org Thu Aug 1 03:46:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 03:46:04 +0200 (CEST) Subject: [Rcpp-commits] r4410 - in pkg/Rcpp: . inst/unitTests Message-ID: <20130801014605.B5953184CF2@r-forge.r-project.org> Author: edd Date: 2013-08-01 03:46:00 +0200 (Thu, 01 Aug 2013) New Revision: 4410 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/unitTests/runit.wstring.R Log: *temporarily* disabled wchar unit test Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-07-31 22:00:27 UTC (rev 4409) +++ pkg/Rcpp/ChangeLog 2013-08-01 01:46:00 UTC (rev 4410) @@ -1,5 +1,10 @@ -2013-07-25 Romain Francois +2013-07-31 Dirk Eddelbuettel + * inst/unitTests/runit.wstring.R: *TEMPORARILY* disabled + ===== To be revverted before release ====== + +2013-07-25 Romain Francois + * include/Rcpp/sugar/functions/is_na.h : added is_na for DateVector and DatetimeVector * include/Rcpp/Date.h : added is_na method @@ -8,17 +13,17 @@ * unitTests/runit.Date.R : idem * src/attributes.cpp: collecting functions in a FunctionMap. Will use this for dispatching - + 2013-07-24 Romain Francois * include/Rcpp/traits/is_module_object.h: trait class that identifies - at compile time if a given type is a type exposed by a module, i.e. if - we used the RCPP_EXPOSED_AS macro + at compile time if a given type is a type exposed by a module, + i.e. if we used the RCPP_EXPOSED_AS macro * include/Rcpp/is.h: able to identify if an object is of a given type - exposed by a module (supports references and pointers too). - * src/Module.cpp: implementation of is_module_object_internal that - checks if an object is of a given typeid, used by is where T is - module exposed + exposed by a module (supports references and pointers too). + * src/Module.cpp: implementation of is_module_object_internal that + checks if an object is of a given typeid, used by is where T is + module exposed 2013-07-23 Romain Francois @@ -26,12 +31,13 @@ exposed by modules * include/Rcpp/macros/module.h: idem * include/Rcpp/traits/un_pointer.h: handle the object case - * include/Rcpp/traits/r_type_traits.h: adding traits to help the - with as and as + * include/Rcpp/traits/r_type_traits.h: adding traits to help the with + as and as * unitTests/runit.Module.R: testing as and as * unitTests/cpp/Module.cpp: idem - * src/attributes.cpp: take advantage of a more flexible as<>. The Type - class gains a full_name() method that shows const-ness and reference-ness + * src/attributes.cpp: take advantage of a more flexible as<>. The + Type class gains a full_name() method that shows const-ness and + reference-ness 2013-07-17 Romain Francois Modified: pkg/Rcpp/inst/unitTests/runit.wstring.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.wstring.R 2013-07-31 22:00:27 UTC (rev 4409) +++ pkg/Rcpp/inst/unitTests/runit.wstring.R 2013-08-01 01:46:00 UTC (rev 4410) @@ -21,7 +21,7 @@ .runThisTest <- Sys.getenv("RunAllRcppTests") == "yes" -if (.runThisTest) { +if (FALSE && .runThisTest) { .setUp <- Rcpp:::unit_test_setup( "wstring.cpp" ) From noreply at r-forge.r-project.org Thu Aug 1 03:48:42 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 03:48:42 +0200 (CEST) Subject: [Rcpp-commits] r4411 - in pkg/Rcpp: . inst/doc Message-ID: <20130801014842.81851184CF2@r-forge.r-project.org> Author: edd Date: 2013-08-01 03:48:41 +0200 (Thu, 01 Aug 2013) New Revision: 4411 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/doc/Makefile pkg/Rcpp/inst/doc/Rcpp.bib Log: another try at getting pdf builds working on r-forge minor update to Rcpp.bib Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-01 01:46:00 UTC (rev 4410) +++ pkg/Rcpp/ChangeLog 2013-08-01 01:48:41 UTC (rev 4411) @@ -1,7 +1,10 @@ 2013-07-31 Dirk Eddelbuettel + * inst/doc/Makefile: Rejigged pdf builds in another attempt at + pleasing whatever runs the builds on r-forge. L'espoir fait vivre. + * inst/unitTests/runit.wstring.R: *TEMPORARILY* disabled - ===== To be revverted before release ====== + ======================================= To be revverted before release ====== 2013-07-25 Romain Francois Modified: pkg/Rcpp/inst/doc/Makefile =================================================================== --- pkg/Rcpp/inst/doc/Makefile 2013-08-01 01:46:00 UTC (rev 4410) +++ pkg/Rcpp/inst/doc/Makefile 2013-08-01 01:48:41 UTC (rev 4411) @@ -12,9 +12,9 @@ @echo The 'make all' target is now empty as eg R-Forge builds fall over @echo So please use 'make pdfclean; make pdfall' to rebuild -OLDpdfall: rotateFiles index.html Rcpp-unitTests.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-FAQ.pdf Rcpp-extending.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-quickref.pdf +OLDpdfall: index.html Rcpp-unitTests.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-FAQ.pdf Rcpp-extending.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-quickref.pdf -pdfall: rotateFiles index.html +pdfall: index.html ## Play some games with explicit targets to avoid parallel make builds ## This is all just because R-Forge insists on re-making these, seemingly in parallel make Rcpp-extending.pdf @@ -31,13 +31,6 @@ rm -f Rcpp-extending.pdf Rcpp-FAQ.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-quickref.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-unitTests.pdf rotateFiles: - cp -f Rcpp-extending/Rcpp-extending-fake.Rnw Rcpp-extending.Rnw - cp -f Rcpp-FAQ/Rcpp-FAQ-fake.Rnw Rcpp-FAQ.Rnw - cp -f Rcpp-modules/Rcpp-modules-fake.Rnw Rcpp-modules.Rnw - cp -f Rcpp-package/Rcpp-package-fake.Rnw Rcpp-package.Rnw - cp -f Rcpp-quickref/Rcpp-quickref-fake.Rnw Rcpp-quickref.Rnw - cp -f Rcpp-sugar/Rcpp-sugar-fake.Rnw Rcpp-sugar.Rnw - cp -f Rcpp-attributes/Rcpp-attributes-fake.Rnw Rcpp-attributes.Rnw clean: rm -f index.html @@ -148,9 +141,8 @@ else $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-sugar.tex', pdf = TRUE, clean = TRUE )" endif - rm -fr Rcpp-sugar.tex Rcpp-sugar.bbl Rcpp-sugar.blg Rcpp-sugar.aux Rcpp-sugar.out Rcpp-sugar.log - rm Rcpp-sugar.Rnw - cp Rcpp-sugar/Rcpp-sugar-fake.Rnw Rcpp-sugar.Rnw + rm -fr Rcpp-sugar.tex Rcpp-sugar.bbl Rcpp-sugar.blg Rcpp-sugar.aux Rcpp-sugar.out Rcpp-sugar.log Rcpp-sugar.Rnw + cp -f Rcpp-sugar/Rcpp-sugar-fake.Rnw Rcpp-sugar.Rnw Rcpp-attributes.pdf : Rcpp-attributes/Rcpp-attributes.Rnw cp -f Rcpp-attributes/Rcpp-attributes.Rnw . @@ -163,9 +155,8 @@ else $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-attributes.tex', pdf = TRUE, clean = TRUE )" endif - rm -fr Rcpp-attributes.tex Rcpp-attributes.bbl Rcpp-attributes.blg Rcpp-attributes.aux Rcpp-attributes.out Rcpp-attributes.log - rm Rcpp-attributes.Rnw - cp Rcpp-attributes/Rcpp-attributes-fake.Rnw Rcpp-attributes.Rnw + rm -fr Rcpp-attributes.tex Rcpp-attributes.bbl Rcpp-attributes.blg Rcpp-attributes.aux Rcpp-attributes.out Rcpp-attributes.log Rcpp-attributes.Rnw + cp -f Rcpp-attributes/Rcpp-attributes-fake.Rnw Rcpp-attributes.Rnw Rcpp-quickref.pdf : Rcpp-quickref/Rcpp-quickref.Rnw cp -f Rcpp-quickref/Rcpp-quickref.Rnw . Modified: pkg/Rcpp/inst/doc/Rcpp.bib =================================================================== --- pkg/Rcpp/inst/doc/Rcpp.bib 2013-08-01 01:46:00 UTC (rev 4410) +++ pkg/Rcpp/inst/doc/Rcpp.bib 2013-08-01 01:48:41 UTC (rev 4411) @@ -295,6 +295,7 @@ author = {Dirk Eddelbuettel}, title = {Seamless R and C++ Integration with Rcpp}, publisher = {Springer}, + series = {Use R!}, year = 2013, address = {New York}, isbn = {978-1-4614-6867-7} From noreply at r-forge.r-project.org Thu Aug 1 03:49:46 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 03:49:46 +0200 (CEST) Subject: [Rcpp-commits] r4412 - pkg/Rcpp Message-ID: <20130801014946.402CD184CF2@r-forge.r-project.org> Author: edd Date: 2013-08-01 03:49:45 +0200 (Thu, 01 Aug 2013) New Revision: 4412 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION Log: dump development version to 0.10.4.3 to really trigger a distinct build on r-forge Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-01 01:48:41 UTC (rev 4411) +++ pkg/Rcpp/ChangeLog 2013-08-01 01:49:45 UTC (rev 4412) @@ -1,5 +1,7 @@ 2013-07-31 Dirk Eddelbuettel + * DESCRIPTION: Bump development version to 0.10.4.3 + * inst/doc/Makefile: Rejigged pdf builds in another attempt at pleasing whatever runs the builds on r-forge. L'espoir fait vivre. Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-08-01 01:48:41 UTC (rev 4411) +++ pkg/Rcpp/DESCRIPTION 2013-08-01 01:49:45 UTC (rev 4412) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.4.2 +Version: 0.10.4.3 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire From noreply at r-forge.r-project.org Thu Aug 1 11:09:27 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 11:09:27 +0200 (CEST) Subject: [Rcpp-commits] r4413 - in pkg/Rcpp: . inst/unitTests inst/unitTests/cpp Message-ID: <20130801090927.1CD021852E5@r-forge.r-project.org> Author: romain Date: 2013-08-01 11:09:26 +0200 (Thu, 01 Aug 2013) New Revision: 4413 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/unitTests/cpp/wstring.cpp pkg/Rcpp/inst/unitTests/runit.wstring.R Log: re enable the wstring test suite Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-01 01:49:45 UTC (rev 4412) +++ pkg/Rcpp/ChangeLog 2013-08-01 09:09:26 UTC (rev 4413) @@ -1,3 +1,8 @@ +2013-08-01 Romain Francois + + * unitTests/cpp/wstring.cpp : re-enable the wstring test suite. + * unitTests/runit.wstring.R : re-enable the wstring test suite. + 2013-07-31 Dirk Eddelbuettel * DESCRIPTION: Bump development version to 0.10.4.3 Modified: pkg/Rcpp/inst/unitTests/cpp/wstring.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/wstring.cpp 2013-08-01 01:49:45 UTC (rev 4412) +++ pkg/Rcpp/inst/unitTests/cpp/wstring.cpp 2013-08-01 09:09:26 UTC (rev 4413) @@ -19,7 +19,7 @@ } // [[Rcpp::export]] -String wstring_param(const std::wstring& s1, const std::wstring& s2){ +String wstring_param(std::wstring s1, std::wstring s2){ String s = s1 ; s += s2 ; return s ; Modified: pkg/Rcpp/inst/unitTests/runit.wstring.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.wstring.R 2013-08-01 01:49:45 UTC (rev 4412) +++ pkg/Rcpp/inst/unitTests/runit.wstring.R 2013-08-01 09:09:26 UTC (rev 4413) @@ -21,13 +21,12 @@ .runThisTest <- Sys.getenv("RunAllRcppTests") == "yes" -if (FALSE && .runThisTest) { +if ( .runThisTest) { .setUp <- Rcpp:::unit_test_setup( "wstring.cpp" ) test.CharacterVector_wstring <- function(){ res <- CharacterVector_wstring() - #print(res) checkEquals( res, c("foobar", "foobar" ) ) } From noreply at r-forge.r-project.org Thu Aug 1 16:26:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 1 Aug 2013 16:26:55 +0200 (CEST) Subject: [Rcpp-commits] r4414 - pkg/Rcpp Message-ID: <20130801142655.A45851855FE@r-forge.r-project.org> Author: edd Date: 2013-08-01 16:26:55 +0200 (Thu, 01 Aug 2013) New Revision: 4414 Modified: pkg/Rcpp/ChangeLog Log: undo temp notice on disabled wchar test now that code is no longer foobared Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-01 09:09:26 UTC (rev 4413) +++ pkg/Rcpp/ChangeLog 2013-08-01 14:26:55 UTC (rev 4414) @@ -1,7 +1,7 @@ 2013-08-01 Romain Francois - * unitTests/cpp/wstring.cpp : re-enable the wstring test suite. - * unitTests/runit.wstring.R : re-enable the wstring test suite. + * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. + * unitTests/runit.wstring.R: re-enable the wstring test suite. 2013-07-31 Dirk Eddelbuettel @@ -10,9 +10,6 @@ * inst/doc/Makefile: Rejigged pdf builds in another attempt at pleasing whatever runs the builds on r-forge. L'espoir fait vivre. - * inst/unitTests/runit.wstring.R: *TEMPORARILY* disabled - ======================================= To be revverted before release ====== - 2013-07-25 Romain Francois * include/Rcpp/sugar/functions/is_na.h : added is_na for DateVector and From noreply at r-forge.r-project.org Fri Aug 2 06:53:30 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 2 Aug 2013 06:53:30 +0200 (CEST) Subject: [Rcpp-commits] r4415 - in pkg/RcppArmadillo: . inst/include/RcppArmadillo Message-ID: <20130802045330.86B1718532D@r-forge.r-project.org> Author: edd Date: 2013-08-02 06:53:29 +0200 (Fri, 02 Aug 2013) New Revision: 4415 Modified: pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h Log: set vec_state to 0 on init as suggested by Conrad Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-01 14:26:55 UTC (rev 4414) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-02 04:53:29 UTC (rev 4415) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.900.7 +Version: 0.3.900.7.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-01 14:26:55 UTC (rev 4414) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-02 04:53:29 UTC (rev 4415) @@ -100,7 +100,7 @@ : n_rows(0) , n_cols(0) , n_elem(0) - , vec_state(1) + , vec_state(0) , mem_state(0) , mem(0) { From noreply at r-forge.r-project.org Fri Aug 2 08:33:38 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 2 Aug 2013 08:33:38 +0200 (CEST) Subject: [Rcpp-commits] r4416 - in pkg/RcppArmadillo: . inst/include/RcppArmadillo Message-ID: <20130802063338.87E8E184D99@r-forge.r-project.org> Author: romain Date: 2013-08-02 08:33:38 +0200 (Fri, 02 Aug 2013) New Revision: 4416 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h Log: handle vec_state Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-02 04:53:29 UTC (rev 4415) +++ pkg/RcppArmadillo/ChangeLog 2013-08-02 06:33:38 UTC (rev 4416) @@ -1,3 +1,9 @@ +2013-08-02 Romain Francois + + * include/RcppArmadillo/Row_meat.h : set vec_state correctly + * include/RcppArmadillo/Col_meat.h : set vec_state correctly + * include/RcppArmadillo/Mat_meat.h : set vec_state correctly + 2013-07-31 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.900.7 Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h 2013-08-02 04:53:29 UTC (rev 4415) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h 2013-08-02 06:33:38 UTC (rev 4416) @@ -2,7 +2,7 @@ // // Col_meat.h: Rcpp/Armadillo glue // -// Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // @@ -28,6 +28,7 @@ : Mat( X ) { arma_extra_debug_sigprint(this); + access::rw(Mat::vec_state) = 1; } template Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-02 04:53:29 UTC (rev 4415) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-02 06:33:38 UTC (rev 4416) @@ -2,7 +2,7 @@ // // Mat_meat.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h 2013-08-02 04:53:29 UTC (rev 4415) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h 2013-08-02 06:33:38 UTC (rev 4416) @@ -2,7 +2,7 @@ // // Row_meat.h: Rcpp/Armadillo glue // -// Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // @@ -28,6 +28,7 @@ : Mat( X ) { arma_extra_debug_sigprint(this); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); + access::rw(Mat::vec_state) = 2; } template From noreply at r-forge.r-project.org Fri Aug 2 13:04:58 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 2 Aug 2013 13:04:58 +0200 (CEST) Subject: [Rcpp-commits] r4417 - pkg/RcppArmadillo Message-ID: <20130802110459.0980018532D@r-forge.r-project.org> Author: edd Date: 2013-08-02 13:04:58 +0200 (Fri, 02 Aug 2013) New Revision: 4417 Modified: pkg/RcppArmadillo/DESCRIPTION Log: reset version, the development subversion number was meant to be local Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-02 06:33:38 UTC (rev 4416) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-02 11:04:58 UTC (rev 4417) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.900.7.1 +Version: 0.3.900.7 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel From noreply at r-forge.r-project.org Fri Aug 2 14:15:47 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 2 Aug 2013 14:15:47 +0200 (CEST) Subject: [Rcpp-commits] r4418 - in pkg/RcppArmadillo: . inst Message-ID: <20130802121547.4F3DD184CDB@r-forge.r-project.org> Author: edd Date: 2013-08-02 14:15:47 +0200 (Fri, 02 Aug 2013) New Revision: 4418 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/NEWS.Rd Log: updated 0.3.900.7 release Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-02 11:04:58 UTC (rev 4417) +++ pkg/RcppArmadillo/ChangeLog 2013-08-02 12:15:47 UTC (rev 4418) @@ -1,16 +1,16 @@ -2013-08-02 Romain Francois +2013-08-02 Dirk Eddelbuettel - * include/RcppArmadillo/Row_meat.h : set vec_state correctly - * include/RcppArmadillo/Col_meat.h : set vec_state correctly - * include/RcppArmadillo/Mat_meat.h : set vec_state correctly - -2013-07-31 Dirk Eddelbuettel - * DESCRIPTION: Release 0.3.900.7 * inst/NEWS: Release 0.3.900.7 * inst/include/*: Upgraded to new release 3.900.7 of Armadillo * debian/*: Similarly updated for new release to Debian +2013-08-02 Romain Francois + + * include/RcppArmadillo/Row_meat.h: set vec_state correctly + * include/RcppArmadillo/Col_meat.h: set vec_state correctly + * include/RcppArmadillo/Mat_meat.h: set vec_state correctly + 2013-07-12 Dirk Eddelbuettel * inst/unitTests/runTests.R: No longer need to test minimal versions Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-02 11:04:58 UTC (rev 4417) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-02 12:15:47 UTC (rev 4418) @@ -2,7 +2,7 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{Changes in RcppArmadillo version 0.3.900.7 (2013-07-31)}{ +\section{Changes in RcppArmadillo version 0.3.900.7 (2013-08-02)}{ \itemize{ \item Upgraded to Armadillo release Version 3.900.7 (Bavarian Sunflower) @@ -10,6 +10,8 @@ \item minor fix for inplace \code{reshape()} \item minor corrections for compilation issues under GCC 4.8+ and MSVC } + \item Corrected setting of \code{vec_stats} in intialization of row, + vector and matrix objects \item The \pkg{inline} package is no longer used in the examples and unit tests which have all been converted to using Rcpp attributes } From noreply at r-forge.r-project.org Sat Aug 3 21:34:49 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 21:34:49 +0200 (CEST) Subject: [Rcpp-commits] r4419 - pkg/RcppArmadillo/inst/include Message-ID: <20130803193449.8CC0518514E@r-forge.r-project.org> Author: edd Date: 2013-08-03 21:34:49 +0200 (Sat, 03 Aug 2013) New Revision: 4419 Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo.h pkg/RcppArmadillo/inst/include/RcppArmadilloConfig.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h pkg/RcppArmadillo/inst/include/RcppArmadilloSugar.h pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h Log: standardize emacs and jedit settings header rolled copyright Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo.h 2013-08-02 12:15:47 UTC (rev 4418) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo.h 2013-08-03 19:34:49 UTC (rev 4419) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // RcppArmadillo.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloConfig.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloConfig.h 2013-08-02 12:15:47 UTC (rev 4418) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloConfig.h 2013-08-03 19:34:49 UTC (rev 4419) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // RcppArmadilloConfig.h: Rcpp/Armadillo glue // -// Copyright (C) 2010-2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-02 12:15:47 UTC (rev 4418) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-03 19:34:49 UTC (rev 4419) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // RcppArmadilloForward.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // @@ -86,8 +87,8 @@ template class Exporter< arma::Mat > ; template class Exporter< arma::Row > ; template class Exporter< arma::Col > ; -// template class Exporter< arma::field > ; -// template class Exporter< arma::Cube > ; + // template class Exporter< arma::field > ; + // template class Exporter< arma::Cube > ; } // namespace traits Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloSugar.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloSugar.h 2013-08-02 12:15:47 UTC (rev 4418) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloSugar.h 2013-08-03 19:34:49 UTC (rev 4419) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // RcppArmadilloSugar.h: Rcpp/Armadillo glue // -// Copyright (C) 2010-2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-02 12:15:47 UTC (rev 4418) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-03 19:34:49 UTC (rev 4419) @@ -1,8 +1,9 @@ -// -*- 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; -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // RcppArmadilloWrap.h: Rcpp/Armadillo glue // -// Copyright (C) 2010-2012 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // @@ -33,6 +34,15 @@ return x; } + // DE 03-Aug-2013 + // here is an alternate form which would not set dimension which we could do + // for row and column vectors -- but the current form of return row and col + // as matrix types with one col (or row, respectively) is now entrenched + template + SEXP arma_wrap(const T& object) { + return ::Rcpp::wrap(object.memptr() , object.memptr() + object.n_elem); + } + } /* namespace RcppArmadillo */ /* wrap */ From noreply at r-forge.r-project.org Sat Aug 3 21:37:19 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 21:37:19 +0200 (CEST) Subject: [Rcpp-commits] r4420 - pkg/RcppArmadillo/inst/include/RcppArmadillo Message-ID: <20130803193719.8DFB018514E@r-forge.r-project.org> Author: edd Date: 2013-08-03 21:37:19 +0200 (Sat, 03 Aug 2013) New Revision: 4420 Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_proto.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_proto.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_proto.h Log: standardize emacs and jedit settings header rolled copyright Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,8 +1,9 @@ -// -*- 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; -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Col_meat.h: Rcpp/Armadillo glue // -// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_proto.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_proto.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_proto.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // Col_proto.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,4 +1,5 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // Mat_meat.h: Rcpp/Armadillo glue // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_proto.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_proto.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_proto.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // Mat_proto.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,8 +1,9 @@ -// -*- 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; -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Row_meat.h: Rcpp/Armadillo glue // -// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_proto.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_proto.h 2013-08-03 19:34:49 UTC (rev 4419) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_proto.h 2013-08-03 19:37:19 UTC (rev 4420) @@ -1,8 +1,9 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // Row_proto.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // From noreply at r-forge.r-project.org Sat Aug 3 21:38:02 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 21:38:02 +0200 (CEST) Subject: [Rcpp-commits] r4421 - pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions Message-ID: <20130803193802.998CB18514E@r-forge.r-project.org> Author: edd Date: 2013-08-03 21:38:02 +0200 (Sat, 03 Aug 2013) New Revision: 4421 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h Log: standardize emacs and jedit settings header rolled copyright Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h 2013-08-03 19:37:19 UTC (rev 4420) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h 2013-08-03 19:38:02 UTC (rev 4421) @@ -1,11 +1,12 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 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: */ // // sample.cpp: Rcpp/Armadillo equivalent to R's sample(). // This is to be used in C++ functions, and should *not* be called from R. // It should yield identical results to R in most cases // (note that Walker's alias method is not implemented). // -// Copyright (C) 2012 -2013 Christian Gunning +// Copyright (C) 2012 - 2013 Christian Gunning // // This file is part of RcppArmadillo. // From noreply at r-forge.r-project.org Sat Aug 3 21:51:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 21:51:55 +0200 (CEST) Subject: [Rcpp-commits] r4422 - in pkg/RcppArmadillo: . inst/unitTests Message-ID: <20130803195155.5834F183D02@r-forge.r-project.org> Author: edd Date: 2013-08-03 21:51:55 +0200 (Sat, 03 Aug 2013) New Revision: 4422 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R pkg/RcppArmadillo/inst/unitTests/runit.sample.R Log: improved unit test setup a little Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-03 19:38:02 UTC (rev 4421) +++ pkg/RcppArmadillo/ChangeLog 2013-08-03 19:51:55 UTC (rev 4422) @@ -1,3 +1,8 @@ +2013-08-03 Dirk Eddelbuettel + + * inst/unitTests/runit.RcppArmadillo.R: Improved test setup a little + * inst/unitTests/runit.sample.R: Ditto + 2013-08-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.900.7 Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R =================================================================== --- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-08-03 19:38:02 UTC (rev 4421) +++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2013-08-03 19:51:55 UTC (rev 4422) @@ -19,7 +19,13 @@ .setUp <- function(){ suppressMessages(require(RcppArmadillo)) - sourceCpp(file.path(pathRcppArmadilloTests, "cpp/armadillo.cpp")) + if (exists("pathRcppArmadilloTests")) { + sourceCpp(file.path(pathRcppArmadilloTests, "cpp", "armadillo.cpp")) + } else if (file.exists("cpp/armadillo.cpp")) { + sourceCpp("cpp/armadillo.cpp") + } else { + sourceCpp(system.file("unitTests", "cpp", "armadillo.cpp", package="RcppArmadillo")) + } } test.wrap.R <- function(){ Modified: pkg/RcppArmadillo/inst/unitTests/runit.sample.R =================================================================== --- pkg/RcppArmadillo/inst/unitTests/runit.sample.R 2013-08-03 19:38:02 UTC (rev 4421) +++ pkg/RcppArmadillo/inst/unitTests/runit.sample.R 2013-08-03 19:51:55 UTC (rev 4422) @@ -19,7 +19,13 @@ .setUp <- function(){ suppressMessages(require(RcppArmadillo)) - sourceCpp(file.path(pathRcppArmadilloTests, "cpp/sample.cpp")) + if (exists("pathRcppArmadilloTests")) { + sourceCpp(file.path(pathRcppArmadilloTests, "cpp", "armadillo.cpp")) + } else if (file.exists("cpp/sample.cpp")) { + sourceCpp("cpp/sample.cpp") + } else { + sourceCpp(system.file("unitTests", "cpp", "sample.cpp", package="RcppArmadillo")) + } } test.sample <- function() { From noreply at r-forge.r-project.org Sat Aug 3 21:58:47 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 21:58:47 +0200 (CEST) Subject: [Rcpp-commits] r4423 - pkg/RcppArmadillo/inst/unitTests Message-ID: <20130803195847.D3BB6183D02@r-forge.r-project.org> Author: edd Date: 2013-08-03 21:58:47 +0200 (Sat, 03 Aug 2013) New Revision: 4423 Modified: pkg/RcppArmadillo/inst/unitTests/runit.sample.R Log: source correct file Modified: pkg/RcppArmadillo/inst/unitTests/runit.sample.R =================================================================== --- pkg/RcppArmadillo/inst/unitTests/runit.sample.R 2013-08-03 19:51:55 UTC (rev 4422) +++ pkg/RcppArmadillo/inst/unitTests/runit.sample.R 2013-08-03 19:58:47 UTC (rev 4423) @@ -20,7 +20,7 @@ .setUp <- function(){ suppressMessages(require(RcppArmadillo)) if (exists("pathRcppArmadilloTests")) { - sourceCpp(file.path(pathRcppArmadilloTests, "cpp", "armadillo.cpp")) + sourceCpp(file.path(pathRcppArmadilloTests, "cpp", "sample.cpp")) } else if (file.exists("cpp/sample.cpp")) { sourceCpp("cpp/sample.cpp") } else { From noreply at r-forge.r-project.org Sat Aug 3 22:02:19 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Aug 2013 22:02:19 +0200 (CEST) Subject: [Rcpp-commits] r4424 - in pkg/RcppArmadillo: . inst inst/include/RcppArmadilloExtensions Message-ID: <20130803200219.8CD52183D02@r-forge.r-project.org> Author: edd Date: 2013-08-03 22:02:19 +0200 (Sat, 03 Aug 2013) New Revision: 4424 Added: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/NEWS.Rd Log: added as and wrap support for sp_mat conversion to and from dgCMatrix types from the Matrix package Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-03 19:58:47 UTC (rev 4423) +++ pkg/RcppArmadillo/ChangeLog 2013-08-03 20:02:19 UTC (rev 4424) @@ -1,5 +1,9 @@ 2013-08-03 Dirk Eddelbuettel + * inst/include/RcppArmadilloExtensions/spmat.h: Added basic as<> and + wrap support for sparse matrices (of class dgCMatrix from the Matrix + package); currently only type double is supported + * inst/unitTests/runit.RcppArmadillo.R: Improved test setup a little * inst/unitTests/runit.sample.R: Ditto Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-03 19:58:47 UTC (rev 4423) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-03 20:02:19 UTC (rev 4424) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.900.7 +Version: 0.3.900.7.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-03 19:58:47 UTC (rev 4423) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-03 20:02:19 UTC (rev 4424) @@ -2,6 +2,18 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppArmadillo version 0.x.yyy.z (2013-aa-bb)}{ + \itemize{ + \item Upgraded to Armadillo release Version ... + \itemize{ + \item + \item + } + \item Added conversion support for sparse matrices (of type double) + created by the \cpkg{Matrix} package as class \code{dgCMatrix} + } +} + \section{Changes in RcppArmadillo version 0.3.900.7 (2013-08-02)}{ \itemize{ \item Upgraded to Armadillo release Version 3.900.7 (Bavarian Added: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h (rev 0) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h 2013-08-03 20:02:19 UTC (rev 4424) @@ -0,0 +1,101 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ +// +// spmat.h: Conversion between Armadillo sp_mat and the dgCMatrix from Matrix +// +// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois +// +// This file is part of RcppArmadillo. +// +// RcppArmadillo 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. +// +// RcppArmadillo 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 RcppArmadillo. If not, see . + +#ifndef RcppArmadillo__SpMat__h +#define RcppArmadillo__SpMat__h + +#include + +namespace Rcpp { + + + // converts an SEXP object from R which was created as a sparse + // matrix via the Matrix package) into an Armadillo sp_mat matrix + // + // TODO: template'ize to allow for types other than double, though + // realistically this is all we need + template <> arma::sp_mat as(SEXP sx) { + S4 mat(sx); + IntegerVector dims = mat.slot("Dim"); + arma::urowvec i = Rcpp::as(mat.slot("i")); + arma::urowvec p = Rcpp::as(mat.slot("p")); + arma::vec x = Rcpp::as(mat.slot("x")); + + int nrow = dims[0], ncol = dims[1]; + arma::sp_mat res(nrow, ncol); + + // 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); + arma::arrayops::copy(arma::access::rwp(res.row_indices), i.begin(), i.size() + 1); + + // create space for col_ptrs, and copy + arma::access::rw(res.col_ptrs) = arma::memory::acquire(p.size() + 2); + arma::arrayops::copy(arma::access::rwp(res.col_ptrs), p.begin(), p.size() + 1); + + // 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; + } + + + // convert an Armadillo sp_mat into a corresponding R sparse matrix + // we copy to STL vectors as the Matrix package expects vectors whereas the + // default wrap in Armadillo returns matrix with one row (or col) + SEXP wrap(arma::sp_mat sm) { + + IntegerVector dim(2); + dim[0] = sm.n_rows; + dim[1] = sm.n_cols; + + arma::vec x(sm.n_nonzero); // create space for values, and copy + arma::arrayops::copy(x.begin(), sm.values, sm.n_nonzero); + std::vector vx = arma::conv_to< std::vector< double > >::from(x); + + arma::urowvec i(sm.n_nonzero); // create space for row_indices, and copy & cast + arma::arrayops::copy(i.begin(), sm.row_indices, sm.n_nonzero); + std::vector vi = arma::conv_to< std::vector< int > >::from(i); + + arma::urowvec p(sm.n_cols+1); // create space for col_ptrs, and copy + arma::arrayops::copy(p.begin(), sm.col_ptrs, sm.n_cols+1); + // do not copy sentinel for returning R + std::vector vp = arma::conv_to< std::vector< int > >::from(p); + + S4 s("dgCMatrix"); + s.slot("i") = vi; + s.slot("p") = vp; + s.slot("x") = vx; + s.slot("Dim") = dim; + return s; + } + +} + +#endif From noreply at r-forge.r-project.org Mon Aug 5 14:38:30 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 5 Aug 2013 14:38:30 +0200 (CEST) Subject: [Rcpp-commits] r4425 - in pkg/Rcpp: . inst/doc Message-ID: <20130805123830.68BF1185061@r-forge.r-project.org> Author: edd Date: 2013-08-05 14:38:29 +0200 (Mon, 05 Aug 2013) New Revision: 4425 Modified: pkg/Rcpp/cleanup pkg/Rcpp/inst/doc/Makefile Log: another attempt at reviving builds on R-Forge: hide 'make clean' in inst/doc, move its functionality into the cleanup script Modified: pkg/Rcpp/cleanup =================================================================== --- pkg/Rcpp/cleanup 2013-08-03 20:02:19 UTC (rev 4424) +++ pkg/Rcpp/cleanup 2013-08-05 12:38:29 UTC (rev 4425) @@ -1,7 +1,5 @@ -cd inst/doc -make clean -cd ../.. +cd inst/doc && rm -f index.html *.tex *.bbl *.blg *.aux *.out *.log && cd - rm -f confdefs.h config.log config.status \ src/*.o src/*.so src/*.a src/*.d src/*.dll src/*.rc \ Modified: pkg/Rcpp/inst/doc/Makefile =================================================================== --- pkg/Rcpp/inst/doc/Makefile 2013-08-03 20:02:19 UTC (rev 4424) +++ pkg/Rcpp/inst/doc/Makefile 2013-08-05 12:38:29 UTC (rev 4425) @@ -15,8 +15,8 @@ OLDpdfall: index.html Rcpp-unitTests.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-FAQ.pdf Rcpp-extending.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-quickref.pdf pdfall: index.html - ## Play some games with explicit targets to avoid parallel make builds - ## This is all just because R-Forge insists on re-making these, seemingly in parallel + ## Play some games with explicit targets to avoid parallel make builds + ## This is all just because R-Forge insists on re-making these, seemingly in parallel make Rcpp-extending.pdf make Rcpp-FAQ.pdf make Rcpp-introduction.pdf @@ -30,12 +30,10 @@ pdfclean: rm -f Rcpp-extending.pdf Rcpp-FAQ.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-quickref.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-unitTests.pdf -rotateFiles: +#clean: +# rm -f index.html +# rm -f *.tex *.bbl *.blg *.aux *.out *.log -clean: - rm -f index.html - rm -f *.tex *.bbl *.blg *.aux *.out *.log - setvars: ifeq (${R_HOME},) R_HOME= $(shell R RHOME) From noreply at r-forge.r-project.org Thu Aug 8 22:36:12 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 8 Aug 2013 22:36:12 +0200 (CEST) Subject: [Rcpp-commits] r4426 - pkg/RcppArmadillo Message-ID: <20130808203612.B4226185A77@r-forge.r-project.org> Author: edd Date: 2013-08-08 22:36:12 +0200 (Thu, 08 Aug 2013) New Revision: 4426 Modified: pkg/RcppArmadillo/ChangeLog Log: Summary: empty commit to tickle a build attempt for Stefan / R-Forge Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-05 12:38:29 UTC (rev 4425) +++ pkg/RcppArmadillo/ChangeLog 2013-08-08 20:36:12 UTC (rev 4426) @@ -1,3 +1,7 @@ +2013-08-08 Dirk Eddelbuettel + + * Empty commit at Stefan's request to tickle a built + 2013-08-03 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/spmat.h: Added basic as<> and From noreply at r-forge.r-project.org Tue Aug 13 02:11:53 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Aug 2013 02:11:53 +0200 (CEST) Subject: [Rcpp-commits] r4427 - in pkg/RcppArmadillo/inst/include: . armadillo_bits Message-ID: <20130813001153.AC18D1842E0@r-forge.r-project.org> Author: edd Date: 2013-08-13 02:11:52 +0200 (Tue, 13 Aug 2013) New Revision: 4427 Added: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_all.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_any.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_vectorise.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_gemm.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_gemm_mixed.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_gemv.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_herk.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mul_syrk.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_all_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_all_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_any_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_any_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_vectorise_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_vectorise_meat.hpp Removed: pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/gemm_mixed.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp Modified: pkg/RcppArmadillo/inst/include/armadillo pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp 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/GenCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_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/OpCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/OpCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Op_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Op_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.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/SpBase_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpBase_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/access.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_ostream_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_static_check.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/atlas_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/atlas_wrapper.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/blas_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/blas_wrapper.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/constants.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/constants_compat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/debug.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eOpCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eOpCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_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/field_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_chol.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_conv.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_conv_to.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_cor.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_cov.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_cross.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_cumsum.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagvec.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_elem.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eps.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eye.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_flip.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_hist.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_histc.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_join.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_kron.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_lu.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_mean.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_median.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_pinv.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_prod.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_qr.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_repmat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_reshape.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_resize.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_shuffle.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sort.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sort_index.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_stddev.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sum.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_svd.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_syl_lyap.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_symmat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_toeplitz.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trans.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trig.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trimat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_exp.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_log.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_unique.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_var.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/format_wrap.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_conv_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_conv_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cor_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cor_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cov_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cov_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_hist_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_hist_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_histc_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_histc_meat.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_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_kron_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_relational_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_relational_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/include_atlas.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/injector_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/injector_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_wrapper.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/memory.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlue_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlue_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtOp_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/mtOp_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_chol_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_chol_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cor_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cor_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cov_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cov_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagvec_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagvec_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dotext_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_dotext_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_find_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_find_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_flip_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_flip_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_hist_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_hist_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_max_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_max_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_mean_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_mean_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_median_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_min_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_min_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_misc_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_misc_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_pinv_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_pinv_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_princomp_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_princomp_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_prod_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_prod_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_relational_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_relational_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_repmat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_repmat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_resize_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_resize_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_sort_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_sort_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_stddev_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_stddev_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_sum_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_symmat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_symmat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_unique_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_unique_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_var_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_div.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_minus.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_plus.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_relational.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_schur.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_times.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_div.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_minus.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_ostream.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_plus.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_relational.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_schur.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/operator_times.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/promote_type.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/restrictors.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/span.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/strip.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_elem1_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem2_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem2_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_field_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_field_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/typedef.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/typedef_blas_int.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/typedef_fixed.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/undefine_conflicts.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap_cube.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap_spmat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/upgrade_val.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/wall_clock_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/wall_clock_meat.hpp Log: Armadillo 0.3.910.0 Modified: pkg/RcppArmadillo/inst/include/armadillo =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo 2013-08-13 00:11:52 UTC (rev 4427) @@ -33,6 +33,7 @@ #if defined(ARMA_USE_CXX11) #include #include + // TODO: extend wall_clock class to use C++11 chrono library #endif @@ -40,6 +41,7 @@ #include #endif + #if defined(ARMA_HAVE_GETTIMEOFDAY) #include #undef ARMA_USE_BOOST_DATE @@ -59,23 +61,28 @@ #endif -#if defined(ARMA_HAVE_STD_TR1) - // TODO: add handling of this functionality when use of C++11 is enabled - #include - #include -#elif defined(ARMA_USE_BOOST) - #include - #include - #include - #include +#if !defined(ARMA_USE_CXX11) + #if defined(ARMA_HAVE_STD_TR1) + #include + #include + #elif defined(ARMA_USE_BOOST) + #include + #include + #include + #include + #endif #endif -#if defined(ARMA_USE_BOOST) - #if defined(ARMA_EXTRA_DEBUG) - #include - #include - #define ARMA_USE_BOOST_FORMAT +#if defined(ARMA_EXTRA_DEBUG) + #if !defined(ARMA_HAVE_STD_SNPRINTF) + #if defined(ARMA_USE_CXX11) + #include + #define ARMA_HAVE_STD_SNPRINTF + #elif defined(ARMA_USE_BOOST) + #include + #define ARMA_USE_BOOST_FORMAT + #endif #endif #endif @@ -206,6 +213,7 @@ #include "armadillo_bits/op_var_bones.hpp" #include "armadillo_bits/op_repmat_bones.hpp" #include "armadillo_bits/op_reshape_bones.hpp" + #include "armadillo_bits/op_vectorise_bones.hpp" #include "armadillo_bits/op_resize_bones.hpp" #include "armadillo_bits/op_cov_bones.hpp" #include "armadillo_bits/op_cor_bones.hpp" @@ -227,6 +235,8 @@ #include "armadillo_bits/op_unique_bones.hpp" #include "armadillo_bits/op_toeplitz_bones.hpp" #include "armadillo_bits/op_fft_bones.hpp" + #include "armadillo_bits/op_any_bones.hpp" + #include "armadillo_bits/op_all_bones.hpp" #include "armadillo_bits/glue_times_bones.hpp" #include "armadillo_bits/glue_mixed_bones.hpp" @@ -385,6 +395,7 @@ #include "armadillo_bits/fn_solve.hpp" #include "armadillo_bits/fn_repmat.hpp" #include "armadillo_bits/fn_reshape.hpp" + #include "armadillo_bits/fn_vectorise.hpp" #include "armadillo_bits/fn_resize.hpp" #include "armadillo_bits/fn_cov.hpp" #include "armadillo_bits/fn_cor.hpp" @@ -411,6 +422,8 @@ #include "armadillo_bits/fn_histc.hpp" #include "armadillo_bits/fn_unique.hpp" #include "armadillo_bits/fn_fft.hpp" + #include "armadillo_bits/fn_any.hpp" + #include "armadillo_bits/fn_all.hpp" #include "armadillo_bits/fn_speye.hpp" #include "armadillo_bits/fn_spones.hpp" @@ -425,12 +438,18 @@ // + // classes implementing various forms of dense matrix multiplication + + #include "armadillo_bits/mul_gemv.hpp" + #include "armadillo_bits/mul_gemm.hpp" + #include "armadillo_bits/mul_gemm_mixed.hpp" + #include "armadillo_bits/mul_syrk.hpp" + #include "armadillo_bits/mul_herk.hpp" + + + // // class meat - #include "armadillo_bits/gemv.hpp" - #include "armadillo_bits/gemm.hpp" - #include "armadillo_bits/gemm_mixed.hpp" - #include "armadillo_bits/eop_core_meat.hpp" #include "armadillo_bits/eglue_core_meat.hpp" @@ -485,6 +504,7 @@ #include "armadillo_bits/op_var_meat.hpp" #include "armadillo_bits/op_repmat_meat.hpp" #include "armadillo_bits/op_reshape_meat.hpp" + #include "armadillo_bits/op_vectorise_meat.hpp" #include "armadillo_bits/op_resize_meat.hpp" #include "armadillo_bits/op_cov_meat.hpp" #include "armadillo_bits/op_cor_meat.hpp" @@ -506,6 +526,8 @@ #include "armadillo_bits/op_unique_meat.hpp" #include "armadillo_bits/op_toeplitz_meat.hpp" #include "armadillo_bits/op_fft_meat.hpp" + #include "armadillo_bits/op_any_meat.hpp" + #include "armadillo_bits/op_all_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_mixed_meat.hpp" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2011 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/BaseCube_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2011 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2012 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2012 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -250,10 +250,10 @@ typedef typename T1::elem_type T; - arma_type_check(( is_complex::value == false )); //!< compile-time abort if eT isn't std::complex - arma_type_check(( is_complex< T>::value == true )); //!< compile-time abort if T is std::complex + arma_type_check(( is_complex::value == false )); //!< compile-time abort if eT is not std::complex + arma_type_check(( is_complex< T>::value == true )); //!< compile-time abort if T is std::complex - arma_type_check(( is_same_type< std::complex, eT >::value == false )); //!< compile-time abort if types are not compatible + arma_type_check(( is_same_type< std::complex, eT >::no )); //!< compile-time abort if types are not compatible const ProxyCube PX(X.get_ref()); const ProxyCube PY(Y.get_ref()); @@ -1233,7 +1233,7 @@ { arma_extra_debug_sigprint_this(this); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } @@ -1249,7 +1249,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); @@ -1267,7 +1267,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); @@ -1285,7 +1285,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); @@ -1303,7 +1303,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); @@ -1321,7 +1321,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); @@ -1346,7 +1346,7 @@ { arma_extra_debug_sigprint_this(this); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_cold(); @@ -1364,7 +1364,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); @@ -1395,7 +1395,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); eop_type::apply_inplace_plus(*this, X); @@ -1413,7 +1413,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); eop_type::apply_inplace_minus(*this, X); @@ -1431,7 +1431,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); eop_type::apply_inplace_schur(*this, X); @@ -1449,7 +1449,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); eop_type::apply_inplace_div(*this, X); @@ -1588,8 +1588,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); @@ -1606,8 +1606,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); @@ -1625,8 +1625,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); @@ -1644,8 +1644,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); @@ -1663,8 +1663,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); @@ -1689,8 +1689,8 @@ { arma_extra_debug_sigprint_this(this); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); init_cold(); @@ -1708,8 +1708,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); @@ -1740,8 +1740,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); eglue_type::apply_inplace_plus(*this, X); @@ -1759,8 +1759,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); eglue_type::apply_inplace_minus(*this, X); @@ -1778,8 +1778,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); eglue_type::apply_inplace_schur(*this, X); @@ -1797,8 +1797,8 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); - arma_type_check(( is_same_type< eT, typename T2::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); eglue_type::apply_inplace_div(*this, X); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2011-2013 Conrad Sanderson // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2011-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/GenCube_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2011-2013 Conrad Sanderson // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2011-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -37,11 +37,11 @@ eT GenCube::generate() { - if(is_same_type::value == true) { return eT(1); } - else if(is_same_type::value == true) { return eT(0); } - else if(is_same_type::value == true) { return eT(eop_aux_randu()); } - else if(is_same_type::value == true) { return eT(eop_aux_randn()); } - else { return eT(); } + if(is_same_type::yes) { return eT(1); } + else if(is_same_type::yes) { return eT(0); } + else if(is_same_type::yes) { return eT(eop_aux_randu()); } + else if(is_same_type::yes) { return eT(eop_aux_randn()); } + else { return eT(); } } @@ -86,10 +86,10 @@ // NOTE: we're assuming that the cube has already been set to the correct size; // this is done by either the Cube contructor or operator=() - if(is_same_type::value == true) { out.ones(); } - else if(is_same_type::value == true) { out.zeros(); } - else if(is_same_type::value == true) { out.randu(); } - else if(is_same_type::value == true) { out.randn(); } + if(is_same_type::yes) { out.ones(); } + else if(is_same_type::yes) { out.zeros(); } + else if(is_same_type::yes) { out.randu(); } + else if(is_same_type::yes) { out.randn(); } } Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2011-2013 Conrad Sanderson // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2011-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2011-2013 Conrad Sanderson // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2011-2013 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -38,11 +38,11 @@ { typedef typename T1::elem_type eT; - if(is_same_type::value == true) { return eT(1); } - else if(is_same_type::value == true) { return eT(0); } - else if(is_same_type::value == true) { return eT(eop_aux_randu()); } - else if(is_same_type::value == true) { return eT(eop_aux_randn()); } - else { return eT(); } + if(is_same_type::yes) { return eT(1); } + else if(is_same_type::yes) { return eT(0); } + else if(is_same_type::yes) { return eT(eop_aux_randu()); } + else if(is_same_type::yes) { return eT(eop_aux_randn()); } + else { return eT(); } } @@ -54,7 +54,7 @@ { typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { return ((ii % n_rows) == (ii / n_rows)) ? eT(1) : eT(0); } @@ -73,7 +73,7 @@ { typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { return (row == col) ? eT(1) : eT(0); } @@ -105,11 +105,11 @@ // NOTE: we're assuming that the matrix has already been set to the correct size; // this is done by either the Mat contructor or operator=() - if(is_same_type::value == true) { out.eye(); } - else if(is_same_type::value == true) { out.ones(); } - else if(is_same_type::value == true) { out.zeros(); } - else if(is_same_type::value == true) { out.randu(); } - else if(is_same_type::value == true) { out.randn(); } + if(is_same_type::yes) { out.eye(); } + else if(is_same_type::yes) { out.ones(); } + else if(is_same_type::yes) { out.zeros(); } + else if(is_same_type::yes) { out.randu(); } + else if(is_same_type::yes) { out.randn(); } } @@ -126,7 +126,7 @@ typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); @@ -173,7 +173,7 @@ typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); @@ -220,7 +220,7 @@ typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); @@ -268,7 +268,7 @@ typedef typename T1::elem_type eT; - if(is_same_type::value == true) + if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2010 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/GlueCube_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2010 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2012 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Glue_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2010 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2012 Ryan Curtin // // This Source Code Form is subject to the terms of the Mozilla Public Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-08-08 20:36:12 UTC (rev 4426) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-08-13 00:11:52 UTC (rev 4427) @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) -// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2012 Ryan Curtin // // This Source Code Form is subject to the terms of the Mozilla Public @@ -664,10 +664,10 @@ typedef typename T1::elem_type T; - arma_type_check(( is_complex::value == false )); //!< compile-time abort if eT isn't std::complex - arma_type_check(( is_complex< T>::value == true )); //!< compile-time abort if T is std::complex + arma_type_check(( is_complex::value == false )); //!< compile-time abort if eT is not std::complex + arma_type_check(( is_complex< T>::value == true )); //!< compile-time abort if T is std::complex - arma_type_check(( is_same_type< std::complex, eT >::value == false )); //!< compile-time abort if types are not compatible + arma_type_check(( is_same_type< std::complex, eT >::no )); //!< compile-time abort if types are not compatible const Proxy PX(X.get_ref()); const Proxy PY(Y.get_ref()); @@ -3457,7 +3457,7 @@ { arma_extra_debug_sigprint_this(this); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_cold(); @@ -3474,7 +3474,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_warm(X.n_rows, X.n_cols); @@ -3493,7 +3493,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_plus(*this); @@ -3510,7 +3510,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_minus(*this); @@ -3527,7 +3527,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat tmp(X); @@ -3544,7 +3544,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_schur(*this); @@ -3561,7 +3561,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_div(*this); @@ -3584,7 +3584,7 @@ { arma_extra_debug_sigprint_this(this); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } @@ -3600,7 +3600,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); @@ -3618,7 +3618,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); @@ -3636,7 +3636,7 @@ { arma_extra_debug_sigprint(); - arma_type_check(( is_same_type< eT, typename T1::elem_type >::value == false )); [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4427 From noreply at r-forge.r-project.org Tue Aug 13 02:16:58 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Aug 2013 02:16:58 +0200 (CEST) Subject: [Rcpp-commits] r4428 - pkg/RcppArmadillo Message-ID: <20130813001658.327BE1842E0@r-forge.r-project.org> Author: edd Date: 2013-08-13 02:16:57 +0200 (Tue, 13 Aug 2013) New Revision: 4428 Added: pkg/RcppArmadillo/vignettes/ Log: preparing to move inst/doc/* sources to vignettes/ From noreply at r-forge.r-project.org Tue Aug 13 02:56:02 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Aug 2013 02:56:02 +0200 (CEST) Subject: [Rcpp-commits] r4429 - in pkg/RcppArmadillo: . inst/doc vignettes vignettes/unitTests vignettes/unitTests-results Message-ID: <20130813005602.D98C8185160@r-forge.r-project.org> Author: edd Date: 2013-08-13 02:56:02 +0200 (Tue, 13 Aug 2013) New Revision: 4429 Added: pkg/RcppArmadillo/vignettes/Makefile pkg/RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw pkg/RcppArmadillo/vignettes/RcppArmadillo.bib pkg/RcppArmadillo/vignettes/elsarticle-harv.bst pkg/RcppArmadillo/vignettes/elsarticle.cls pkg/RcppArmadillo/vignettes/kalmanExample.pdf pkg/RcppArmadillo/vignettes/unitTests-results/ pkg/RcppArmadillo/vignettes/unitTests-results/RcppArmadillo-unitTests.html pkg/RcppArmadillo/vignettes/unitTests-results/RcppArmadillo-unitTests.txt pkg/RcppArmadillo/vignettes/unitTests/ Removed: pkg/RcppArmadillo/.Rinstignore pkg/RcppArmadillo/inst/doc/Makefile pkg/RcppArmadillo/inst/doc/RcppArmadillo-intro.Rnw pkg/RcppArmadillo/inst/doc/RcppArmadillo-unitTests.Rnw pkg/RcppArmadillo/inst/doc/RcppArmadillo.bib pkg/RcppArmadillo/inst/doc/elsarticle-harv.bst pkg/RcppArmadillo/inst/doc/elsarticle.cls pkg/RcppArmadillo/inst/doc/kalmanExample.pdf pkg/RcppArmadillo/inst/doc/unitTests/ Modified: pkg/RcppArmadillo/cleanup pkg/RcppArmadillo/vignettes/ pkg/RcppArmadillo/vignettes/unitTests/RcppArmadillo-unitTests.R Log: the inst/doc to vignettes/ move Deleted: pkg/RcppArmadillo/.Rinstignore =================================================================== --- pkg/RcppArmadillo/.Rinstignore 2013-08-13 00:16:57 UTC (rev 4428) +++ pkg/RcppArmadillo/.Rinstignore 2013-08-13 00:56:02 UTC (rev 4429) @@ -1,3 +0,0 @@ -inst/doc/Makefile -inst/doc/elsarticle-harv.bst -inst/doc/elsarticle.cls Modified: pkg/RcppArmadillo/cleanup =================================================================== --- pkg/RcppArmadillo/cleanup 2013-08-13 00:16:57 UTC (rev 4428) +++ pkg/RcppArmadillo/cleanup 2013-08-13 00:56:02 UTC (rev 4429) @@ -2,9 +2,18 @@ rm -f config.log config.status confdefs.h \ src/*.o src/*.so \ - inst/doc/RcppArmadillo-unitTests.out \ - inst/doc/RcppArmadillo-unitTests.aux \ - inst/doc/RcppArmadillo-unitTests.log \ - inst/doc/RcppArmadillo-intro.out \ + vignettes/RcppArmadillo-unitTests.out \ + vignettes/RcppArmadillo-unitTests.aux \ + vignettes/RcppArmadillo-unitTests.log \ + vignettes/RcppArmadillo-intro.out \ + vignettes/RcppArmadillo*.log \ + vignettes/RcppArmadillo*.aux \ + vignettes/RcppArmadillo*.out \ + vignettes/RcppArmadillo*.tex \ + vignettes/*.blg \ + vignettes/*.bbl \ + vignettes/*~ \ */*~ *~ -rm -rf autom4te.cache + +rm -rf autom4te.cache/ \ + vignettes/auto/ Deleted: pkg/RcppArmadillo/inst/doc/Makefile =================================================================== --- pkg/RcppArmadillo/inst/doc/Makefile 2013-08-13 00:16:57 UTC (rev 4428) +++ pkg/RcppArmadillo/inst/doc/Makefile 2013-08-13 00:56:02 UTC (rev 4429) @@ -1,31 +0,0 @@ - -all: RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf - -clean: - rm -f RcppArmadillo*.log RcppArmadillo*.aux RcppArmadillo*.out RcppArmadillo*.tex *.blg *.bbl *~ - rm -rf auto/ - -pdfclean: - rm -f RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf - -setvars: -ifeq (${R_HOME},) -R_HOME= $(shell R RHOME) -endif -RPROG= $(R_HOME)/bin/R -RSCRIPT=$(R_HOME)/bin/Rscript - -RcppArmadillo-unitTests.pdf: - rm -fr unitTests-results/* - $(RSCRIPT) unitTests/RcppArmadillo-unitTests.R - $(RPROG) CMD Sweave RcppArmadillo-unitTests.Rnw - $(RSCRIPT) -e "tools::texi2dvi( 'RcppArmadillo-unitTests.tex', pdf = TRUE, clean = TRUE )" - rm -fr RcppArmadillo-unitTests.tex - -RcppArmadillo-intro.pdf: - ${RPROG} CMD Sweave RcppArmadillo-intro.Rnw - pdflatex -shell-escape RcppArmadillo-intro - bibtex RcppArmadillo-intro - pdflatex -shell-escape RcppArmadillo-intro - pdflatex -shell-escape RcppArmadillo-intro - rm RcppArmadillo-intro.aux RcppArmadillo-intro.log RcppArmadillo-intro.bbl RcppArmadillo-intro.blg RcppArmadillo-intro.tex RcppArmadillo-intro.spl Deleted: pkg/RcppArmadillo/inst/doc/RcppArmadillo-intro.Rnw =================================================================== --- pkg/RcppArmadillo/inst/doc/RcppArmadillo-intro.Rnw 2013-08-13 00:16:57 UTC (rev 4428) +++ pkg/RcppArmadillo/inst/doc/RcppArmadillo-intro.Rnw 2013-08-13 00:56:02 UTC (rev 4429) @@ -1,1626 +0,0 @@ - -\documentclass[preprint,authoryear,times]{elsarticle} -%\VignetteIndexEntry{RcppArmadillo-introduction} -%\VignetteKeywords{R, C++, Armadillo, linear algebra, kalman filter} -%\VignettePackage{RcppArmadillo} - -\usepackage{url} % break URLs -\usepackage{booktabs} % fancier tables -\usepackage{color} % color use -\usepackage{minted} -%\usemintedstyle{bw} % enfore black/white for publication -\newminted{r}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} -\newminted{cpp}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} -\newminted{matlab}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} - -\usepackage[colorlinks]{hyperref}% for \href -\definecolor{link}{rgb}{0,0,0.3} % next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -%%% from jss.cls defs -\makeatletter -\newcommand\code{\bgroup\@makeother\_\@makeother\~\@makeother\$\@codex} -\def\@codex#1{{\normalfont\ttfamily\hyphenchar\font=-1 #1}\egroup} -\makeatother -%\newcommand{\proglang}[1]{\textsf{#1}} -\newcommand{\proglang}[1]{#1} % also neutering the proglang macro -\newcommand{\R}{\proglang{R}\ } % NB forces a space so not good before % fullstop etc. -\newcommand{\Rns}{\proglang{R}} % without the space -\newcommand{\Cpp}{\proglang{C++}\ } - -%\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}\index{#1}} -%\newcommand{\pkg}[1]{{\it #1}} -\newcommand{\pkg}[1]{{#1}} % null op for now - -\journal{Computational Statistics and Data Analysis} - - -<>= -prettyVersion <- packageDescription("RcppArmadillo")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -@ - -\begin{document} - -\begin{frontmatter} - - \title{RcppArmadillo: Accelerating R \\with High-Performance C++ Linear Algebra\footnote{ - This vignette corresponds to a - \href{http://dx.doi.org/10.1016/j.csda.2013.02.005}{paper published} in - \href{http://www.journals.elsevier.com/computational-statistics-and-data-analysis/}{Computational Statistics and Data Analysis}. - Currently still identical to the paper, this vignette version may over time receive minor updates. - For citations, please use \citet{Eddelbuettel+Sanderson:2013:RcppArmadillo} as provided by \code{citation("RcppArmadillo")}. - % - This version corresponds to \pkg{RcppArmadillo} version \Sexpr{prettyVersion} and was - typeset on \Sexpr{prettyDate}. - } - } - - \author[de]{Dirk Eddelbuettel}%\corref{cor}} - %\ead[de]{edd at debian.org} - % \ead[de,url]{http://dirk.eddelbuettel.com} - %\cortext[cor]{Corresponding author. Email: \url{edd at debian.org}.}% Postal address: 711 Monroe Avenue, - %River Forest, IL 60305, USA. } %he \pkg{RcppArmadillo} package is available - %with the electronic version of this article, as well as via every CRAN mirror.} - \address[de]{Debian Project, \url{http://www.debian.org}} - - \author[cs1,cs2]{Conrad Sanderson} - %\ead[cs1]{nowhere} % CS i'd prefer to leave out my email address - %\ead[cs1,url]{http://www.nicta.com.au/people/sandersonc} - %\ead[cs2,url]{http://itee.uq.edu.au/~conrad/} - \address[cs1]{NICTA, PO Box 6020, St Lucia, QLD 4067, Australia} - \address[cs2]{Queensland University of Technology (QUT), Brisbane, QLD 4000, Australia} - - \begin{abstract} - - \noindent - The \proglang{R} statistical environment and language has demonstrated - particular strengths for interactive development of statistical - algorithms, as well as data modelling and visualisation. Its current - implementation has an interpreter at its core which may result in a - performance penalty in comparison to directly executing user algorithms - in the native machine code of the host CPU. In contrast, the - \proglang{C++} language has no built-in visualisation capabilities, - handling of linear algebra or even basic statistical algorithms; however, - user programs are converted to high-performance machine code, ahead of - execution. - % - A new method avoids possible speed penalties in - \proglang{R} by using the \pkg{Rcpp} extension package in conjunction - with the \pkg{Armadillo} \Cpp matrix library. In addition to the - inherent performance advantages of compiled code, \pkg{Armadillo} - provides an easy-to-use template-based meta-programming framework, - allowing the automatic pooling of several linear algebra operations into - one, which in turn can lead to further speedups. - With the aid of \pkg{Rcpp} and \pkg{Armadillo}, conversion of linear - algebra centered algorithms from \proglang{R} to \proglang{C++} becomes - straightforward. The algorithms retains the overall structure as - well as readability, all while maintaining a bidirectional link with the - host R environment. Empirical timing comparisons of \proglang{R} and - \proglang{C++} implementations of a Kalman filtering algorithm indicate a - speedup of several orders of magnitude. - - \end{abstract} - - \begin{keyword} - Software \sep R \sep C++ \sep linear algebra - \end{keyword} - -\end{frontmatter} - - -\section{Overview} - -Linear algebra is a cornerstone of statistical computing and statistical -software systems. Various matrix decompositions, linear program solvers, and -eigenvalue / eigenvector computations are key to many estimation and analysis -routines. As generally useful procedures, these are often abstracted and -regrouped in specific libraries for linear algebra which statistical -programmers have provided for various programming languages and environments. - -One such environment and statistical programming language is R -\citep{R:Main}. It has become a tool of choice for data analysis and applied -statistics \citep{Morandat_2012}. While R has particular strengths -at fast prototyping and easy visualisation of data, its -implementation has an interpreter at its core. In comparison to running user -algorithms in the native machine code of the host CPU, the use of an -interpreter often results in a performance penalty for non-trivial algorithms -that perform elaborate data manipulation \citep{Morandat_2012}. With user -algorithms becoming more complex and increasing in functionality, as well as -with data sets which continue to increase in size, the issue of execution -speed becomes more important. - -The \Cpp language offers a complementary set of attributes: while it has no -built-in visualisation capabilities nor handling of linear algebra or -statistical methods, user programs are converted to high-performance machine -code ahead of execution. It is also inherently flexible. One key feature is -\textit{operator overloading} which allows the programmer to define custom -behaviour for mathematical operators such as $+$, $-$, $*$ -\citep{Meyers:2005:EffectiveC++}. \Cpp also provides language constructs -known as {\it templates}, originally intended to easily allow the reuse of -algorithms for various object types, and later extended to a programming -construct in its own right called \textit{template meta-programming} -\citep{Vandevoorde_2002,Abrahams_2004} - -Operator overloading allows mathematical operations to be extended to -user-defined objects, such as matrices. This in turn allows linear algebra -expressions to be written in a more natural manner (eg.~\mbox{$X = 0.1*A + - 0.2*B$}), rather than the far less readable traditional function call -syntax, eg.~\mbox{$X = \mbox{\it add}(\mbox{\it multiply}(0.1,A), \mbox{\it - multiply}(0.2,B))$}. - -Template meta-programming is the process of inducing the \Cpp compiler to -execute, at compile time, Turing-complete programs written in a somewhat -opaque subset of the \Cpp language~\citep{Vandevoorde_2002,Abrahams_2004}. -These meta-programs in effect generate further \Cpp code (often specialised -for particular object types), which is finally converted into machine code. - -An early and influential example of exploiting both meta-programming and -overloading of mathematical operators was provided by the Blitz++ library -\citep{Veldhuizen:1998:Blitz}, targeted for efficient processing of arrays. -Blitz++ employed elaborate meta-programming to avoid the generation of -temporary array objects during the evaluation of mathematical expressions. -However, the library's capabilities and usage were held back at the time by -the limited availability of compilers correctly implementing all the -necessary features and nuances of the \Cpp language. - -We present a new method of avoiding the speed penalty in R by -using the Rcpp extension package \citep{Eddelbuettel+Francois:2011:Rcpp, - CRAN:Rcpp,Eddelbuettel:2013:Rcpp} in conjunction with the \pkg{Armadillo} \Cpp linear algebra -library \citep{Sanderson:2010:Armadillo}. Similar to Blitz++, -\pkg{Armadillo} uses operator overloading and various template -meta-programming techniques to attain efficiency. However, it has been -written to target modern \Cpp compilers as well as providing a much larger -set of linear algebra operations than Blitz++. R programs augmented to use -\pkg{Armadillo} retain the overall structure as well as readability, all -while retaining a bidirectional link with the host R environment. - -Section~\ref{sec:arma} provides an overview of \pkg{Armadillo}, followed by -its integration with the Rcpp extension package. Section~\ref{sec:kalman} -shows an example of an R program and its conversion to \Cpp via Rcpp and -\pkg{Armadillo}. Section~\ref{sec:speed} discusses an empirical timing -comparison between the R and \Cpp versions before -Section~\ref{sec:conclusion} concludes. - - -\section{Armadillo} -\label{sec:arma} - -The \pkg{Armadillo} \Cpp library provides vector, matrix and cube types -(supporting integer, floating point and complex numbers) as well as a subset -of trigonometric and statistics functions~\citep{Sanderson:2010:Armadillo}. -In addition to elementary operations such as addition and matrix -multiplication, various matrix factorisations and submatrix manipulation -operations are provided. The corresponding application programming interface -(syntax) enables the programmer to write code which is both concise and -easy-to-read to those familiar with scripting languages such as -\proglang{Matlab} and \proglang{R}. Table~\ref{tab:arma} lists a few common -\pkg{Armadillo} functions. - -Matrix multiplication and factorisations are accomplished through integration -with the underlying operations stemming from standard numerical libraries -such as BLAS and LAPACK~\citep{Demmel_1997}. Similar to how environments -such as R are implemented, these underlying libraries can be replaced in a -transparent manner with variants that are optimised to the specific hardware -platform and/or multi-threaded to automatically take advantage of the -now-common multi-core platforms~\citep{Kurzak_2010}. - -\begin{table}[!b] - \centering - \footnotesize - \begin{tabular}{ll} - \toprule - \textbf{Armadillo function} \phantom{XXXXXXX} & \textbf{Description} \\ - \midrule - \code{X(1,2) = 3} & Assign value 3 to element at location (1,2) of matrix $X$ \\ % DE shortened to fit on \textwidth - \code{X = A + B} & Add matrices $A$ and $B$ \\ - \code{X( span(1,2), span(3,4) )} & Provide read/write access to submatrix of $X$ \\ - \code{zeros(rows [, cols [, slices]))} & Generate vector (or matrix or cube) of zeros\\ - \code{ones(rows [, cols [, slices]))} & Generate vector (or matrix or cube) of ones\\ - \code{eye(rows, cols)} & Matrix diagonal set to 1, off-diagonal elements set to 0 \\ - %\code{linspace(start, end, N=100)} & $N$ element vector with elements from start to end \\ - \code{repmat(X, row_copies, col_copies)} & Replicate matrix $X$ in block-like manner \\ - \code{det(X)} & Returns the determinant of matrix $X$\\ - %\code{dot(A, B)} & Dot-product of confirming vectors $A$ and $B$ \\ - \code{norm(X, p)} & Compute the $p$-norm of matrix or vector $X$\\ - \code{rank(X)} & Compute the rank of matrix $X$ \\ - %\code{trace(X)} & Compute the trace of matrix $X$ \\ - %\code{diagvec(X, k=0)} & Extracts the $k$-th diagnonal from matrix $X$\\ - \code{min(X, dim=0)};~ \code{max(X, dim=0)} & Extremum value of each column~of $X$~(row if \code{dim=1}) \\ - \code{trans(X)} ~or~ \code{X.t()} & Return transpose of $X$ \\ - \code{R = chol(X)} & Cholesky decomposition of $X$ such that $R^{T} R = X$ \\ - \code{inv(X)} ~or~ \code{X.i()} & Returns the inverse of square matrix $X$ \\ - \code{pinv(X)} & Returns the pseudo-inverse of matrix $X$ \\ - \code{lu(L, U, P, X)} & LU decomp.~with partial pivoting; also \code{lu(L, U, X)} \\ - %\code{lu(L, U, P, X)} & LU decomposition with partial pivoting \\ - \code{qr(Q, R, X)} & QR decomp.~into orthogonal $Q$ and right-triangular $R$\\ - \code{X = solve(A, B)} & Solve system $AX = B$ for $X$ \\ - \code{s = svd(X); svd(U, s, V, X)} & Singular-value decomposition of $X$ \\ - \bottomrule - \end{tabular} -\caption{Selected \pkg{Armadillo} functions with brief descriptions; see - \texttt{http://arma.sf.net/docs.html} for more complete - documentation. Several optional additional arguments have been omitted - here for brevity.\label{tab:arma}} -\end{table} - -\pkg{Armadillo} uses a delayed evaluation approach to combine several -operations into one and reduce (or eliminate) the need for temporary objects. -In contrast to brute-force evaluations, delayed evaluation can provide -considerable performance improvements as well as reduced memory usage. -The delayed evaluation machinery is accomplished through template -meta-programming~\citep{Vandevoorde_2002,Abrahams_2004}, where the \Cpp -compiler is induced to reason about mathematical expressions at {\it compile - time}. Where possible, the \Cpp compiler can generate machine code that is -tailored for each expression. - -As an example of the possible efficiency gains, let us consider the -expression \mbox{$X = A - B + C$}, where $A$, $B$ and $C$ are matrices. A -brute-force implementation would evaluate $A-B$ first and store the result in -a temporary matrix $T$. The next operation would be \mbox{$T + C$}, with the -result finally stored in $X$. The creation of the temporary matrix, and -using two separate loops for the subtraction and addition of matrix elements -is suboptimal from an efficiency point of view. - -Through the overloading of mathematical operators, \pkg{Armadillo} avoids the -generation of the temporary matrix by first converting the expression into a -set of lightweight \code{Glue} objects, which only store references to the -matrices and \pkg{Armadillo}'s representations of mathematical expressions -(eg.~other \code{Glue} objects). To indicate that an operation comprised of -subtraction and addition is required, the exact type of the \code{Glue} -objects is automatically inferred from the given expression through template -meta-programming. More specifically, given the expression \mbox{$X = A - B + - C$}, \pkg{Armadillo} automatically induces the compiler to generate an -instance of the lightweight \code{Glue} storage object with the following -\Cpp {\it type}: - -\centerline{~} -\centerline{\code{Glue< Glue, Mat, glue\_plus>}} -\centerline{~} - -\noindent -where \code{Glue<...>} indicates that \code{Glue} is a C++ template class, -with the items between `\code{<}' and `\code{>}' specifying template -parameters; the outer \code{Glue<..., Mat, glue\_plus>} is the \code{Glue} -object indicating an addition operation, storing a reference to a matrix as -well as a reference to another \code{Glue} object; the inner \code{Glue} stores references to two matrices and indicates a -subtraction operation. In both the inner and outer \code{Glue}, the type -\code{Mat} specifies that a reference to a matrix object is to be held. - -The expression evaluator in \pkg{Armadillo} is then automatically invoked -through the ``\code{=}'' operation, which interprets (at compile time) the -template parameters of the compound \code{Glue} object and generates \Cpp -code equivalent to: - -\centerline{~} -\centerline{\code{for(int i=0; i library(inline) -R> -R> g <- cxxfunction(signature(vs="numeric"), -+ plugin="RcppArmadillo", body=' -+ arma::vec v = Rcpp::as(vs); -+ arma::mat op = v * v.t(); -+ double ip = arma::as_scalar(v.t() * v); -+ return Rcpp::List::create(Rcpp::Named("outer")=op, -+ Rcpp::Named("inner")=ip); -+') -R> g(7:11) -$outer - [,1] [,2] [,3] [,4] [,5] -[1,] 49 56 63 70 77 -[2,] 56 64 72 80 88 -[3,] 63 72 81 90 99 -[4,] 70 80 90 100 110 -[5,] 77 88 99 110 121 - -$inner -[1] 415 -\end{rcode} -\end{listing} - -Consider the simple example in Listing~\ref{code:RcppArmaEx}. Given a -vector, the \code{g()} function returns both the outer and inner products. -We load the inline package \citep{CRAN:inline}, which provides -\code{cxxfunction()} that we use to compile, link and load the \Cpp code -which is passed as the \code{body} argument. We declare the function -signature to contain a single argument named `\code{vs}'. On line five, this -argument is used to instantiate an \pkg{Armadillo} column vector object named -`\code{v}' (using the templated conversion function \code{as()} from Rcpp). -In lines six and seven, the outer and inner product of the column vector -are calculated by appropriately multiplying the vector with its transpose. -This shows how the \code{*} operator for multiplication has been overloaded -to provide the appropriate operation for the types implemented by -\pkg{Armadillo}. The inner product creates a scalar variable, and in -contrast to \R where each object is a vector type (even if of length one), we -have to explicitly convert using \code{as_scalar()} to assign the value to a -variable of type \code{double}. - - -Finally, the last line creates an \R named list type containing both results. -As a result of calling \code{cxxfunction()}, a new function is created. It -contains a reference to the native code, compiled on the fly based on the -\Cpp code provided to \code{cxxfunction()} and makes it available directly -from \R under a user-assigned function name, here \code{g()}. The listing -also shows how the \code{Rcpp} and \code{arma} namespaces are used to -disambiguate symbols from the two libraries; the \code{::} operator is -already familiar to R programmers who use the NAMESPACE directive in \R in a -similar fashion. - -The listing also demonstrates how the new function \code{g()} can be called -with a suitable argument. Here we create a vector of five elements, -containing values ranging from 7 to 11. The function's output, here the list -containing both outer and inner product, is then displayed as it is not -assigned to a variable. - -This simple example illustrates how \R objects can be transferred directly -into corresponding \pkg{Armadillo} objects using the interface code provided -by \pkg{Rcpp}. It also shows how deployment of \pkg{RcppArmadillo} is -straightforward, even for interactive work where functions can be compiled on -the fly. Similarly, usage in packages is also uncomplicated and follows the -documentation provided with \pkg{Rcpp}~\citep{CRAN:Rcpp,Eddelbuettel:2013:Rcpp}. - - -\section{Kalman Filtering Example} -\label{sec:kalman} - -The Kalman filter is ubiquitous in many engineering disciplines as well as in -statistics and econometrics~\citep{Tusell:2010:Kalman}. A recent example of an -application is volatility extraction in a diffusion option pricing model~\citep{Li_CSDA_2013}. -Even in its simplest linear form, the Kalman filter can provide simple estimates -by recursively applying linear updates which are robust to noise and can cope -with missing data. Moreover, the estimation process is lightweight and fast, -and consumes only minimal amounts of memory as few state variables are required. -% -We discuss a standard example below. The (two-dimensional) position of an -object is estimated based on past values. A $6 \times 1$ state vector -includes $X$ and $Y$ coordinates determining the position, two variables for -speed (or velocity) $V_X$ and $V_Y$ relative to the two coordinates, as well -as two acceleration variables $A_X$ and $A_Y$. - -We have the positions being updated as a function of the velocity - -\begin{displaymath} - X = X_0 + V_X dt - \mbox{\phantom{XX} and \phantom{XX}} - Y = Y_0 + V_Y dt, -\end{displaymath} - -\noindent -and the velocity being updated as a function of the (unobserved) acceleration: - -\begin{displaymath} - V_x = V_{X,0} + A_X dt - \mbox{\phantom{XX} and \phantom{XX}} - V_y = V_{Y,0} + A_Y dt. -\end{displaymath} - -% \begin{eqnarray*} -% X & = & X_0 + V_x dt \\ -% Y & = & Y_0 + V_y dt \\ -% V_x & = & V_{x,0} + A_x dt \\ -% V_y & = & V_{y,0} + A_y dt \\ -% \end{eqnarray*} - -With covariance matrices $Q$ and $R$ for (Gaussian) error terms, the standard -Kalman filter estimation involves a linear prediction step resulting in a new -predicted state vector, and a new covariance estimate. This leads to a -residuals vector and a covariance matrix for residuals which are used to -determine the (optimal) Kalman gain, which is then used to update the state -estimate and covariance matrix. - -All of these steps involve only matrix multiplication and inversions, making -the algorithm very suitable for an implementation in any language which -can use matrix expressions. An example for \proglang{Matlab} is provided on -the Mathworks website\footnote{See - \url{http://www.mathworks.com/products/matlab-coder/demos.html?file=/products/demos/shipping/coder/coderdemo_kalman_filter.html}.} -and shown in Listing~\ref{code:matlabkalman}. - -\begin{listing}[t!] -\caption{Basic Kalman Filter in \proglang{Matlab}.\label{code:matlabkalman}} -\begin{matlabcode} -% Copyright 2010 The MathWorks, Inc. -function y = kalmanfilter(z) - dt=1; - % Initialize state transition matrix - A=[ 1 0 dt 0 0 0; 0 1 0 dt 0 0;... % [x ], [y ] - 0 0 1 0 dt 0; 0 0 0 1 0 dt;... % [Vx], [Vy] - 0 0 0 0 1 0 ; 0 0 0 0 0 1 ]; % [Ax], [Ay] - H = [ 1 0 0 0 0 0; 0 1 0 0 0 0 ]; % Init. measuremnt mat - Q = eye(6); - R = 1000 * eye(2); - persistent x_est p_est % Init. state cond. - if isempty(x_est) - x_est = zeros(6, 1); % x_est=[x,y,Vx,Vy,Ax,Ay]' - p_est = zeros(6, 6); - end - - x_prd = A * x_est; % Predicted state and covariance - p_prd = A * p_est * A' + Q; - - S = H * p_prd' * H' + R; % Estimation - B = H * p_prd'; - klm_gain = (S \ B)'; - - % Estimated state and covariance - x_est = x_prd + klm_gain * (z - H * x_prd); - p_est = p_prd - klm_gain * H * p_prd; - y = H * x_est; % Compute the estimated measurements -end % of the function -\end{matlabcode} -\end{listing} -%function x = kalmanExample -% load pos.txt; % renamed here -% x = kalmanM(pos); - - -\begin{listing}[b!] -\caption{Basic Kalman filter in \Rns ~ (referred to as {\it FirstKalmanR}).\label{code:FirstKalmanR}} -\begin{rcode} -FirstKalmanR <- function(pos) { - - kalmanfilter <- function(z) { - dt <- 1 - A <- matrix(c( 1, 0, dt, 0, 0, 0, 0, 1, 0, dt, 0, 0, # x, y - 0, 0, 1, 0, dt, 0, 0, 0, 0, 1, 0, dt, # Vx, Vy - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), # Ax, Ay - 6, 6, byrow=TRUE) - H <- matrix( c(1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), - 2, 6, byrow=TRUE) - Q <- diag(6) - R <- 1000 * diag(2) - - xprd <- A %*% xest # predicted state and covriance - pprd <- A %*% pest %*% t(A) + Q - - S <- H %*% t(pprd) %*% t(H) + R # estimation - B <- H %*% t(pprd) - kalmangain <- t(solve(S, B)) - - ## estimated state and covariance, assign to vars in parent env - xest <<- xprd + kalmangain %*% (z - H %*% xprd) - pest <<- pprd - kalmangain %*% H %*% pprd - - ## compute the estimated measurements - y <- H %*% xest - } - xest <- matrix(0, 6, 1) - pest <- matrix(0, 6, 6) - - N <- nrow(pos) - y <- matrix(NA, N, 2) - for (i in 1:N) { - y[i,] <- kalmanfilter(t(pos[i,,drop=FALSE])) - } - invisible(y) -} -\end{rcode} -\end{listing} - -A straightforward \R implementation can be written as a close transcription -of the \proglang{Matlab} version; we refer to this version as -\code{FirstKalmanR}. It is shown in Listing~\ref{code:FirstKalmanR}. -A slightly -improved version (where several invariant statements are moved out of the -repeatedly-called function) is provided in Listing~\ref{code:Rkalman} on -page~\pageref{code:Rkalman} showing the function \code{KalmanR}. The -estimates of the state vector and its covariance matrix are updated -iteratively. The \proglang{Matlab} implementation uses two variables -declared `persistent' for this. In \Rns, which does not have such an -attribute for variables, we store them in the enclosing environment of the -outer function \code{KalmanR}, which contains an inner function -\code{kalmanfilter} that is called for each observation. - -\pkg{Armadillo} provides efficient vector and matrix classes to implement the -Kalman filter. In Listing~\ref{code:CppKalmanClass} on -page~\pageref{code:CppKalmanClass}, we show a simple \Cpp class containing a -basic constructor as well as one additional member function. The constructor -can be used to initialise all variables as we are guaranteed that the code in -the class constructor will be executed exactly once when this class is -instantiated. A class also makes it easy to add `persistent' local -variables, which is a feature we need here. Given such a class, the -estimation can be accessed from \R via a short and simple routine such as the -one shown in Listing~\ref{code:InlineKalman}. - -\begin{listing}[H] -\caption{An improved Kalman filter implemented in \Rns ~ (referred to as {\it KalmanR}).\label{code:Rkalman}} -\begin{rcode} -KalmanR <- function(pos) { - - kalmanfilter <- function(z) { - ## predicted state and covariance - xprd <- A %*% xest - pprd <- A %*% pest %*% t(A) + Q - - ## estimation - S <- H %*% t(pprd) %*% t(H) + R - B <- H %*% t(pprd) - - kalmangain <- t(solve(S, B)) - - ## estimated state and covariance - ## assigned to vars in parent env - xest <<- xprd + kalmangain %*% (z - H %*% xprd) - pest <<- pprd - kalmangain %*% H %*% pprd - - ## compute the estimated measurements - y <- H %*% xest - } - - dt <- 1 - A <- matrix( c( 1, 0, dt, 0, 0, 0, # x - 0, 1, 0, dt, 0, 0, # y - 0, 0, 1, 0, dt, 0, # Vx - 0, 0, 0, 1, 0, dt, # Vy - 0, 0, 0, 0, 1, 0, # Ax - 0, 0, 0, 0, 0, 1), # Ay - 6, 6, byrow=TRUE) - H <- matrix( c(1, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0), - 2, 6, byrow=TRUE) - Q <- diag(6) - R <- 1000 * diag(2) - N <- nrow(pos) - Y <- matrix(NA, N, 2) - - xest <- matrix(0, 6, 1) - pest <- matrix(0, 6, 6) - - for (i in 1:N) { - Y[i,] <- kalmanfilter(t(pos[i,,drop=FALSE])) - } - invisible(Y) -} -\end{rcode} -\end{listing} - -\begin{listing}[H] -\caption{A Kalman filter class in \proglang{C++}, using \pkg{Armadillo} classes.\label{code:CppKalmanClass} -} -\begin{cppcode} -using namespace arma; - -class Kalman { -private: - mat A, H, Q, R, xest, pest; - double dt; - -public: - // constructor, sets up data structures - Kalman() : dt(1.0) { - A.eye(6,6); - A(0,2) = A(1,3) = A(2,4) = A(3,5) = dt; - H.zeros(2,6); - H(0,0) = H(1,1) = 1.0; - Q.eye(6,6); - R = 1000 * eye(2,2); - xest.zeros(6,1); - pest.zeros(6,6); - } - - // sole member function: estimate model - mat estimate(const mat & Z) { - unsigned int n = Z.n_rows, k = Z.n_cols; - mat Y = zeros(n, k); - mat xprd, pprd, S, B, kalmangain; - colvec z, y; - - for (unsigned int i = 0; i Author: edd Date: 2013-08-13 04:01:35 +0200 (Tue, 13 Aug 2013) New Revision: 4430 Modified: pkg/RcppArmadillo/vignettes/ pkg/RcppArmadillo/vignettes/Makefile pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw Log: set some more svn ignores Property changes on: pkg/RcppArmadillo/vignettes ___________________________________________________________________ Modified: svn:ignore - unitTests-results/ unitTests-results/ RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf + unitTests-results/ unitTests-results/ RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf unitTests-results/RcppArmadillo-unitTests.R unitTests-results/RcppArmadillo-unitTests.txt unitTests-results/RcppArmadillo-unitTests.html Modified: pkg/RcppArmadillo/vignettes/Makefile =================================================================== --- pkg/RcppArmadillo/vignettes/Makefile 2013-08-13 00:56:02 UTC (rev 4429) +++ pkg/RcppArmadillo/vignettes/Makefile 2013-08-13 02:01:35 UTC (rev 4430) @@ -1,5 +1,5 @@ -all: RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf +all: RcppArmadillo-intro.pdf pdfclean: rm -f RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf @@ -11,17 +11,12 @@ RPROG= $(R_HOME)/bin/R RSCRIPT=$(R_HOME)/bin/Rscript -RcppArmadillo-unitTests.pdf: - rm -fr unitTests-results/* - $(RSCRIPT) unitTests/RcppArmadillo-unitTests.R - $(RPROG) CMD Sweave RcppArmadillo-unitTests.Rnw - $(RSCRIPT) -e "tools::texi2dvi( 'RcppArmadillo-unitTests.tex', pdf = TRUE, clean = TRUE )" - rm -fr RcppArmadillo-unitTests.tex - -RcppArmadillo-intro.pdf: +RcppArmadillo-intro.pdf: ${RPROG} CMD Sweave RcppArmadillo-intro.Rnw pdflatex -shell-escape RcppArmadillo-intro bibtex RcppArmadillo-intro pdflatex -shell-escape RcppArmadillo-intro pdflatex -shell-escape RcppArmadillo-intro - rm RcppArmadillo-intro.aux RcppArmadillo-intro.log RcppArmadillo-intro.bbl RcppArmadillo-intro.blg RcppArmadillo-intro.tex RcppArmadillo-intro.spl + rm RcppArmadillo-intro.aux RcppArmadillo-intro.log \ + RcppArmadillo-intro.bbl RcppArmadillo-intro.blg \ + RcppArmadillo-intro.tex RcppArmadillo-intro.spl Modified: pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw =================================================================== --- pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw 2013-08-13 00:56:02 UTC (rev 4429) +++ pkg/RcppArmadillo/vignettes/RcppArmadillo-unitTests.Rnw 2013-08-13 02:01:35 UTC (rev 4430) @@ -1,20 +1,65 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{RcppArmadillo-unitTests} +%\VignetteKeywords{R,Armadillo,Rcpp,unit tests} +%\VignettePackage{RcppArmadillo} + \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(RcppArmadillo) +prettyVersion <- packageDescription("RcppArmadillo")$Version +prettyDate <- format(Sys.Date(), "%B %e, %Y") +library(RUnit) +@ + \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}} + \begin{document} \maketitle +\section*{Test Execution} + +<>= +pkg <- "RcppArmadillo" +if (file.exists("unitTests-results")) unlink("unitTests-results", recursive = TRUE) +dir.create("unitTests-results") +pathRcppArmadilloTests <<- 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} -<>= -if( file.exists( "unitTests-results/RcppArmadillo-unitTests.txt" ) ){ - writeLines( readLines( "unitTests-results/RcppArmadillo-unitTests.txt" ) ) +<>= +results <- "unitTests-results/RcppArmadillo-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 Tue Aug 13 04:37:09 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Aug 2013 04:37:09 +0200 (CEST) Subject: [Rcpp-commits] r4431 - pkg/RcppArmadillo/vignettes Message-ID: <20130813023709.BD9981855A0@r-forge.r-project.org> Author: edd Date: 2013-08-13 04:37:09 +0200 (Tue, 13 Aug 2013) New Revision: 4431 Removed: pkg/RcppArmadillo/vignettes/unitTests/ Modified: pkg/RcppArmadillo/vignettes/Makefile Log: removing unitTests/, code now in Rnw; updated Makefile Modified: pkg/RcppArmadillo/vignettes/Makefile =================================================================== --- pkg/RcppArmadillo/vignettes/Makefile 2013-08-13 02:01:35 UTC (rev 4430) +++ pkg/RcppArmadillo/vignettes/Makefile 2013-08-13 02:37:09 UTC (rev 4431) @@ -11,12 +11,14 @@ RPROG= $(R_HOME)/bin/R RSCRIPT=$(R_HOME)/bin/Rscript -RcppArmadillo-intro.pdf: +RcppArmadillo-intro.tex: RcppArmadillo-intro.Rnw ${RPROG} CMD Sweave RcppArmadillo-intro.Rnw + +RcppArmadillo-intro.pdf: RcppArmadillo-intro.tex pdflatex -shell-escape RcppArmadillo-intro bibtex RcppArmadillo-intro pdflatex -shell-escape RcppArmadillo-intro pdflatex -shell-escape RcppArmadillo-intro - rm RcppArmadillo-intro.aux RcppArmadillo-intro.log \ + rm RcppArmadillo-intro.aux RcppArmadillo-intro.log RcppArmadillo-intro.out \ RcppArmadillo-intro.bbl RcppArmadillo-intro.blg \ RcppArmadillo-intro.tex RcppArmadillo-intro.spl From noreply at r-forge.r-project.org Tue Aug 13 04:46:30 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Aug 2013 04:46:30 +0200 (CEST) Subject: [Rcpp-commits] r4432 - in pkg/RcppArmadillo: . debian inst Message-ID: <20130813024630.DFC061856CF@r-forge.r-project.org> Author: edd Date: 2013-08-13 04:46:29 +0200 (Tue, 13 Aug 2013) New Revision: 4432 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/inst/NEWS.Rd Log: RcppArmadillo release 0.3.910.0 Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-13 02:37:09 UTC (rev 4431) +++ pkg/RcppArmadillo/ChangeLog 2013-08-13 02:46:29 UTC (rev 4432) @@ -1,7 +1,12 @@ -2013-08-08 Dirk Eddelbuettel +2013-08-12 Dirk Eddelbuettel - * Empty commit at Stefan's request to tickle a built + * DESCRIPTION: Release 0.3.910.0 + * inst/NEWS: Release 0.3.910.0 + * inst/include/*: Upgraded to new release 3.910.0 of Armadillo + * debian/*: Similarly updated for new release to Debian + * vignettes/*: Moved files from inst/doc per new CRAN standards + 2013-08-03 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/spmat.h: Added basic as<> and Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-13 02:37:09 UTC (rev 4431) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-13 02:46:29 UTC (rev 4432) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.900.7.1 +Version: 0.3.910.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.900.7). Thus users do not need to + Armadillo library (currently version 3.910.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-08-13 02:37:09 UTC (rev 4431) +++ pkg/RcppArmadillo/debian/changelog 2013-08-13 02:46:29 UTC (rev 4432) @@ -1,3 +1,9 @@ +r-cran-rcpparmadillo (0.3.910.0-1) unstable; urgency=low + + * New upstream release + + -- Dirk Eddelbuettel Mon, 12 Aug 2013 19:10:20 -0500 + r-cran-rcpparmadillo (0.3.900.7-1) unstable; urgency=low * New upstream release Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-13 02:37:09 UTC (rev 4431) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-13 02:46:29 UTC (rev 4432) @@ -2,15 +2,19 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{Changes in RcppArmadillo version 0.x.yyy.z (2013-aa-bb)}{ +\section{Changes in RcppArmadillo version 0.3.910.0 (2013-08-12)}{ \itemize{ - \item Upgraded to Armadillo release Version ... + \item Upgraded to Armadillo release Version 3.910.0 (Pyrenees) \itemize{ - \item - \item + \item faster multiplication of a matrix with a transpose of + itself, ie. \code{X*X.t()} and \code{X.t()*X} + \item added \code{vectorise()} for reshaping matrices into vectors + \item added \code{all()} and \code{any()} for indicating presence + of elements satisfying a relational condition } \item Added conversion support for sparse matrices (of type double) created by the \cpkg{Matrix} package as class \code{dgCMatrix} + \item Moved vignette sources from \code{inst/doc} to \code{vignettes} } } From noreply at r-forge.r-project.org Thu Aug 15 12:24:25 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 15 Aug 2013 12:24:25 +0200 (CEST) Subject: [Rcpp-commits] r4433 - in pkg/RcppArmadillo: . inst Message-ID: <20130815102425.95CB7184AD0@r-forge.r-project.org> Author: edd Date: 2013-08-15 12:24:25 +0200 (Thu, 15 Aug 2013) New Revision: 4433 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/NEWS.Rd Log: summarize BuildVignettes: FALSE changes needed for CRAN Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-13 02:46:29 UTC (rev 4432) +++ pkg/RcppArmadillo/ChangeLog 2013-08-15 10:24:25 UTC (rev 4433) @@ -6,6 +6,9 @@ * debian/*: Similarly updated for new release to Debian * vignettes/*: Moved files from inst/doc per new CRAN standards + * DESCRIPTION: Set 'BuildVignettes: FALSE' as LaTeX minted mode + creates issues for the CRAN builders + * inst/doc/*: Include pre-built vignettes 2013-08-03 Dirk Eddelbuettel Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-13 02:46:29 UTC (rev 4432) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-15 10:24:25 UTC (rev 4433) @@ -36,3 +36,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 +BuildVignettes: FALSE Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-13 02:46:29 UTC (rev 4432) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-15 10:24:25 UTC (rev 4433) @@ -14,7 +14,9 @@ } \item Added conversion support for sparse matrices (of type double) created by the \cpkg{Matrix} package as class \code{dgCMatrix} - \item Moved vignette sources from \code{inst/doc} to \code{vignettes} + \item Moved vignette sources from \code{inst/doc} to \code{vignettes}; + set \code{BuildVignettes: FALSE} as the \code{minted} mode for + \code{LaTeX} upsets the CRAN builders. } } From noreply at r-forge.r-project.org Sun Aug 18 00:31:23 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 18 Aug 2013 00:31:23 +0200 (CEST) Subject: [Rcpp-commits] r4434 - in pkg/RcppArmadillo: . inst vignettes Message-ID: <20130817223123.59167184599@r-forge.r-project.org> Author: edd Date: 2013-08-18 00:31:23 +0200 (Sun, 18 Aug 2013) New Revision: 4434 Removed: pkg/RcppArmadillo/vignettes/Makefile Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw Log: converted (main) vignette from LaTeX minted (a no-go on CRAN) to listings removed BuildVignettes: FALSE from DESCRIPTION removed vignettes/Makefile which is no longer needed Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-15 10:24:25 UTC (rev 4433) +++ pkg/RcppArmadillo/ChangeLog 2013-08-17 22:31:23 UTC (rev 4434) @@ -1,3 +1,10 @@ +2013-08-17 Dirk Eddelbuettel + + * vignettes/RcppArmadillo-intro.Rnw: Converted from LaTeX minted + (which farms out to Python's pygmentize) to LaTeX listings (which is + plainer, but works on CRAN) + * DESCRIPTION: Remove 'BuildVignettes: FALSE' + 2013-08-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.910.0 Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-08-15 10:24:25 UTC (rev 4433) +++ pkg/RcppArmadillo/DESCRIPTION 2013-08-17 22:31:23 UTC (rev 4434) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.910.0 +Version: 0.3.910.0.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Doug Bates Maintainer: Dirk Eddelbuettel @@ -36,4 +36,3 @@ 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 -BuildVignettes: FALSE Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-15 10:24:25 UTC (rev 4433) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-17 22:31:23 UTC (rev 4434) @@ -2,6 +2,14 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppArmadillo version 0.3.910.0.1 (2013-08-17)}{ + \itemize{ + \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)}{ \itemize{ \item Upgraded to Armadillo release Version 3.910.0 (Pyrenees) Deleted: pkg/RcppArmadillo/vignettes/Makefile =================================================================== --- pkg/RcppArmadillo/vignettes/Makefile 2013-08-15 10:24:25 UTC (rev 4433) +++ pkg/RcppArmadillo/vignettes/Makefile 2013-08-17 22:31:23 UTC (rev 4434) @@ -1,24 +0,0 @@ - -all: RcppArmadillo-intro.pdf - -pdfclean: - rm -f RcppArmadillo-unitTests.pdf RcppArmadillo-intro.pdf - -setvars: -ifeq (${R_HOME},) -R_HOME= $(shell R RHOME) -endif -RPROG= $(R_HOME)/bin/R -RSCRIPT=$(R_HOME)/bin/Rscript - -RcppArmadillo-intro.tex: RcppArmadillo-intro.Rnw - ${RPROG} CMD Sweave RcppArmadillo-intro.Rnw - -RcppArmadillo-intro.pdf: RcppArmadillo-intro.tex - pdflatex -shell-escape RcppArmadillo-intro - bibtex RcppArmadillo-intro - pdflatex -shell-escape RcppArmadillo-intro - pdflatex -shell-escape RcppArmadillo-intro - rm RcppArmadillo-intro.aux RcppArmadillo-intro.log RcppArmadillo-intro.out \ - RcppArmadillo-intro.bbl RcppArmadillo-intro.blg \ - RcppArmadillo-intro.tex RcppArmadillo-intro.spl Modified: pkg/RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw =================================================================== --- pkg/RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw 2013-08-15 10:24:25 UTC (rev 4433) +++ pkg/RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw 2013-08-17 22:31:23 UTC (rev 4434) @@ -7,12 +7,36 @@ \usepackage{url} % break URLs \usepackage{booktabs} % fancier tables \usepackage{color} % color use -\usepackage{minted} -%\usemintedstyle{bw} % enfore black/white for publication -\newminted{r}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} -\newminted{cpp}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} -\newminted{matlab}{linenos,firstnumber=1,stepnumber=2,frame=lines,fontsize=\small} +\usepackage{listings} +\definecolor{darkgray}{rgb}{0.975,0.975,0.975} +\lstset{ % + %basicstyle=\small, % the size of the fonts that are used for the code + numbers=left, % where to put the line-numbers + numberstyle=\tiny, % the size of the fonts that are used for the line-numbers + stepnumber=2, % the step between two line-numbers. If it's 1, each line + % will be numbered + numbersep=5pt, % how far the line-numbers are from the code + backgroundcolor=\color{darkgray}, % choose the background color. Must add \usepackage{color} + showspaces=false, % show spaces adding particular underscores + showstringspaces=false, % underline spaces within strings + showtabs=false, % show tabs within strings adding particular underscores + %frame=single, % adds a frame around the code + tabsize=2, % sets default tabsize to 2 spaces + captionpos=b, % sets the caption-position to bottom + breaklines=true, % sets automatic line breaking + breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace + %title=\lstname, % show the filename of files included with \lstinputlisting; + % also try caption instead of title + %escapeinside={\%*}{*)}, % if you want to add a comment within your code + %morekeywords={*,...} % if you want to add more keywords to the set + % + basicstyle=\ttfamily\small, + commentstyle=\textsl, + keywordstyle=\ttfamily\small + %keywordstyle=\color{black}\bfseries\tt +} + \usepackage[colorlinks]{hyperref}% for \href \definecolor{link}{rgb}{0,0,0.3} % next few lines courtesy of RJournal.sty \hypersetup{ @@ -35,14 +59,14 @@ \newcommand{\Cpp}{\proglang{C++}\ } %\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}\index{#1}} -%\newcommand{\pkg}[1]{{\it #1}} + %\newcommand{\pkg}[1]{{\it #1}} \newcommand{\pkg}[1]{{#1}} % null op for now \journal{Computational Statistics and Data Analysis} <>= -prettyVersion <- packageDescription("RcppArmadillo")$Version +prettyVersion <- packageDescription("RcppArmadillo")$Version #$ prettyDate <- format(Sys.Date(), "%B %e, %Y") @ @@ -331,11 +355,12 @@ templates, \R objects such as vectors and matrices can be mapped directly to the corresponding \pkg{Armadillo} objects. -\begin{listing}[b!] -\caption{Integrating \pkg{Armadillo}-based C++ code via the - \mbox{RcppArmadillo} package.\label{code:RcppArmaEx} +\lstset{ + language=R, + caption={Integrating \pkg{Armadillo}-based C++ code via the \mbox{RcppArmadillo} package.}, + label={code:RcppArmaEx} } -\begin{rcode} +\begin{lstlisting}[frame=tb] R> library(inline) R> R> g <- cxxfunction(signature(vs="numeric"), @@ -357,8 +382,7 @@ $inner [1] 415 -\end{rcode} -\end{listing} +\end{lstlisting} Consider the simple example in Listing~\ref{code:RcppArmaEx}. Given a vector, the \code{g()} function returns both the outer and inner products. @@ -457,9 +481,13 @@ \url{http://www.mathworks.com/products/matlab-coder/demos.html?file=/products/demos/shipping/coder/coderdemo_kalman_filter.html}.} and shown in Listing~\ref{code:matlabkalman}. -\begin{listing}[t!] -\caption{Basic Kalman Filter in \proglang{Matlab}.\label{code:matlabkalman}} -\begin{matlabcode} +\lstset{ + language=matlab, + basicstyle=\ttfamily\footnotesize, + caption={Basic Kalman filter in \proglang{Matlab}.}, + label={code:matlabkalman} +} +\begin{lstlisting}[frame=tb] % Copyright 2010 The MathWorks, Inc. function y = kalmanfilter(z) dt=1; @@ -476,7 +504,7 @@ p_est = zeros(6, 6); end - x_prd = A * x_est; % Predicted state and covariance + x_prd = A * x_est; % Predicted state + covar. p_prd = A * p_est * A' + Q; S = H * p_prd' * H' + R; % Estimation @@ -486,18 +514,21 @@ % Estimated state and covariance x_est = x_prd + klm_gain * (z - H * x_prd); p_est = p_prd - klm_gain * H * p_prd; - y = H * x_est; % Compute the estimated measurements + y = H * x_est; % Comp. estim. measurements end % of the function -\end{matlabcode} -\end{listing} -%function x = kalmanExample +\end{lstlisting} +% function x = kalmanExample % load pos.txt; % renamed here % x = kalmanM(pos); -\begin{listing}[b!] -\caption{Basic Kalman filter in \Rns ~ (referred to as {\it FirstKalmanR}).\label{code:FirstKalmanR}} -\begin{rcode} +\lstset{ + language=R, + basicstyle=\ttfamily\small, + caption={Basic Kalman filter in \Rns ~ (referred to as {\it FirstKalmanR}).}, + label={code:FirstKalmanR} +} +\begin{lstlisting}[frame=tb] FirstKalmanR <- function(pos) { kalmanfilter <- function(z) { @@ -535,8 +566,7 @@ } invisible(y) } -\end{rcode} -\end{listing} +\end{lstlisting} A straightforward \R implementation can be written as a close transcription of the \proglang{Matlab} version; we refer to this version as @@ -563,9 +593,13 @@ estimation can be accessed from \R via a short and simple routine such as the one shown in Listing~\ref{code:InlineKalman}. -\begin{listing}[H] -\caption{An improved Kalman filter implemented in \Rns ~ (referred to as {\it KalmanR}).\label{code:Rkalman}} -\begin{rcode} +\lstset{ + language=R, + basicstyle=\ttfamily\small, + caption={An improved Kalman filter implemented in \Rns ~ (referred to as {\it KalmanR}).}, + label={code:Rkalman} +} +\begin{lstlisting}[frame=tb] KalmanR <- function(pos) { kalmanfilter <- function(z) { @@ -612,13 +646,15 @@ } invisible(Y) } -\end{rcode} -\end{listing} +\end{lstlisting} -\begin{listing}[H] -\caption{A Kalman filter class in \proglang{C++}, using \pkg{Armadillo} classes.\label{code:CppKalmanClass} +\lstset{ + language=C++, + basicstyle=\ttfamily\small, + caption={A Kalman filter class in \proglang{C++}, using \pkg{Armadillo} classes.}, + label={code:CppKalmanClass} } -\begin{cppcode} +\begin{lstlisting}[frame=tb] using namespace arma; class Kalman { @@ -665,16 +701,19 @@ return Y; } }; -\end{cppcode} -\end{listing} +\end{lstlisting} -\begin{listing}[H] - \caption{A Kalman filter function implemented in a mixture of \proglang{R} +\lstset{ + language=R, + basicstyle=\ttfamily\small, + caption={A Kalman filter function implemented in a mixture of \proglang{R} and \proglang{C++} code, using the \pkg{RcppArmadillo} package to embed \pkg{Armadillo} based \proglang{C++} code (using the {\it Kalman} class from Listing~\ref{code:CppKalmanClass}) within R code. - The resulting program is referred to as {\it KalmanCpp}.\label{code:InlineKalman}} -\begin{rcode} + The resulting program is referred to as {\it KalmanCpp}.}, + label={code:InlineKalman} +} +\begin{lstlisting}[frame=tb] R> kalmanSrc <- ' + mat Z = as(ZS); // passed from R + Kalman K; @@ -683,8 +722,7 @@ R> KalmanCpp <- cxxfunction(signature(ZS="numeric"), + body=kalmanSrc, include=kalmanClass, + plugin="RcppArmadillo") -\end{rcode} -\end{listing} +\end{lstlisting} The content of Listing~\ref{code:CppKalmanClass} is assigned to a variable \code{kalmanClass} which (on line seven) is passed to the \code{include=} @@ -720,9 +758,13 @@ \section{Empirical Speed Comparison} \label{sec:speed} -\begin{listing}[t!] -\caption{R code for timing comparison of Kalman filter implementations.\label{code:BenchmarkKalman}} -\begin{rcode} +\lstset{ + language=R, + basicstyle=\ttfamily\small, + caption={R code for timing comparison of Kalman filter implementations.}, + label={code:BenchmarkKalman} +} +\begin{lstlisting}[frame=tb] R> require(rbenchmark) R> require(compiler) R> @@ -744,8 +786,7 @@ + "elapsed", "relative"), + order="relative", + replications=100) -\end{rcode} -\end{listing} +\end{lstlisting} Listing~\ref{code:BenchmarkKalman} contains the code for creating a simple benchmarking exercise. It compares several functions for implementing the @@ -871,755 +912,8 @@ \bibliographystyle{elsarticle-harv} \bibliography{RcppArmadillo} - - -% ----------------------------------------------------------------------------- -\iffalse -\title{RcppArmadillo: \\ Easily Extending R with High-Performance C++ Code} -\author{Dirk Eddelbuettel \and Conrad Sanderson} -\date{\pkg{RcppArmadillo} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} - -\maketitle - -\begin{abstract} - - \noindent - The \proglang{R} statistical environment and language has demonstrated - particular strengths for interactive development of statistical - algorithms, as well as data modelling and visualisation. Its current - implementation has an interpreter at its core which may result in a - performance penalty in comparison to directly executing user algorithms - in the native machine code of the host CPU. In contrast, the - \proglang{C++} language has no built-in visualisation capabilities, - handling of linear algebra or even basic statistical algorithms; however, - user programs are converted to high-performance machine code, ahead of - execution. - % - We present a new method of avoiding possible speed penalties in - \proglang{R} by using the \pkg{Rcpp} extension package in conjunction - with the \pkg{Armadillo} \Cpp matrix library. In addition to the - inherent performance advantages of compiled code, \pkg{Armadillo} - provides an easy-to-use template-based meta-programming framework, - allowing the automatic pooling of several linear algebra operations into - one, which in turn can lead to further speedups. We demonstrate that - with the aid of \pkg{Rcpp} and \pkg{Armadillo}, conversion of linear - algebra centered algorithms from \proglang{R} to \proglang{C++} becomes - straightforward, with the algorithms retaining the overall structure as - well as readability, all while maintaining a bidirectional link with the - host R environment. Empirical timing comparisons of \proglang{R} and - \proglang{C++} implementations of a Kalman filtering algorithm indicate a - speedup of several orders of magnitude. - -\end{abstract} - -\section{Overview} - -Linear algebra is a cornerstone of statistical computing and statistical -software systems. Various matrix decompositions, linear program solvers, and -eigenvalue / eigenvector computations are key to many estimation and analysis -routines. As generally useful procedure, these are often abstracted and -regrouped in specific libraries for linear algebra which statistical -programmers have provided for various programming languages and environments. - -One such environment (and statistical programming language) is R -\citep{R:Main}. It has become a tool of choice for data analysis and applied -work in statistics \citep{Morandat_2012}. While R has particular strengths -at fast prototyping and easy visualisation of data, its current -implementation has an interpreter at its core. In comparison to running user -algorithms in the native machine code of the host CPU, the use of an -interpreter often results in a performance penalty for non-trivial algorithms -that perform elaborate data manipulation \citep{Morandat_2012}. With user -algorithms becoming more complex and increasing in functionality, as well as -with data sets which continue to increase in size, the issue of execution -speed becomes more important. - -The \Cpp language offers a complementary set of attributes: while it has no -built-in visualisation capabilities nor handling of linear algebra or -statistical methods, user programs are converted to high-performance machine -code ahead of execution. It is also inherently flexible. One key feature is -\textit{operator overloading} which allows the programmer to define custom -behaviour for mathematical operators such as $+$, $-$, $*$ -\citep{Meyers:2005:EffectiveC++}. \Cpp also provides language constructs -known as {\it templates}, originally intended to easily allow the reuse of -algorithms for various object types, and later extended to a programming -construct in its own right called \textit{template meta-programming} -\citep{Vandevoorde_2002,Abrahams_2004} - -Operator overloading allows mathematical operations to be extended to -user-defined objects, such as matrices. This in turn allows linear algebra -expressions to be written in a more natural manner (eg.~\mbox{$X = 0.1*A + - 0.2*B$}), rather than the far less readable traditional function call -syntax, eg.~\mbox{$X = \mbox{\it add}(\mbox{\it multiply}(0.1,A), \mbox{\it - multiply}(0.2,B))$}. - -Template meta-programming is the process of inducing the \Cpp compiler to -execute, at compile time, Turing-complete programs written in a somewhat -opaque subset of the \Cpp language~\citep{Vandevoorde_2002,Abrahams_2004}. -These meta-programs in effect generate further \Cpp code (often specialised -for particular object types), which is finally converted into machine code. - -An early and influential example of exploiting both meta-programming and -overloading of mathematical operators was provided by the Blitz++ library -\citep{Veldhuizen:1998:Blitz}, targeted for efficient processing of arrays. -Blitz++ employed elaborate meta-programming to avoid the generation of -temporary array objects during the evaluation of mathematical expressions. -However, the library's capabilities and usage were held back at the time by -the limited availability of compilers correctly implementing all the -necessary features and nuances of the \Cpp language. - -In this paper we present a new method of avoiding the speed penalty in R: -using the Rcpp extension package \citep{Eddelbuettel+Francois:2011:Rcpp, - CRAN:Rcpp} in conjunction with the \pkg{Armadillo} \Cpp linear algebra -library \citep{Sanderson:2010:Armadillo}. In a similar manner to Blitz++, -\pkg{Armadillo} uses operator overloading and various template -meta-programming techniques to attain efficiency. However, it has been -written to target modern \Cpp compilers as well as providing a much larger -set of linear algebra operations than Blitz++. R programs augmented to use -\pkg{Armadillo} retain the overall structure as well as readability, all -while retaining a bidirectional link with the host R environment. - -We continue the paper as follows. In Section~\ref{sec:arma} we provide an -overview of the \pkg{Armadillo} \Cpp library, followed by its integration -with the Rcpp extension package in Section~\ref{sec:rcpparma}. In -Section~\ref{sec:kalman} we provide an example of an R program and its -conversion to \Cpp via the use of Rcpp and \pkg{Armadillo}. -Section~\ref{sec:speed} provides an empirical timing comparison between the R -and \Cpp versions. We conclude the paper in Section~\ref{sec:conclusion}. - - -\section{Armadillo} -\label{sec:arma} - -The \pkg{Armadillo} \Cpp library provides vector, matrix and cube types -(supporting integer, floating point and complex numbers) as well as a subset -of trigonometric and statistics functions~\citep{Sanderson:2010:Armadillo}. -In addition to elementary operations such as addition and matrix -multiplication, various matrix factorisations and other commonly-used -functions are provided. The corresponding application programming interface -(syntax) enables the programmer to write code which is both concise yet -easy-to-read to those familiar with scripting languages such as -\proglang{Matlab} and \proglang{R}. Table~\ref{tab:arma} lists a few common -Armadillo functions. - -Matrix multiplication and factorisations are accomplished through integration -with the underlying operations stemming from standard numerical libraries -such as BLAS and LAPACK~\citep{Demmel_1997}. Similar to how environments -such as R are implemented, these underlying libraries can be replaced in a -transparent manner with variants that are optimised to the specific hardware -platform and/or multi-threaded, to automatically take advantage of the -now-common multi-core platforms~\citep{Kurzak_2010}. - -%% CS: Talking about cubes and fields currentlly seems like a digression... -%% However, cubes do add to the overall "meat" of the paper -%% -% Armadillo also provides cubes and fields. Cubes generalize matrices to three dimensions, -% and (just like vectors and matrices) can contain either integer, floating-point or -% complex types. Fields are similar to R list type as they allow the collection -% of objects of types in a single variable. - -\begin{table}[!b] - \centering - \footnotesize - \begin{tabular}{ll} - \toprule - \textbf{Armadillo function} \phantom{XXXXXXX} & \textbf{Description} \\ - \midrule - \code{X(1,2) = 3} & Assign value 3 to element at location (1,2) of matrix $X$ \\ % DE shortened to fit on \textwidth - \code{X = A + B} & Add matrices $A$ and $B$ \\ - \code{X( span(1,2), span(3,4) )} & Provide read/write access to submatrix of $X$ \\ - \code{zeros(rows [, cols [, slices]))} & Generate vector (or matrix or cube) of zeros\\ - \code{ones(rows [, cols [, slices]))} & Generate vector (or matrix or cube) of ones\\ - \code{eye(rows, cols)} & Matrix diagonal set to 1, off-diagonal elements set to 0 \\ - %\code{linspace(start, end, N=100)} & $N$ element vector with elements from start to end \\ - \code{repmat(X, row_copies, col_copies)} & Replicate matrix $X$ in block-like manner \\ - \code{det(X)} & Returns the determinant of matrix $X$\\ - %\code{dot(A, B)} & Dot-product of confirming vectors $A$ and $B$ \\ - \code{norm(X, p)} & Compute the $p$-norm of matrix or vector $X$\\ - \code{rank(X)} & Compute the rank of matrix $X$ \\ - %\code{trace(X)} & Compute the trace of matrix $X$ \\ - %\code{diagvec(X, k=0)} & Extracts the $k$-th diagnonal from matrix $X$\\ - \code{min(X, dim=0)};~ \code{max(X, dim=0)} & Extremum value of each column~of $X$~(row if \code{dim=1}) \\ - \code{trans(X)} ~or~ \code{X.t()} & Return transpose of $X$ \\ - \code{R = chol(X)} & Cholesky decomposition of $X$ such that $R^{T} R = X$ \\ - \code{inv(X)} ~or~ \code{X.i()} & Returns the inverse of square matrix $X$ \\ - \code{pinv(X)} & Returns the pseudo-inverse of matrix $X$ \\ - \code{lu(L, U, P, X)} & LU decomp.~with partial pivoting; also \code{lu(L, U, X)} \\ - %\code{lu(L, U, P, X)} & LU decomposition with partial pivoting \\ - \code{qr(Q, R, X)} & QR decomp.~into orthogonal $Q$ and right-triangular $R$\\ - \code{X = solve(A, B)} & Solve system $AX = B$ for $X$ \\ - \code{s = svd(X); svd(U, s, V, X)} & Singular-value decomposition of $X$ \\ - \bottomrule - \end{tabular} -\caption{Selected Armadillo functions with brief descriptions; see - \texttt{http://arma.sf.net/docs.html} for more complete - documentation. Several optional additional arguments have been omitted - here for brevity.} -\label{tab:arma} -\end{table} - -\pkg{Armadillo} uses a delayed evaluation approach to combine several -operations into one and reduce (or eliminate) the need for temporary objects. -In contrast to brute-force evaluations, delayed evaluation can provide -considerable performance improvements as well as reduced memory usage. The -delayed evaluation machinery accomplished through template -meta-programming~\citep{Vandevoorde_2002,Abrahams_2004}, where the \Cpp -compiler is induced to reason about mathematical expressions at {\it compile - time}. Where possible, the \Cpp compiler can generate machine code that is -tailored for each expression. - -As an example of the possible efficiency gains, let us consider the -expression \mbox{$X = A - B + C$}, where $A$, $B$ and $C$ are matrices. A -brute-force implementation would evaluate $A-B$ first and store the result in -a temporary matrix $T$. The next operation would be \mbox{$T + C$}, with the -result finally stored in $X$. The creation of the temporary matrix, and -using two separate loops for the subtraction and addition of matrix elements -is suboptimal from an efficiency point of view. - -Through the overloading of mathematical operators, \pkg{Armadillo} avoids the -generation of the temporary matrix by first converting the expression into a -set of lightweight \code{Glue} objects, which only store references to the -matrices and Armadillo's representations of mathematical expressions -(eg.~other \code{Glue} objects). To indicate that an operation comprised of -subtraction and addition is required, the exact type of the \code{Glue} -objects is automatically inferred from the given expression through template -meta-programming. More specifically, given the expression \mbox{$X = A - B + - C$}, \pkg{Armadillo} automatically induces the compiler to generate an -instance of the lightweight \code{Glue} storage object with the following -\Cpp {\it type}: - -\centerline{~} -\centerline{\code{Glue< Glue, Mat, glue\_plus>}} -\centerline{~} - -\noindent -where \code{Glue<...>} indicates that \code{Glue} is a C++ template class, -with the items between `\code{<}' and `\code{>}' specifying template -parameters; the outer \code{Glue<..., Mat, glue\_plus>} is the \code{Glue} -object indicating an addition operation, storing a reference to a matrix as -well as a reference to another \code{Glue} object; the inner \code{Glue} stores references to two matrices and indicates a -subtraction operation. In both the inner and outer \code{Glue}, the type -\code{Mat} specifies that a reference to matrix object is to be held. - -The expression evaluator in \pkg{Armadillo} is then automatically invoked -through the ``\code{=}'' operation, which interprets (at compile time) the -template parameters of the compound \code{Glue} object and generates \Cpp -code equivalent to: - -\centerline{~} -\centerline{\code{for(int i=0; i -R> library(inline) -R> -R> g <- cxxfunction(signature(vs="numeric"), -+ plugin="RcppArmadillo", body=' -+ arma::vec v = Rcpp::as(vs); -+ arma::mat op = v * v.t(); -+ double ip = arma::as_scalar(v.t() * v); -+ return Rcpp::List::create(Rcpp::Named("outer")=op, -+ Rcpp::Named("inner")=ip); -+') -R> -R> g(7:11) -$outer - [,1] [,2] [,3] [,4] [,5] -[1,] 49 56 63 70 77 -[2,] 56 64 72 80 88 -[3,] 63 72 81 90 99 -[4,] 70 80 90 100 110 -[5,] 77 88 99 110 121 - -$inner -[1] 415 - -R> -\end{lstlisting} - -Finally, the last line creates an \R named list type containing both results. -As a result of calling \code{cxxfunction()}, a new function is created. It -contains a reference to the native code, compiled on the fly based on the -\Cpp code provided to \code{cxxfunction()} and makes it available directly -from \R under a user-assigned function name, here \code{g()}. The listing -also shows how the \code{Rcpp} and \code{arma} namespaces are used to -disambiguate symbols from the different libraries; the \code{::} operator is -already familiar to R programmers who use the NAMESPACE directive in \R in a -similar fashion. - -The listing also demonstrates how the new function \code{g()} can be called -with a suitable argument. Here we create a vector of five elements, -containing values ranging from 7 to 11. The function's output, here the list -containing both outer and inner product, is then displayed as it is not -assigned to a variable. - -This simple example illustrates how \R objects can be transferred directly -into corresponding \pkg{Armadillo} objects using the interface code provided -by \pkg{Rcpp}. It also shows how deployment of \pkg{RcppArmadillo} is -straightforward, even for interactive work where functions can be compiled on -the fly. Similarly, usage in packages is also uncomplicated and follows the -documentation provided with \pkg{Rcpp}~\citep{CRAN:Rcpp}. - -As of mid-2012, there are nineteen R packages on CRAN which deploy -RcppArmadillo\footnote{See - \url{http://cran.r-project.org/web/packages/RcppArmadillo/}}, showing both -the usefulness of RcppArmadillo and its acceptance by the R community. - - -\section{Kalman Filtering Example} -\label{sec:kalman} - -The Kalman filter is ubiquitous in many engineering disciplines as well as in -statistics and econometrics~\citep{Tusell:2010:Kalman}. Even its simplest -linear form, the Kalman filter can provide simple estimates by recursively -applying linear updates which are robust to noise and can cope with missing -data. Moreover, the estimation process is lightweight and fast, and consumes -only minimal amounts of memory as few state variables are required. - -We discuss a standard example below. The (two-dimensional) position of an -object is estimated based on past values. A $6 \times 1$ state vector -includes $X$ and $Y$ coordinates determining the position, two variables for -speed (or velocity) $V_X$ and $V_Y$ relative to the two coordinates, as well -as two acceleration variables $A_X$ and $A_Y$. - -We have the positions being updated as a function of the velocity - -\begin{displaymath} - X = X_0 + V_X dt - \mbox{\phantom{XX} and \phantom{XX}} - Y = Y_0 + V_Y dt -\end{displaymath} - -\noindent -and the velocity being updated as a function of the (unobserved) acceleration: - -\begin{displaymath} - V_x = V_{X,0} + A_X dt - \mbox{\phantom{XX} and \phantom{XX}} - V_y = V_{Y,0} + A_Y dt -\end{displaymath} - -% \begin{eqnarray*} -% X & = & X_0 + V_x dt \\ -% Y & = & Y_0 + V_y dt \\ -% V_x & = & V_{x,0} + A_x dt \\ -% V_y & = & V_{y,0} + A_y dt \\ -% \end{eqnarray*} - -With covariance matrices $Q$ and $R$ for (Gaussian) error terms, the standard -Kalman filter estimation involves a linear prediction step resulting in a new -predicted state vector, and a new covariance estimate. This leads to a -residuals vector and a covariance matrix for residuals which are used to -determine the (optimal) Kalman gain, which is then used to update the state -estimate and covariance matrix. - -All of these steps involve only matrix multiplication and inversions, making -the algorithm very suitable for an fast implementation in any language which -can use matrix expressions. An example for \proglang{Matlab} is provided on -the Mathworks website.\footnote{See - \url{http://www.mathworks.com/products/matlab-coder/demos.html?file=/products/demos/shipping/coder/coderdemo_kalman_filter.html}.} - [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4434 From noreply at r-forge.r-project.org Tue Aug 20 11:30:16 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 20 Aug 2013 11:30:16 +0200 (CEST) Subject: [Rcpp-commits] r4435 - in pkg/RcppArmadillo: . inst inst/include Message-ID: <20130820093016.97CD5184BAE@r-forge.r-project.org> Author: romain Date: 2013-08-20 11:30:16 +0200 (Tue, 20 Aug 2013) New Revision: 4435 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h Log: implementation of wrap Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-17 22:31:23 UTC (rev 4434) +++ pkg/RcppArmadillo/ChangeLog 2013-08-20 09:30:16 UTC (rev 4435) @@ -1,3 +1,7 @@ +2013-08-20 Romain Francois + + * include/RcppArmadilloWrap.h: Handle wrap + 2013-08-17 Dirk Eddelbuettel * vignettes/RcppArmadillo-intro.Rnw: Converted from LaTeX minted Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-17 22:31:23 UTC (rev 4434) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-20 09:30:16 UTC (rev 4435) @@ -2,6 +2,12 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppArmadillo version (future)}{ + \itemize{ + \item Initial Implementation of wrap + } +} + \section{Changes in RcppArmadillo version 0.3.910.0.1 (2013-08-17)}{ \itemize{ \item Converted main vignette from \code{LaTeX} style \code{minted} Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-17 22:31:23 UTC (rev 4434) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-20 09:30:16 UTC (rev 4435) @@ -44,6 +44,7 @@ template SEXP wrap ( const arma::Col& ) ; template SEXP wrap ( const arma::field& ) ; template SEXP wrap ( const arma::Cube& ) ; + template SEXP wrap ( const arma::subview& ) ; template SEXP wrap(const arma::Glue& X ) ; Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-17 22:31:23 UTC (rev 4434) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-20 09:30:16 UTC (rev 4435) @@ -43,6 +43,16 @@ return ::Rcpp::wrap(object.memptr() , object.memptr() + object.n_elem); } + template + SEXP arma_subview_wrap( const arma::subview& data, int nrows, int ncols ){ + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; + Rcpp::Matrix mat( nrows, ncols ) ; + for( int j=0, k=0; j SEXP wrap( const arma::subview& data ){ + return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; + } + + + namespace RcppArmadillo { /* Importer class for field */ From noreply at r-forge.r-project.org Tue Aug 20 17:23:17 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 20 Aug 2013 17:23:17 +0200 (CEST) Subject: [Rcpp-commits] r4436 - in pkg/RcppArmadillo: . inst/include inst/include/RcppArmadilloExtensions Message-ID: <20130820152317.F33711850E0@r-forge.r-project.org> Author: romain Date: 2013-08-20 17:23:17 +0200 (Tue, 20 Aug 2013) New Revision: 4436 Added: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h Removed: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadillo.h pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h Log: cleaner implementations of wrap and as for SpMat Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-20 09:30:16 UTC (rev 4435) +++ pkg/RcppArmadillo/ChangeLog 2013-08-20 15:23:17 UTC (rev 4436) @@ -1,6 +1,8 @@ 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 Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadillo.h 2013-08-20 09:30:16 UTC (rev 4435) +++ pkg/RcppArmadillo/inst/include/RcppArmadillo.h 2013-08-20 15:23:17 UTC (rev 4436) @@ -30,6 +30,7 @@ #include #include #include +#include #include #endif Added: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h (rev 0) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-08-20 15:23:17 UTC (rev 4436) @@ -0,0 +1,91 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ +// +// RcppArmadilloAs.h: Rcpp/Armadillo glue, support for as +// +// Copyright (C) 2013 Dirk Eddelbuettel, Romain Francois +// +// This file is part of RcppArmadillo. +// +// RcppArmadillo 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. +// +// RcppArmadillo 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 RcppArmadillo. If not, see . + +#ifndef RcppArmadillo__RcppArmadilloAs__h +#define RcppArmadillo__RcppArmadilloAs__h + +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::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< arma::SpMat > { + public: + Exporter( SEXP x ) : mat(x){} + + arma::SpMat get(){ + IntegerVector dims = mat.slot("Dim"); + arma::urowvec i = Rcpp::as(mat.slot("i")); + arma::urowvec p = Rcpp::as(mat.slot("p")); + arma::Col x = Rcpp::as< arma::Col >(mat.slot("x")); + + int nrow = dims[0], ncol = dims[1]; + arma::SpMat res(nrow, ncol); + + // 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); + arma::arrayops::copy(arma::access::rwp(res.row_indices), i.begin(), i.size() + 1); + + // create space for col_ptrs, and copy + arma::access::rw(res.col_ptrs) = arma::memory::acquire(p.size() + 2); + arma::arrayops::copy(arma::access::rwp(res.col_ptrs), p.begin(), p.size() + 1); + + // 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 ; + } ; +} +} + +#endif + Deleted: pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h 2013-08-20 09:30:16 UTC (rev 4435) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/spmat.h 2013-08-20 15:23:17 UTC (rev 4436) @@ -1,101 +0,0 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- -/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ -// -// spmat.h: Conversion between Armadillo sp_mat and the dgCMatrix from Matrix -// -// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois -// -// This file is part of RcppArmadillo. -// -// RcppArmadillo 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. -// -// RcppArmadillo 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 RcppArmadillo. If not, see . - -#ifndef RcppArmadillo__SpMat__h -#define RcppArmadillo__SpMat__h - -#include - -namespace Rcpp { - - - // converts an SEXP object from R which was created as a sparse - // matrix via the Matrix package) into an Armadillo sp_mat matrix - // - // TODO: template'ize to allow for types other than double, though - // realistically this is all we need - template <> arma::sp_mat as(SEXP sx) { - S4 mat(sx); - IntegerVector dims = mat.slot("Dim"); - arma::urowvec i = Rcpp::as(mat.slot("i")); - arma::urowvec p = Rcpp::as(mat.slot("p")); - arma::vec x = Rcpp::as(mat.slot("x")); - - int nrow = dims[0], ncol = dims[1]; - arma::sp_mat res(nrow, ncol); - - // 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); - arma::arrayops::copy(arma::access::rwp(res.row_indices), i.begin(), i.size() + 1); - - // create space for col_ptrs, and copy - arma::access::rw(res.col_ptrs) = arma::memory::acquire(p.size() + 2); - arma::arrayops::copy(arma::access::rwp(res.col_ptrs), p.begin(), p.size() + 1); - - // 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; - } - - - // convert an Armadillo sp_mat into a corresponding R sparse matrix - // we copy to STL vectors as the Matrix package expects vectors whereas the - // default wrap in Armadillo returns matrix with one row (or col) - SEXP wrap(arma::sp_mat sm) { - - IntegerVector dim(2); - dim[0] = sm.n_rows; - dim[1] = sm.n_cols; - - arma::vec x(sm.n_nonzero); // create space for values, and copy - arma::arrayops::copy(x.begin(), sm.values, sm.n_nonzero); - std::vector vx = arma::conv_to< std::vector< double > >::from(x); - - arma::urowvec i(sm.n_nonzero); // create space for row_indices, and copy & cast - arma::arrayops::copy(i.begin(), sm.row_indices, sm.n_nonzero); - std::vector vi = arma::conv_to< std::vector< int > >::from(i); - - arma::urowvec p(sm.n_cols+1); // create space for col_ptrs, and copy - arma::arrayops::copy(p.begin(), sm.col_ptrs, sm.n_cols+1); - // do not copy sentinel for returning R - std::vector vp = arma::conv_to< std::vector< int > >::from(p); - - S4 s("dgCMatrix"); - s.slot("i") = vi; - s.slot("p") = vp; - s.slot("x") = vx; - s.slot("Dim") = dim; - return s; - } - -} - -#endif Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-20 09:30:16 UTC (rev 4435) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2013-08-20 15:23:17 UTC (rev 4436) @@ -45,6 +45,7 @@ template SEXP wrap ( const arma::field& ) ; template SEXP wrap ( const arma::Cube& ) ; template SEXP wrap ( const arma::subview& ) ; + template SEXP wrap ( const arma::SpMat& ) ; template SEXP wrap(const arma::Glue& X ) ; @@ -88,6 +89,7 @@ template class Exporter< arma::Mat > ; template class Exporter< arma::Row > ; template class Exporter< arma::Col > ; + template class Exporter< arma::SpMat > ; // template class Exporter< arma::field > ; // template class Exporter< arma::Cube > ; Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-20 09:30:16 UTC (rev 4435) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-20 15:23:17 UTC (rev 4436) @@ -43,42 +43,67 @@ return ::Rcpp::wrap(object.memptr() , object.memptr() + object.n_elem); } - template - SEXP arma_subview_wrap( const arma::subview& data, int nrows, int ncols ){ - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; - Rcpp::Matrix mat( nrows, ncols ) ; - for( int j=0, k=0; j + SEXP arma_subview_wrap( const arma::subview& data, int nrows, int ncols ){ + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; + Rcpp::Matrix mat( nrows, ncols ) ; + for( int j=0, k=0; j SEXP wrap ( const arma::Mat& data ){ - return RcppArmadillo::arma_wrap( data, Dimension( data.n_rows, data.n_cols ) ) ; + return RcppArmadillo::arma_wrap( data, Dimension( data.n_rows, data.n_cols ) ) ; } template SEXP wrap( const arma::Col& data ){ - return RcppArmadillo::arma_wrap( data, Dimension( data.n_elem, 1) ) ; + return RcppArmadillo::arma_wrap( data, Dimension( data.n_elem, 1) ) ; } template SEXP wrap( const arma::Row& data ){ - return RcppArmadillo::arma_wrap(data, Dimension( 1, data.n_elem ) ) ; + return RcppArmadillo::arma_wrap(data, Dimension( 1, data.n_elem ) ) ; } template SEXP wrap( const arma::Cube& data ){ - return RcppArmadillo::arma_wrap(data, Dimension( data.n_rows, data.n_cols, data.n_slices ) ) ; + return RcppArmadillo::arma_wrap(data, Dimension( data.n_rows, data.n_cols, data.n_slices ) ) ; } template SEXP wrap( const arma::subview& data ){ return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; } + template SEXP wrap ( const arma::SpMat& sm ){ + IntegerVector dim(2); + dim[0] = sm.n_rows; + dim[1] = sm.n_cols; + + arma::Col x(sm.n_nonzero); // create space for values, and copy + arma::arrayops::copy(x.begin(), sm.values, sm.n_nonzero); + std::vector vx = arma::conv_to< typename std::vector >::from(x); + + arma::urowvec i(sm.n_nonzero); // create space for row_indices, and copy & cast + arma::arrayops::copy(i.begin(), sm.row_indices, sm.n_nonzero); + std::vector vi = arma::conv_to< std::vector< int > >::from(i); + + arma::urowvec p(sm.n_cols+1); // create space for col_ptrs, and copy + arma::arrayops::copy(p.begin(), sm.col_ptrs, sm.n_cols+1); + // do not copy sentinel for returning R + std::vector vp = arma::conv_to< std::vector< int > >::from(p); + + S4 s("dgCMatrix"); + s.slot("i") = vi; + s.slot("p") = vp; + s.slot("x") = vx; + s.slot("Dim") = dim; + return s; + } + - namespace RcppArmadillo { /* Importer class for field */ @@ -97,9 +122,9 @@ template SEXP wrap( const arma::field& data){ - RObject x = wrap( RcppArmadillo::FieldImporter( data ) ) ; - x.attr("dim" ) = Dimension( data.n_rows, data.n_cols ) ; - return x ; + RObject x = wrap( RcppArmadillo::FieldImporter( data ) ) ; + x.attr("dim" ) = Dimension( data.n_rows, data.n_cols ) ; + return x ; } /* TODO: maybe we could use the advanced constructor to avoid creating the @@ -240,31 +265,6 @@ return wrap( eT(X) ) ; } - - /* support for Rcpp::as */ - - 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::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){} - }; - - } // namespace traits - } #endif From noreply at r-forge.r-project.org Wed Aug 21 09:28:21 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 21 Aug 2013 09:28:21 +0200 (CEST) Subject: [Rcpp-commits] r4437 - in pkg/RcppArmadillo: . inst/include Message-ID: <20130821072821.278F81813EE@r-forge.r-project.org> Author: romain Date: 2013-08-21 09:28:20 +0200 (Wed, 21 Aug 2013) New Revision: 4437 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h Log: less data copies in wrap Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-20 15:23:17 UTC (rev 4436) +++ pkg/RcppArmadillo/ChangeLog 2013-08-21 07:28:20 UTC (rev 4437) @@ -1,3 +1,7 @@ +2013-08-21 Romain Francois + + * include/RcppArmadilloWrap.h: Less data copies for wrap< SpMat > + 2013-08-20 Romain Francois * include/RcppArmadilloWrap.h: Handle wrap Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-20 15:23:17 UTC (rev 4436) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-21 07:28:20 UTC (rev 4437) @@ -78,27 +78,27 @@ } template SEXP wrap ( const arma::SpMat& sm ){ - IntegerVector dim(2); - dim[0] = sm.n_rows; - dim[1] = sm.n_cols; + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + + IntegerVector dim = IntegerVector::create( sm.n_rows, sm.n_cols ); + + // copy the data into R objects + Vector x(sm.values, sm.values + sm.n_nonzero ) ; + IntegerVector i(sm.row_indices, sm.row_indices + sm.n_nonzero); + IntegerVector p(sm.col_ptrs, sm.col_ptrs + sm.n_cols+1 ) ; - arma::Col x(sm.n_nonzero); // create space for values, and copy - arma::arrayops::copy(x.begin(), sm.values, sm.n_nonzero); - std::vector vx = arma::conv_to< typename std::vector >::from(x); - - arma::urowvec i(sm.n_nonzero); // create space for row_indices, and copy & cast - arma::arrayops::copy(i.begin(), sm.row_indices, sm.n_nonzero); - std::vector vi = arma::conv_to< std::vector< int > >::from(i); - - arma::urowvec p(sm.n_cols+1); // create space for col_ptrs, and copy - arma::arrayops::copy(p.begin(), sm.col_ptrs, sm.n_cols+1); - // do not copy sentinel for returning R - std::vector vp = arma::conv_to< std::vector< int > >::from(p); - - S4 s("dgCMatrix"); - s.slot("i") = vi; - s.slot("p") = vp; - s.slot("x") = vx; + std::string klass ; + switch( RTYPE ){ + case REALSXP: klass = "dgCMatrix" ; break ; + // case INTSXP : klass = "igCMatrix" ; break ; class not exported + case LGLSXP : klass = "lgCMatrix" ; break ; + default: + throw std::invalid_argument( "RTYPE not matched in conversion to sparse matrix" ) ; + } + S4 s(klass); + s.slot("i") = i; + s.slot("p") = p; + s.slot("x") = x; s.slot("Dim") = dim; return s; } From noreply at r-forge.r-project.org Wed Aug 21 09:48:56 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 21 Aug 2013 09:48:56 +0200 (CEST) Subject: [Rcpp-commits] r4438 - in pkg/RcppArmadillo: . inst/include Message-ID: <20130821074856.97AF318515F@r-forge.r-project.org> Author: romain Date: 2013-08-21 09:48:56 +0200 (Wed, 21 Aug 2013) New Revision: 4438 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h Log: less data copies for as Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-21 07:28:20 UTC (rev 4437) +++ pkg/RcppArmadillo/ChangeLog 2013-08-21 07:48:56 UTC (rev 4438) @@ -1,6 +1,7 @@ 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 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-08-21 07:28:20 UTC (rev 4437) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloAs.h 2013-08-21 07:48:56 UTC (rev 4438) @@ -3,7 +3,7 @@ // // RcppArmadilloAs.h: Rcpp/Armadillo glue, support for as // -// Copyright (C) 2013 Dirk Eddelbuettel, Romain Francois +// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of RcppArmadillo. // @@ -51,26 +51,26 @@ Exporter( SEXP x ) : mat(x){} arma::SpMat get(){ + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + IntegerVector dims = mat.slot("Dim"); - arma::urowvec i = Rcpp::as(mat.slot("i")); - arma::urowvec p = Rcpp::as(mat.slot("p")); - arma::Col x = Rcpp::as< arma::Col >(mat.slot("x")); + IntegerVector i = mat.slot("i") ; + IntegerVector p = mat.slot("p") ; + Vector x = mat.slot("x") ; - int nrow = dims[0], ncol = dims[1]; - arma::SpMat res(nrow, ncol); + 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); - arma::arrayops::copy(arma::access::rwp(res.row_indices), i.begin(), i.size() + 1); + 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); - arma::arrayops::copy(arma::access::rwp(res.col_ptrs), p.begin(), p.size() + 1); + 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(); From noreply at r-forge.r-project.org Thu Aug 22 08:13:34 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 22 Aug 2013 08:13:34 +0200 (CEST) Subject: [Rcpp-commits] r4439 - in pkg/Rcpp: . inst/include/Rcpp/api/meat inst/include/Rcpp/internal Message-ID: <20130822061334.89BEC1840BC@r-forge.r-project.org> Author: romain Date: 2013-08-22 08:13:34 +0200 (Thu, 22 Aug 2013) New Revision: 4439 Added: pkg/Rcpp/inst/include/Rcpp/api/meat/export.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h pkg/Rcpp/inst/include/Rcpp/internal/export.h Log: added missing export_range__dispatch implementation Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-21 07:48:56 UTC (rev 4438) +++ pkg/Rcpp/ChangeLog 2013-08-22 06:13:34 UTC (rev 4439) @@ -1,3 +1,10 @@ +2013-08-22 Romain Francois + + * include/Rcpp/internal/export.h : added export_range__dispatch for the + r_type_generic_tag tag. Meaning we can now use as< vector > where + T is not a primitive + * include/Rcpp/api/meat/export.h : implementation in meat because it needs as + 2013-08-01 Romain Francois * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. Added: pkg/Rcpp/inst/include/Rcpp/api/meat/export.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/export.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/export.h 2013-08-22 06:13:34 UTC (rev 4439) @@ -0,0 +1,40 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +// +// export.h: Rcpp R/C++ interface class library -- export implementations +// +// 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_api_meat_export_h +#define Rcpp_api_meat_export_h + +namespace Rcpp{ +namespace internal{ + + template + void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_generic_tag ) { + R_len_t n = ::Rf_length(x) ; + for( R_len_t i=0; i( VECTOR_ELT(x, i) ) ; + } + } + + +} // namespace internal +} // namespace Rcpp + +#endif Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h 2013-08-21 07:48:56 UTC (rev 4438) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h 2013-08-22 06:13:34 UTC (rev 4439) @@ -29,5 +29,6 @@ #include #include #include +#include #endif Modified: pkg/Rcpp/inst/include/Rcpp/internal/export.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/internal/export.h 2013-08-21 07:48:56 UTC (rev 4438) +++ pkg/Rcpp/inst/include/Rcpp/internal/export.h 2013-08-22 06:13:34 UTC (rev 4439) @@ -47,27 +47,31 @@ /* iterating */ - template - void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::false_type ) { - const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; - typedef typename ::Rcpp::traits::storage_type::type STORAGE ; - SEXP y = PROTECT( ::Rcpp::r_cast(x) ) ; - STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; - std::copy( start, start + ::Rf_length(y), first ) ; - UNPROTECT(1) ; - } + template + void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::false_type ) { + const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; + typedef typename ::Rcpp::traits::storage_type::type STORAGE ; + SEXP y = PROTECT( ::Rcpp::r_cast(x) ) ; + STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; + std::copy( start, start + ::Rf_length(y), first ) ; + UNPROTECT(1) ; + } - template - void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::true_type ) { - const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; - typedef typename ::Rcpp::traits::storage_type::type STORAGE ; - SEXP y = PROTECT( ::Rcpp::r_cast(x) ) ; - STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; - std::transform( start, start + ::Rf_length(y) , first, caster ) ; - UNPROTECT(1) ; + template + void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::true_type ) { + const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; + typedef typename ::Rcpp::traits::storage_type::type STORAGE ; + SEXP y = PROTECT( ::Rcpp::r_cast(x) ) ; + STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; + std::transform( start, start + ::Rf_length(y) , first, caster ) ; + UNPROTECT(1) ; } + // implemented in meat template + void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_generic_tag ) ; + + template void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_primitive_tag ) { export_range__impl( x, From noreply at r-forge.r-project.org Thu Aug 22 09:33:38 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 22 Aug 2013 09:33:38 +0200 (CEST) Subject: [Rcpp-commits] r4440 - pkg/Rcpp/inst/include/Rcpp/internal Message-ID: <20130822073338.4CC321851A4@r-forge.r-project.org> Author: romain Date: 2013-08-22 09:33:37 +0200 (Thu, 22 Aug 2013) New Revision: 4440 Modified: pkg/Rcpp/inst/include/Rcpp/internal/export.h Log: indent Modified: pkg/Rcpp/inst/include/Rcpp/internal/export.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/internal/export.h 2013-08-22 06:13:34 UTC (rev 4439) +++ pkg/Rcpp/inst/include/Rcpp/internal/export.h 2013-08-22 07:33:37 UTC (rev 4440) @@ -122,7 +122,7 @@ STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; R_len_t size = ::Rf_length(y) ; for( R_len_t i=0; i(start[i]) ; + res[i] = caster(start[i]) ; } UNPROTECT(1) ; /* y */ } From noreply at r-forge.r-project.org Thu Aug 22 11:07:21 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 22 Aug 2013 11:07:21 +0200 (CEST) Subject: [Rcpp-commits] r4441 - in pkg/Rcpp: . inst inst/include/Rcpp/api/meat inst/include/Rcpp/internal inst/include/Rcpp/traits inst/unitTests inst/unitTests/cpp Message-ID: <20130822090721.58BA1185566@r-forge.r-project.org> Author: romain Date: 2013-08-22 11:07:21 +0200 (Thu, 22 Aug 2013) New Revision: 4441 Added: pkg/Rcpp/inst/include/Rcpp/api/meat/wrap.h pkg/Rcpp/inst/include/Rcpp/traits/is_primitive.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h pkg/Rcpp/inst/include/Rcpp/internal/wrap.h pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h pkg/Rcpp/inst/include/Rcpp/traits/traits.h pkg/Rcpp/inst/unitTests/cpp/wrap.cpp pkg/Rcpp/inst/unitTests/runit.wrap.R Log: more wrap, e.g. std::map, boost::unordered_map >, ... Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/ChangeLog 2013-08-22 09:07:21 UTC (rev 4441) @@ -1,5 +1,16 @@ 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 compare it + to r_type_primitive_tag + * include/Rcpp/traits/r_type_traits.h : new tag r_type_pair_tag to handle + wrapping map where KEY can be converted to String and VALUE + can wrap itself + * include/Rcpp/internal/wrap.h : handling r_type_pair_tag + * include/Rcpp/api/meat/wrap.h : implementations to handle map + * unitTests/cpp/wrap.cpp : more tests for map with KEY not a string + * unitTests/runit.wrap.R : more tests for map with KEY not a string + * include/Rcpp/internal/export.h : added export_range__dispatch for the r_type_generic_tag tag. Meaning we can now use as< vector > where T is not a primitive Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/NEWS.Rd 2013-08-22 09:07:21 UTC (rev 4441) @@ -19,6 +19,18 @@ can be seen as a \code{T}. For example \code{is(x)}. This is a building block for more expressive dispatch in various places (modules and attributes functions). + \item \code{wrap} can now handle more types, i.e. types that iterate over + \code{std::pair} where KEY can be converted to a + \code{String} and \code{VALUE} is either a primitive type (int, double) + or a type that wraps. Examples : + \itemize{ + \item \code{std::map} : we can make a String from an int, + and double is primitive + \item \code{boost::unordered_map >}: we can make + a String from a double and \code{std::vector} can wrap itself + } + Other examples of this are included at the end of the \code{wrap} unit test + file (\code{runit.wrap.R} and \code{wrap.cpp}) . } \item Changes in Attributes: Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -1,8 +1,8 @@ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // -// backward.h: Rcpp R/C++ interface class library -- +// meat.h: Rcpp R/C++ interface class library -- // -// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -30,5 +30,6 @@ #include #include #include +#include #endif Added: pkg/Rcpp/inst/include/Rcpp/api/meat/wrap.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/wrap.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/wrap.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -0,0 +1,68 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +// +// wrap.h: Rcpp R/C++ interface class library -- wrap implementations +// +// 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_api_meat_wrap_h +#define Rcpp_api_meat_wrap_h + +namespace Rcpp{ +namespace internal{ + +template +inline SEXP range_wrap_dispatch___impl__pair( InputIterator first, InputIterator last, Rcpp::traits::true_type ){ + size_t size = std::distance( first, last ) ; + typedef typename Rcpp::traits::storage_type::type STORAGE ; + + SEXP names = PROTECT( Rf_allocVector(STRSXP, size) ) ; + SEXP x = PROTECT( Rf_allocVector(RTYPE, size) ) ; + STORAGE* ptr = Rcpp::internal::r_vector_start( x ) ; + Rcpp::String buffer ; + for( size_t i = 0; i < size ; i++, ++first){ + buffer = first->first ; + ptr[i] = first->second ; + SET_STRING_ELT( names, i, buffer.get_sexp() ) ; + } + ::Rf_setAttrib( x, R_NamesSymbol, names) ; + UNPROTECT(2) ; + return x ; +} + +template +inline SEXP range_wrap_dispatch___impl__pair( InputIterator first, InputIterator last, Rcpp::traits::false_type ){ + size_t size = std::distance( first, last ) ; + + SEXP names = PROTECT( Rf_allocVector(STRSXP, size) ) ; + SEXP x = PROTECT( Rf_allocVector(VECSXP, size) ) ; + Rcpp::String buffer ; + for( size_t i = 0; i < size ; i++, ++first){ + buffer = first->first ; + SET_VECTOR_ELT( x, i, Rcpp::wrap(first->second) ); + SET_STRING_ELT( names, i, buffer.get_sexp() ) ; + } + ::Rf_setAttrib( x, R_NamesSymbol, names) ; + UNPROTECT(2) ; + return x ; +} + + +} // namespace internal +} // namespace Rcpp + +#endif Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -351,6 +351,40 @@ return x ; } + +/** + * iterating over pair + * where VALUE is some primitive type + */ +template +inline SEXP range_wrap_dispatch___impl__pair( InputIterator first, InputIterator last, Rcpp::traits::true_type ) ; + +/** + * iterating over pair + * where VALUE is a type that needs wrapping + */ +template +inline SEXP range_wrap_dispatch___impl__pair( InputIterator first, InputIterator last, Rcpp::traits::false_type ) ; + + +/** + * Range wrap dispatch for iterators over std::pair + */ +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_pair_tag ){ + typedef typename T::second_type VALUE ; + typedef typename T::first_type KEY ; + + return range_wrap_dispatch___impl__pair< + InputIterator, + KEY, + VALUE, + Rcpp::traits::r_sexptype_traits::rtype + >( first, last, + typename Rcpp::traits::is_primitive::type() + ) ; +} + // }}} /** Added: pkg/Rcpp/inst/include/Rcpp/traits/is_primitive.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/is_primitive.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/traits/is_primitive.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -0,0 +1,37 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ +// +// is_primitive.h: Rcpp R/C++ interface class library -- traits to help wrap +// +// 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__traits__is_primitive__h +#define Rcpp__traits__is_primitive__h + +namespace Rcpp{ +namespace traits{ + + template struct is_primitive : public same_type< + typename r_type_traits::r_category , + r_type_primitive_tag + >{} ; + +} // traits +} // Rcpp + +#endif Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -61,6 +61,12 @@ struct r_type_pairstring_generic_tag{} ; /** + * Identifies a pair, used to wrap map + * VALUE can be anything that wraps, KEY can be anything we can build a String from + */ +struct r_type_pair_tag{} ; + +/** * identifies a module object pointer */ struct r_type_module_object_pointer_tag{} ; @@ -103,6 +109,12 @@ */ template struct r_type_traits< Rcpp::object >{ typedef r_type_module_object_pointer_tag r_category ; } ; + +template +struct r_type_traits< std::pair > { + typedef r_type_pair_tag r_category ; +} ; + /** * special cases pair to deal with map etc ... */ Modified: pkg/Rcpp/inst/include/Rcpp/traits/traits.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/traits.h 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/include/Rcpp/traits/traits.h 2013-08-22 09:07:21 UTC (rev 4441) @@ -60,6 +60,7 @@ #include #include #include +#include #endif Modified: pkg/Rcpp/inst/unitTests/cpp/wrap.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/wrap.cpp 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/unitTests/cpp/wrap.cpp 2013-08-22 09:07:21 UTC (rev 4441) @@ -196,3 +196,57 @@ return wrap(m); } + +RCPP_EXPOSED_CLASS(Foo) +class Foo{ + public: + Foo() : x(0.0){} + Foo( double x_ ) : x(x_){} + double get() { return x ; } + private: + double x ; +} ; +RCPP_MODULE(mod){ + class_("Foo") + .constructor() + .method( "get", &Foo::get ) + ; +} + +// [[Rcpp::export]] +SEXP map_int_double(){ + std::map map ; + map[0] = 2.0 ; + map[-1] = 3.0 ; + return wrap( map ) ; +} + +// [[Rcpp::export]] +SEXP map_double_double(){ + std::map map ; + map[0.0] = 2.0 ; + map[1.2] = 3.0 ; + return wrap( map ) ; +} + +// [[Rcpp::export]] +SEXP map_int_vector_double(){ + std::map > map ; + map[0].push_back( 1.0 ) ; + map[0].push_back( 2.0 ) ; + + map[1].push_back( 2.0 ) ; + map[1].push_back( 3.0 ) ; + + return wrap( map ) ; +} + +// [[Rcpp::export]] +SEXP map_int_Foo(){ + std::map map ; + map[0] = Foo( 2 ) ; + map[1] = Foo( 3 ) ; + return wrap( map ) ; +} + + Modified: pkg/Rcpp/inst/unitTests/runit.wrap.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.wrap.R 2013-08-22 07:33:37 UTC (rev 4440) +++ pkg/Rcpp/inst/unitTests/runit.wrap.R 2013-08-22 09:07:21 UTC (rev 4441) @@ -149,5 +149,37 @@ checkEquals( res[["c"]], c(1L,2L,2L,2L) , msg = "wrap( tr1::unordered_map>) " ) } +test.wrap.map.int.double <- function(){ + checkEquals( + map_int_double(), + c("-1" = 3, "0" = 2 ), + msg = "std::map" + ) } +test.wrap.map.double.double <- function(){ + checkEquals( + map_double_double(), + c("0" = 2, "1.2" = 3 ), + msg = "std::map" + ) +} + +test.wrap.map.int.vector_double <- function(){ + checkEquals( + map_int_vector_double(), + list("0" = c(1,2), "1" = c(2,3) ), + msg = "std::map >" + ) +} + +test.wrap.map.int.Foo <- function(){ + checkEquals( + sapply( map_int_Foo(), function(.) .$get() ), + c("0" = 2, "1" = 3 ), + msg = "std::map" + ) +} + +} + From noreply at r-forge.r-project.org Thu Aug 22 11:23:51 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 22 Aug 2013 11:23:51 +0200 (CEST) Subject: [Rcpp-commits] r4442 - in pkg/Rcpp: . inst inst/include/Rcpp/internal inst/unitTests inst/unitTests/cpp Message-ID: <20130822092351.5BDEA18126B@r-forge.r-project.org> Author: romain Date: 2013-08-22 11:23:51 +0200 (Thu, 22 Aug 2013) New Revision: 4442 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/internal/wrap.h pkg/Rcpp/inst/unitTests/cpp/wrap.cpp pkg/Rcpp/inst/unitTests/runit.wrap.R Log: more wrap coverage Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-22 09:07:21 UTC (rev 4441) +++ pkg/Rcpp/ChangeLog 2013-08-22 09:23:51 UTC (rev 4442) @@ -6,7 +6,8 @@ * include/Rcpp/traits/r_type_traits.h : new tag r_type_pair_tag to handle wrapping map where KEY can be converted to String and VALUE can wrap itself - * include/Rcpp/internal/wrap.h : handling r_type_pair_tag + * include/Rcpp/internal/wrap.h : handling map and vector + where T is a class handled by modules * include/Rcpp/api/meat/wrap.h : implementations to handle map * unitTests/cpp/wrap.cpp : more tests for map with KEY not a string * unitTests/runit.wrap.R : more tests for map with KEY not a string Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-08-22 09:07:21 UTC (rev 4441) +++ pkg/Rcpp/inst/NEWS.Rd 2013-08-22 09:23:51 UTC (rev 4442) @@ -30,7 +30,11 @@ a String from a double and \code{std::vector} can wrap itself } Other examples of this are included at the end of the \code{wrap} unit test - file (\code{runit.wrap.R} and \code{wrap.cpp}) . + file (\code{runit.wrap.R} and \code{wrap.cpp}). + \item \code{wrap} now handles containers of classes handled by modules. e.g. + 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 Changes in Attributes: Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2013-08-22 09:07:21 UTC (rev 4441) +++ pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2013-08-22 09:23:51 UTC (rev 4442) @@ -185,7 +185,7 @@ * This produces an unnamed generic vector (list) */ template -inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_generic_tag ){ +inline SEXP range_wrap_dispatch___generic( InputIterator first, InputIterator last ){ size_t size = std::distance( first, last ) ; SEXP x = PROTECT( Rf_allocVector( VECSXP, size ) ); size_t i =0 ; @@ -198,6 +198,35 @@ return x ; } +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_generic_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} + +// modules +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_pointer_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_const_pointer_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_reference_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} +template +inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_const_reference_tag ){ + return range_wrap_dispatch___generic( first, last ) ; +} + + + /** * Range based wrap implementation for iterators over std::string * Modified: pkg/Rcpp/inst/unitTests/cpp/wrap.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/wrap.cpp 2013-08-22 09:07:21 UTC (rev 4441) +++ pkg/Rcpp/inst/unitTests/cpp/wrap.cpp 2013-08-22 09:23:51 UTC (rev 4442) @@ -249,4 +249,11 @@ return wrap( map ) ; } +// [[Rcpp::export]] +SEXP vector_Foo(){ + std::vector vec(2) ; + vec[0] = Foo( 2 ) ; + vec[1] = Foo( 3 ) ; + return wrap(vec) ; +} Modified: pkg/Rcpp/inst/unitTests/runit.wrap.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.wrap.R 2013-08-22 09:07:21 UTC (rev 4441) +++ pkg/Rcpp/inst/unitTests/runit.wrap.R 2013-08-22 09:23:51 UTC (rev 4442) @@ -181,5 +181,13 @@ ) } +test.wrap.vector.Foo <- function(){ + checkEquals( + sapply( vector_Foo(), function(.) .$get() ), + c(2, 3), + msg = "std::vector< MODULE EXPOSED CLASS >" + ) } +} + From noreply at r-forge.r-project.org Fri Aug 23 04:21:12 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 23 Aug 2013 04:21:12 +0200 (CEST) Subject: [Rcpp-commits] r4443 - pkg/RcppArmadillo/inst Message-ID: <20130823022112.9B3B2185992@r-forge.r-project.org> Author: edd Date: 2013-08-23 04:21:11 +0200 (Fri, 23 Aug 2013) New Revision: 4443 Modified: pkg/RcppArmadillo/inst/NEWS.Rd Log: minor edits of NEWS file Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-22 09:23:51 UTC (rev 4442) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-23 02:21:11 UTC (rev 4443) @@ -4,15 +4,13 @@ \section{Changes in RcppArmadillo version (future)}{ \itemize{ - \item Initial Implementation of wrap + \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.1 (2013-08-17)}{ - \itemize{ - \item Converted main vignette from \code{LaTeX} style \code{minted} - to \code{lstlisting} which permits builds on CRAN; removed - set \code{BuildVignettes: FALSE}. } } From noreply at r-forge.r-project.org Sat Aug 24 03:33:53 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 Aug 2013 03:33:53 +0200 (CEST) Subject: [Rcpp-commits] r4444 - pkg/RcppArmadillo/inst/include Message-ID: <20130824013353.80EC7184BB1@r-forge.r-project.org> Author: edd Date: 2013-08-24 03:33:52 +0200 (Sat, 24 Aug 2013) New Revision: 4444 Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h Log: reindented, whitespace changes only Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-23 02:21:11 UTC (rev 4443) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2013-08-24 01:33:52 UTC (rev 4444) @@ -37,7 +37,7 @@ // DE 03-Aug-2013 // here is an alternate form which would not set dimension which we could do // for row and column vectors -- but the current form of return row and col - // as matrix types with one col (or row, respectively) is now entrenched + // as matrix types with one col (or row, respectively) is now entrenched template SEXP arma_wrap(const T& object) { return ::Rcpp::wrap(object.memptr() , object.memptr() + object.n_elem); @@ -45,12 +45,12 @@ template SEXP arma_subview_wrap( const arma::subview& data, int nrows, int ncols ){ - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; - Rcpp::Matrix mat( nrows, ncols ) ; - for( int j=0, k=0; j::rtype ; + Rcpp::Matrix mat( nrows, ncols ) ; + for( int j=0, k=0; j SEXP wrap ( const arma::Mat& data ){ - return RcppArmadillo::arma_wrap( data, Dimension( data.n_rows, data.n_cols ) ) ; + return RcppArmadillo::arma_wrap( data, Dimension( data.n_rows, data.n_cols ) ) ; } template SEXP wrap( const arma::Col& data ){ - return RcppArmadillo::arma_wrap( data, Dimension( data.n_elem, 1) ) ; + return RcppArmadillo::arma_wrap( data, Dimension( data.n_elem, 1) ) ; } template SEXP wrap( const arma::Row& data ){ - return RcppArmadillo::arma_wrap(data, Dimension( 1, data.n_elem ) ) ; + return RcppArmadillo::arma_wrap(data, Dimension( 1, data.n_elem ) ) ; } template SEXP wrap( const arma::Cube& data ){ - return RcppArmadillo::arma_wrap(data, Dimension( data.n_rows, data.n_cols, data.n_slices ) ) ; + return RcppArmadillo::arma_wrap(data, Dimension( data.n_rows, data.n_cols, data.n_slices ) ) ; } template SEXP wrap( const arma::subview& data ){ - return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; + return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; } template SEXP wrap ( const arma::SpMat& sm ){ - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - IntegerVector dim = IntegerVector::create( sm.n_rows, sm.n_cols ); + IntegerVector dim = IntegerVector::create( sm.n_rows, sm.n_cols ); - // copy the data into R objects - Vector x(sm.values, sm.values + sm.n_nonzero ) ; - IntegerVector i(sm.row_indices, sm.row_indices + sm.n_nonzero); - IntegerVector p(sm.col_ptrs, sm.col_ptrs + sm.n_cols+1 ) ; + // copy the data into R objects + Vector x(sm.values, sm.values + sm.n_nonzero ) ; + IntegerVector i(sm.row_indices, sm.row_indices + sm.n_nonzero); + IntegerVector p(sm.col_ptrs, sm.col_ptrs + sm.n_cols+1 ) ; - std::string klass ; - switch( RTYPE ){ - case REALSXP: klass = "dgCMatrix" ; break ; - // case INTSXP : klass = "igCMatrix" ; break ; class not exported - case LGLSXP : klass = "lgCMatrix" ; break ; - default: - throw std::invalid_argument( "RTYPE not matched in conversion to sparse matrix" ) ; - } - S4 s(klass); - s.slot("i") = i; - s.slot("p") = p; - s.slot("x") = x; - s.slot("Dim") = dim; - return s; + std::string klass ; + switch( RTYPE ){ + case REALSXP: klass = "dgCMatrix" ; break ; + // case INTSXP : klass = "igCMatrix" ; break ; class not exported + case LGLSXP : klass = "lgCMatrix" ; break ; + default: + throw std::invalid_argument( "RTYPE not matched in conversion to sparse matrix" ) ; + } + S4 s(klass); + s.slot("i") = i; + s.slot("p") = p; + s.slot("x") = x; + s.slot("Dim") = dim; + return s; } @@ -122,21 +122,21 @@ template SEXP wrap( const arma::field& data){ - RObject x = wrap( RcppArmadillo::FieldImporter( data ) ) ; - x.attr("dim" ) = Dimension( data.n_rows, data.n_cols ) ; - return x ; + RObject x = wrap( RcppArmadillo::FieldImporter( data ) ) ; + x.attr("dim" ) = Dimension( data.n_rows, data.n_cols ) ; + return x ; } /* TODO: maybe we could use the advanced constructor to avoid creating the - temporary Mat */ + temporary Mat */ template SEXP wrap(const arma::Glue& X ){ - return wrap( arma::Mat(X) ) ; + return wrap( arma::Mat(X) ) ; } template SEXP wrap(const arma::Op& X ){ - return wrap( arma::Mat(X) ) ; + return wrap( arma::Mat(X) ) ; } template @@ -171,7 +171,7 @@ template SEXP wrap_eglue( const arma::eGlue& X, ::Rcpp::traits::true_type ){ - return ::Rcpp::wrap( arma::Mat(X) ) ; + return ::Rcpp::wrap( arma::Mat(X) ) ; } template @@ -235,7 +235,7 @@ template SEXP wrap(const arma::eOp& X ){ - return RcppArmadillo::wrap_eop( X, typename traits::r_sexptype_needscast::type() ) ; + return RcppArmadillo::wrap_eop( X, typename traits::r_sexptype_needscast::type() ) ; } template From noreply at r-forge.r-project.org Sat Aug 24 08:56:17 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 Aug 2013 08:56:17 +0200 (CEST) Subject: [Rcpp-commits] r4445 - in pkg/RcppArmadillo: . inst inst/include/RcppArmadilloExtensions Message-ID: <20130824065617.7FA88184ED8@r-forge.r-project.org> Author: romain Date: 2013-08-24 08:56:16 +0200 (Sat, 24 Aug 2013) New Revision: 4445 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h Log: fix sample.h for the multiple include problem Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-08-24 01:33:52 UTC (rev 4444) +++ pkg/RcppArmadillo/ChangeLog 2013-08-24 06:56:16 UTC (rev 4445) @@ -1,3 +1,9 @@ +2013-08-24 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 > Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-24 01:33:52 UTC (rev 4444) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-08-24 06:56:16 UTC (rev 4445) @@ -11,7 +11,6 @@ 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/RcppArmadilloExtensions/sample.h =================================================================== --- pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h 2013-08-24 01:33:52 UTC (rev 4444) +++ pkg/RcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h 2013-08-24 06:56:16 UTC (rev 4445) @@ -7,6 +7,7 @@ // (note that Walker's alias method is not implemented). // // Copyright (C) 2012 - 2013 Christian Gunning +// Copyright (C) 2013 Romain Francois // // This file is part of RcppArmadillo. // @@ -23,19 +24,30 @@ // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . +#ifndef RCPPARMADILLO__EXTENSIONS__SAMPLE_H +#define RCPPARMADILLO__EXTENSIONS__SAMPLE_H + #include - namespace Rcpp{ namespace RcppArmadillo{ //Declarations - void SampleReplace( IntegerVector &index, int nOrig, int size); - void SampleNoReplace( IntegerVector &index, int nOrig, int size); - void ProbSampleReplace(IntegerVector &index, int nOrig, int size, arma::vec &prob); - void ProbSampleNoReplace(IntegerVector &index, int nOrig, int size, arma::vec &prob); - void FixProb(NumericVector &prob, int size, bool replace); + template + void SampleReplace( INDEX &index, int nOrig, int size); + + template + void SampleNoReplace( INDEX &index, int nOrig, int size); + + template + void ProbSampleReplace(INDEX &index, int nOrig, int size, arma::vec &prob); + + template + void ProbSampleNoReplace(INDEX &index, int nOrig, int size, arma::vec &prob); + + template + void FixProb(PROB &prob, int size, bool replace); template T sample(const T &x, const int size, const bool replace, NumericVector prob_ = NumericVector(0) ) { @@ -50,16 +62,16 @@ IntegerVector index(size); if (probsize == 0) { // No probabilities given if (replace) { - SampleReplace(index, nOrig, size); + SampleReplace(index, nOrig, size); } else { - SampleNoReplace(index, nOrig, size); + SampleNoReplace(index, nOrig, size); } } else { if (probsize != nOrig) throw std::range_error( "Number of probabilities must equal input vector length" ) ; // normalize, error-check probability vector // fixprob will be modified in-place NumericVector fixprob = clone(prob_); - FixProb(fixprob, size, replace); + FixProb(fixprob, size, replace); // // Copy the given probabilities into an arma vector arma::vec prob(fixprob.begin(), fixprob.size()); @@ -67,13 +79,13 @@ // check for walker alias conditions int walker_test = sum( (probsize * prob) > 0.1); if (walker_test < 200) { - ProbSampleReplace(index, nOrig, size, prob); + ProbSampleReplace(index, nOrig, size, prob); } else { throw std::range_error( "Walker Alias method not implemented. R-core sample() is likely faster for this problem."); // WalkerProbSampleReplace(index, nOrig, size, prob); } } else { - ProbSampleNoReplace(index, nOrig, size, prob); + ProbSampleNoReplace(index, nOrig, size, prob); } } // copy the results into the return vector @@ -84,14 +96,16 @@ return(ret); } - void SampleReplace( IntegerVector &index, int nOrig, int size) { + template + void SampleReplace( INDEX &index, int nOrig, int size) { int ii; for (ii = 0; ii < size; ii++) { index[ii] = nOrig * unif_rand(); } } - void SampleNoReplace( IntegerVector &index, int nOrig, int size) { + template + void SampleNoReplace( INDEX &index, int nOrig, int size) { int ii, jj; IntegerVector sub(nOrig); for (ii = 0; ii < nOrig; ii++) { @@ -105,7 +119,8 @@ } } - void FixProb(NumericVector &prob, const int size, const bool replace) { + template + void FixProb(PROB &prob, const int size, const bool replace) { // prob is modified in-place. // Is this better than cloning it? double sum = 0.0; @@ -128,7 +143,8 @@ } // Unequal probability sampling with replacement - void ProbSampleReplace(IntegerVector &index, int nOrig, int size, arma::vec &prob){ + template + void ProbSampleReplace(INDEX &index, int nOrig, int size, arma::vec &prob){ double rU; int ii, jj; int nOrig_1 = nOrig - 1; @@ -148,7 +164,8 @@ } // Unequal probability sampling without replacement - void ProbSampleNoReplace(IntegerVector &index, int nOrig, int size, arma::vec &prob){ + template + void ProbSampleNoReplace(INDEX &index, int nOrig, int size, arma::vec &prob){ int ii, jj, kk; int nOrig_1 = nOrig - 1; double rT, mass, totalmass = 1.0; @@ -173,3 +190,5 @@ } } } + +#endif From noreply at r-forge.r-project.org Sat Aug 24 20:17:35 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 Aug 2013 20:17:35 +0200 (CEST) Subject: [Rcpp-commits] r4446 - in pkg/RcppGSL: . vignettes Message-ID: <20130824181735.3DD07183C75@r-forge.r-project.org> Author: edd Date: 2013-08-24 20:17:34 +0200 (Sat, 24 Aug 2013) New Revision: 4446 Modified: pkg/RcppGSL/ChangeLog pkg/RcppGSL/DESCRIPTION pkg/RcppGSL/vignettes/RcppGSL-intro.Rnw Log: minor fix: added 'highlight' as a Suggests to DESCRIPTION so that the package is available during 'R CMD check' in order to build vignettes also added citation of the Eddelbuettel and Sanderson (2013, CSDA) paper on RcppArmadillo Modified: pkg/RcppGSL/ChangeLog =================================================================== --- pkg/RcppGSL/ChangeLog 2013-08-24 06:56:16 UTC (rev 4445) +++ pkg/RcppGSL/ChangeLog 2013-08-24 18:17:34 UTC (rev 4446) @@ -1,3 +1,11 @@ +2013-08-24 Dirk Eddelbuettel + + * DESCRIPTION (Suggests): Added 'highlight' so that the package is + available during 'R CMD check' in order to build vignettes + + * vignettes/RcppGSL-intro.Rnw: Also cite the Eddelbuettel and + Sanderson (2013, CSDA) paper on RcppArmadillo + 2013-06-23 Dirk Eddelbuettel * inst/unitTests/runit.gsl.R: Corrections to new unitTest scheme Modified: pkg/RcppGSL/DESCRIPTION =================================================================== --- pkg/RcppGSL/DESCRIPTION 2013-08-24 06:56:16 UTC (rev 4445) +++ pkg/RcppGSL/DESCRIPTION 2013-08-24 18:17:34 UTC (rev 4446) @@ -28,7 +28,7 @@ License: GPL (>= 2) LazyLoad: yes Depends: Rcpp (>= 0.10.3) -Suggests: RUnit, inline +Suggests: RUnit, inline, highlight LinkingTo: Rcpp SystemRequirements: GNU GSL VignetteBuilder: highlight Modified: pkg/RcppGSL/vignettes/RcppGSL-intro.Rnw =================================================================== --- pkg/RcppGSL/vignettes/RcppGSL-intro.Rnw 2013-08-24 06:56:16 UTC (rev 4445) +++ pkg/RcppGSL/vignettes/RcppGSL-intro.Rnw 2013-08-24 18:17:34 UTC (rev 4446) @@ -204,8 +204,9 @@ could have with \proglang{C++} vector or matrix structures as used through the \pkg{Rcpp} package) and return the result to \proglang{R}. -We should note that \pkg{RcppArmadillo} \citep{CRAN:RcppArmadillo} implements -a matching \texttt{fastLm} function using the Armadillo library by +We should note that \pkg{RcppArmadillo} +\citep{CRAN:RcppArmadillo,Eddelbuettel+Sanderson:2013:RcppArmadillo} +implements a matching \texttt{fastLm} function using the Armadillo library by \cite{Sanderson:2010:Armadillo}, and can do so with more compact code due to \proglang{C++} features. From noreply at r-forge.r-project.org Sat Aug 24 20:22:50 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 Aug 2013 20:22:50 +0200 (CEST) Subject: [Rcpp-commits] r4447 - pkg/RcppClassic Message-ID: <20130824182250.DD9DA183C75@r-forge.r-project.org> Author: edd Date: 2013-08-24 20:22:50 +0200 (Sat, 24 Aug 2013) New Revision: 4447 Modified: pkg/RcppClassic/DESCRIPTION Log: minor whitespace change in Description just to trigger an R-Forge rebuilt Modified: pkg/RcppClassic/DESCRIPTION =================================================================== --- pkg/RcppClassic/DESCRIPTION 2013-08-24 18:17:34 UTC (rev 4446) +++ pkg/RcppClassic/DESCRIPTION 2013-08-24 18:22:50 UTC (rev 4447) @@ -6,8 +6,9 @@ and based on code written during 2005 and 2006 by Dominick Samperi Maintainer: Dirk Eddelbuettel Description: The RcppClassic package provides a deprecated C++ library which - facilitates the integration of R and C++. New projects should use the new - Rcpp API in the Rcpp package. + facilitates the integration of R and C++. + . + New projects should use the new Rcpp API in the Rcpp package. Depends: R (>= 2.12.0), Rcpp (>= 0.10.2), methods Suggests: RUnit, inline LinkingTo: Rcpp From noreply at r-forge.r-project.org Sat Aug 24 21:00:52 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 Aug 2013 21:00:52 +0200 (CEST) Subject: [Rcpp-commits] r4448 - in pkg/RcppXts: . man src Message-ID: <20130824190052.635E21853B0@r-forge.r-project.org> Author: edd Date: 2013-08-24 21:00:51 +0200 (Sat, 24 Aug 2013) New Revision: 4448 Modified: pkg/RcppXts/DESCRIPTION pkg/RcppXts/man/RcppXts-package.Rd pkg/RcppXts/src/xtsMod.cpp Log: also expose the one function still only exported in xts on R-Forge depend on that R-Forge version via Depends: Modified: pkg/RcppXts/DESCRIPTION =================================================================== --- pkg/RcppXts/DESCRIPTION 2013-08-24 18:22:50 UTC (rev 4447) +++ pkg/RcppXts/DESCRIPTION 2013-08-24 19:00:51 UTC (rev 4448) @@ -11,6 +11,6 @@ In its current state, the package is mostly a proof-of-concept to support adding useful functions, and does not yet add any of its own. License: GPL (>= 2) -Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-2) +Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-5.1) LinkingTo: Rcpp, xts RcppModules: xts Modified: pkg/RcppXts/man/RcppXts-package.Rd =================================================================== --- pkg/RcppXts/man/RcppXts-package.Rd 2013-08-24 18:22:50 UTC (rev 4447) +++ pkg/RcppXts/man/RcppXts-package.Rd 2013-08-24 19:00:51 UTC (rev 4448) @@ -13,6 +13,7 @@ \alias{xtsMakeUnique} \alias{xtsMerge} \alias{xtsNaOmit} +\alias{xtsNaLocf}, \docType{package} \title{Interface to the C API of xts} \description{This package helps with an Rcpp-based interface to the API @@ -30,6 +31,7 @@ xtsMakeUnique(x, eps) xtsMerge(x, y, all, fill, retclass, colnames, suffixes, retside, env, coerce) xtsNaOmit(x) + xtsNaLocf(x, fromLast, maxgap, limit) } \arguments{ \item{x}{an \code{xts} object} @@ -40,7 +42,6 @@ \item{dup}{a boolean switch whether to remove duplicates} \item{k}{an integer denoting lag length, or interval} \item{pad}{a boolean switch whether to pad} - \item{on}{a numeric value for desired distance, measure in seconds, between endpoints} \item{addlast}{a boolean switch whether last value should be included} \item{eps}{a numeric value for the desired minimal difference between elements} @@ -56,6 +57,12 @@ dimension if these need to be set} \item{env}{an environment, possibly empty} \item{coerce}{an integer value indicating if coercion should be forced} + \item{fromLast}{a boolean variable indicating whether observations + should be carried backward rather than forward; default FALSE} + \item{maxgap}{a double indicating the maximum number of NAs to be + retained; default is Inf} + \item{limit}{a double value for the limit of consecutive NA values; + default is Inf} } \details{Please use the \pkg{xts} sources as the ultimate reference for these variables. The R functions in package \pkg{xts} set some of Modified: pkg/RcppXts/src/xtsMod.cpp =================================================================== --- pkg/RcppXts/src/xtsMod.cpp 2013-08-24 18:22:50 UTC (rev 4447) +++ pkg/RcppXts/src/xtsMod.cpp 2013-08-24 19:00:51 UTC (rev 4448) @@ -98,9 +98,9 @@ "Omit NA values"); // -- this requires xts 0.9-6 or later (fixed in SVN) - // function("xtsNaLocf", - // &xtsNaLocf, - // List::create(Named("x"), Named("fromLast"), Named("maxgap"), Named("limit")), - // "Fill NA values by carrying last observation forward"); + function("xtsNaLocf", + &xtsNaLocf, + List::create(Named("x"), Named("fromLast"), Named("maxgap"), Named("limit")), + "Fill NA values by carrying last observation forward"); } From noreply at r-forge.r-project.org Tue Aug 27 18:03:24 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Aug 2013 18:03:24 +0200 (CEST) Subject: [Rcpp-commits] r4449 - in pkg/RcppXts: . inst Message-ID: <20130827160324.BD9D21846AF@r-forge.r-project.org> Author: edd Date: 2013-08-27 18:03:24 +0200 (Tue, 27 Aug 2013) New Revision: 4449 Modified: pkg/RcppXts/DESCRIPTION pkg/RcppXts/inst/NEWS.Rd Log: depend on xts_0.9-6 which is the current R-Forge version Modified: pkg/RcppXts/DESCRIPTION =================================================================== --- pkg/RcppXts/DESCRIPTION 2013-08-24 19:00:51 UTC (rev 4448) +++ pkg/RcppXts/DESCRIPTION 2013-08-27 16:03:24 UTC (rev 4449) @@ -11,6 +11,6 @@ In its current state, the package is mostly a proof-of-concept to support adding useful functions, and does not yet add any of its own. License: GPL (>= 2) -Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-5.1) +Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-6) LinkingTo: Rcpp, xts RcppModules: xts Modified: pkg/RcppXts/inst/NEWS.Rd =================================================================== --- pkg/RcppXts/inst/NEWS.Rd 2013-08-24 19:00:51 UTC (rev 4448) +++ pkg/RcppXts/inst/NEWS.Rd 2013-08-27 16:03:24 UTC (rev 4449) @@ -4,7 +4,7 @@ \section{Changes in version 0.0.5 (2013-xx-yy)}{ \itemize{ - \item Depends on \cpkg{xts} 0.9-5 now on CRAN + \item Depends on \cpkg{xts} 0.9-6 now on CRAN \item Exports a number of additional functions } } From noreply at r-forge.r-project.org Fri Aug 30 03:34:21 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 30 Aug 2013 03:34:21 +0200 (CEST) Subject: [Rcpp-commits] r4450 - in pkg/RcppXts: man src tests Message-ID: <20130830013421.65FDF18483E@r-forge.r-project.org> Author: edd Date: 2013-08-30 03:34:19 +0200 (Fri, 30 Aug 2013) New Revision: 4450 Modified: pkg/RcppXts/man/RcppXts-package.Rd pkg/RcppXts/src/xtsMod.cpp pkg/RcppXts/tests/checks.R Log: minor updates Modified: pkg/RcppXts/man/RcppXts-package.Rd =================================================================== --- pkg/RcppXts/man/RcppXts-package.Rd 2013-08-27 16:03:24 UTC (rev 4449) +++ pkg/RcppXts/man/RcppXts-package.Rd 2013-08-30 01:34:19 UTC (rev 4450) @@ -13,7 +13,7 @@ \alias{xtsMakeUnique} \alias{xtsMerge} \alias{xtsNaOmit} -\alias{xtsNaLocf}, +\alias{xtsNaLocf} \docType{package} \title{Interface to the C API of xts} \description{This package helps with an Rcpp-based interface to the API Modified: pkg/RcppXts/src/xtsMod.cpp =================================================================== --- pkg/RcppXts/src/xtsMod.cpp 2013-08-27 16:03:24 UTC (rev 4449) +++ pkg/RcppXts/src/xtsMod.cpp 2013-08-30 01:34:19 UTC (rev 4450) @@ -87,9 +87,9 @@ function("xtsMerge", &xtsMerge, - List::create(Named("x"), Named("y"), Named("all"), Named("fill"), Named("retclass"), - Named("colnames"), Named("suffixes"), Named("retside"), - Named("env"), Named("coerce")), + List::create(Named("x"), Named("y"), Named("all"), Named("fill"), + Named("retclass"), Named("colnames"), Named("suffixes"), + Named("retside"), Named("env"), Named("coerce")), "Merge two series"); function("xtsNaOmit", @@ -97,7 +97,7 @@ List::create(Named("x")), "Omit NA values"); - // -- this requires xts 0.9-6 or later (fixed in SVN) + // -- this requires xts 0.9-7 or later function("xtsNaLocf", &xtsNaLocf, List::create(Named("x"), Named("fromLast"), Named("maxgap"), Named("limit")), Modified: pkg/RcppXts/tests/checks.R =================================================================== --- pkg/RcppXts/tests/checks.R 2013-08-27 16:03:24 UTC (rev 4449) +++ pkg/RcppXts/tests/checks.R 2013-08-30 01:34:19 UTC (rev 4450) @@ -35,8 +35,6 @@ xtsEndpoints(index(X), 60L, 4, TRUE) # every fourth minute, incl last xtsEndpoints(index(X), 60L, 4, FALSE) # every fourth minute -#stop("now") -#xtsMerge(X, X2, c(TRUE,TRUE), TRUE, TRUE, "a", "b", TRUE, new.env(), 0) Y <- 2*X #index(Y) <- index(Y) + runif(length(X)) * 0.01 #xtsMerge(X, Y, c(TRUE,TRUE), TRUE, TRUE, "a", "b", TRUE, new.env(), 0) @@ -47,9 +45,7 @@ xtsMerge(X, X, c(TRUE,TRUE), TRUE, TRUE, c("a", "b"), NULL, TRUE, new.env(), 0) - -## -- requires xts 0.9-6 (fixed in SVN) -## Y2 <- X2 -## Y2[3] <- NA -## Y2 -## xtsNaLocf(Y2, FALSE, 1, Inf) +Y2 <- X2 +Y2[3] <- NA +Y2 +xtsNaLocf(Y2, FALSE, 1, Inf) From noreply at r-forge.r-project.org Sat Aug 31 19:08:43 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 19:08:43 +0200 (CEST) Subject: [Rcpp-commits] r4451 - pkg/Rcpp Message-ID: <20130831170843.21C20180983@r-forge.r-project.org> Author: edd Date: 2013-08-31 19:08:42 +0200 (Sat, 31 Aug 2013) New Revision: 4451 Added: pkg/Rcpp/vignettes/ Log: beginning to move vignettes from inst/doc/ to vignettes/ From noreply at r-forge.r-project.org Sat Aug 31 19:12:29 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 19:12:29 +0200 (CEST) Subject: [Rcpp-commits] r4452 - in pkg/Rcpp: inst/doc vignettes Message-ID: <20130831171229.9C58A180983@r-forge.r-project.org> Author: edd Date: 2013-08-31 19:12:29 +0200 (Sat, 31 Aug 2013) New Revision: 4452 Added: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw Removed: pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw Log: moved Rcpp-unitTests vignette source (prior to rejigging to no longer require external R file) Deleted: pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw 2013-08-31 17:08:42 UTC (rev 4451) +++ pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw 2013-08-31 17:12:29 UTC (rev 4452) @@ -1,34 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-unitTests} -\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") -@ - -\usepackage[colorlinks]{hyperref} -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{\texttt{Rcpp}: Unit testing results} -\date{\texttt{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} - -\begin{document} -\maketitle - -\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} Copied: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw (from rev 4448, pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw) =================================================================== --- pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw (rev 0) +++ pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-08-31 17:12:29 UTC (rev 4452) @@ -0,0 +1,34 @@ +\documentclass[10pt]{article} +%\VignetteIndexEntry{Rcpp-unitTests} +\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") +@ + +\usepackage[colorlinks]{hyperref} +\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} +\title{\texttt{Rcpp}: Unit testing results} +\date{\texttt{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} + +\begin{document} +\maketitle + +\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 Aug 31 20:40:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 20:40:31 +0200 (CEST) Subject: [Rcpp-commits] r4453 - in pkg/Rcpp: . R inst/doc vignettes Message-ID: <20130831184031.6A4F51805AA@r-forge.r-project.org> Author: edd Date: 2013-08-31 20:40:31 +0200 (Sat, 31 Aug 2013) New Revision: 4453 Removed: pkg/Rcpp/inst/doc/unitTests/ Modified: pkg/Rcpp/R/unit.tests.R pkg/Rcpp/cleanup pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw Log: unitTest vignette now works from vignettes/ (and without using a Makefile) Modified: pkg/Rcpp/R/unit.tests.R =================================================================== --- pkg/Rcpp/R/unit.tests.R 2013-08-31 17:12:29 UTC (rev 4452) +++ pkg/Rcpp/R/unit.tests.R 2013-08-31 18:40:31 UTC (rev 4453) @@ -16,36 +16,36 @@ # along with Rcpp. If not, see . test <- function( output = if( file.exists( "/tmp" ) ) "/tmp" else getwd() ){ - if( !file.exists( output ) ){ stop( "output directory does not exist" ) } - - Rscript <- file.path( R.home( component = "bin" ), "Rscript" ) - if( .Platform$OS.type == "windows" ){ - Rscript <- sprintf( "%s.exe", Rscript ) - } - test.script <- system.file( "unitTests", "runTests.R", package = "Rcpp" ) - cmd <- sprintf( '"%s" "%s" --output=%s', Rscript, test.script, output ) - system( cmd ) + if( !file.exists( output ) ){ stop( "output directory does not exist" ) } + + Rscript <- file.path( R.home( component = "bin" ), "Rscript" ) + if( .Platform$OS.type == "windows" ){ + Rscript <- sprintf( "%s.exe", Rscript ) + } + test.script <- system.file( "unitTests", "runTests.R", package = "Rcpp" ) + cmd <- sprintf( '"%s" "%s" --output=%s', Rscript, test.script, output ) + system( cmd ) } compile_unit_tests <- function( definitions, includes = "", cxxargs = "" ){ signatures <- lapply(definitions, "[[", 1L) bodies <- lapply(definitions, "[[", 2L) cxxfunction <- get( "cxxfunction", asNamespace("inline" ) ) - fun <- cxxfunction( signatures, bodies, plugin = "Rcpp", - includes = sprintf( "using namespace std;\n%s", paste( includes, collapse = "\n") ), + fun <- cxxfunction( signatures, bodies, plugin = "Rcpp", + includes = sprintf( "using namespace std;\n%s", paste( includes, collapse = "\n") ), cxxargs = cxxargs ) fun } unit_test_setup <- function(file, packages = NULL) { - function(){ - if( !is.null(packages) ){ - for( p in packages ){ - suppressMessages( require( p, character.only = TRUE ) ) - } - } - if (!exists("pathRcppTests")) pathRcppTests <- getwd() + function(){ + if( !is.null(packages) ){ + for( p in packages ){ + suppressMessages( require( p, character.only = TRUE ) ) + } + } + if (!exists("pathRcppTests")) pathRcppTests <- getwd() sourceCpp(file.path(pathRcppTests, "cpp", file )) } } Modified: pkg/Rcpp/cleanup =================================================================== --- pkg/Rcpp/cleanup 2013-08-31 17:12:29 UTC (rev 4452) +++ pkg/Rcpp/cleanup 2013-08-31 18:40:31 UTC (rev 4453) @@ -24,10 +24,11 @@ src/Makedeps libRcpp.a \ build/Rcpp.pdf \ src/symbols.rds \ - inst/unitTests/testRcppClass/src/symbols.rds + inst/unitTests/testRcppClass/src/symbols.rds \ + vignettes/*.aux vignettes/*.log vignettes/*.out \ rm -rf autom4te.cache inst/lib/ inst/doc/man/ inst/doc/html/ inst/doc/latex/ \ - inst/doc/auto inst/doc/Rcpp-*/auto/ src-* + inst/doc/auto inst/doc/Rcpp-*/auto/ src-* vignettesq/auto find . -name \*~ -exec rm {} \; find . -name \*.flc -exec rm {} \; Modified: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-08-31 17:12:29 UTC (rev 4452) +++ pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-08-31 18:40:31 UTC (rev 4453) @@ -1,5 +1,8 @@ \documentclass[10pt]{article} %\VignetteIndexEntry{Rcpp-unitTests} +%\VignetteKeywords{R,Rcpp,unit tests} +%\VignettePackage{Rcpp} + \usepackage{vmargin} \setmargrb{0.75in}{0.75in}{0.75in}{0.75in} @@ -7,28 +10,60 @@ \RequirePackage[T1]{fontenc} <>= -require( Rcpp ) +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{\texttt{Rcpp}: Unit testing results} -\date{\texttt{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} +\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 ) ) +if (file.exists(results)) { + writeLines(readLines(results)) } else{ - writeLines( "unit test results not available" ) + writeLines( "unit test results not available" ) } @ + \end{verbatim} \end{document} From noreply at r-forge.r-project.org Sat Aug 31 20:44:09 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 20:44:09 +0200 (CEST) Subject: [Rcpp-commits] r4454 - pkg/Rcpp Message-ID: <20130831184409.EEABE1805AA@r-forge.r-project.org> Author: edd Date: 2013-08-31 20:44:09 +0200 (Sat, 31 Aug 2013) New Revision: 4454 Modified: pkg/Rcpp/cleanup Log: also clean *.tex, fix one typo Modified: pkg/Rcpp/cleanup =================================================================== --- pkg/Rcpp/cleanup 2013-08-31 18:40:31 UTC (rev 4453) +++ pkg/Rcpp/cleanup 2013-08-31 18:44:09 UTC (rev 4454) @@ -26,9 +26,10 @@ src/symbols.rds \ inst/unitTests/testRcppClass/src/symbols.rds \ vignettes/*.aux vignettes/*.log vignettes/*.out \ + vignettes/*.tex rm -rf autom4te.cache inst/lib/ inst/doc/man/ inst/doc/html/ inst/doc/latex/ \ - inst/doc/auto inst/doc/Rcpp-*/auto/ src-* vignettesq/auto + inst/doc/auto inst/doc/Rcpp-*/auto/ src-* vignettes/auto find . -name \*~ -exec rm {} \; find . -name \*.flc -exec rm {} \; From noreply at r-forge.r-project.org Sat Aug 31 20:52:30 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 20:52:30 +0200 (CEST) Subject: [Rcpp-commits] r4455 - in pkg/Rcpp: inst/doc inst/doc/Rcpp-sugar vignettes Message-ID: <20130831185230.3B6931856E5@r-forge.r-project.org> Author: edd Date: 2013-08-31 20:52:29 +0200 (Sat, 31 Aug 2013) New Revision: 4455 Added: pkg/Rcpp/vignettes/.install_extras pkg/Rcpp/vignettes/Rcpp-sugar.Rnw pkg/Rcpp/vignettes/Rcpp.bib Removed: pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw pkg/Rcpp/inst/doc/Rcpp.bib Log: Rcpp-sugar vignette moved to vignettes/ Deleted: pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw 2013-08-31 18:44:09 UTC (rev 4454) +++ pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw 2013-08-31 18:52:29 UTC (rev 4455) @@ -1,777 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-sugar} -\usepackage[USletter]{vmargin} -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} - -\usepackage{color, alltt} -\usepackage[authoryear,round,longnamesfirst]{natbib} -\usepackage[colorlinks]{hyperref} -\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -\newcommand{\proglang}[1]{\textsf{#1}} -\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} -\newcommand{\sugar}{\textsl{Rcpp sugar}} -\newcommand{\ith}{\textsl{i}-\textsuperscript{th}} -\newcommand{\code}[1]{\texttt{#1}} - -<>= -prettyVersion <- packageDescription("Rcpp")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -@ - -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{\pkg{Rcpp} syntactic sugar} -\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 - -\abstract{ - \noindent - This note describes \sugar~which has been introduced in - version 0.8.3 of \pkg{Rcpp} \citep{CRAN:Rcpp,JSS:Rcpp}. \sugar~ - brings a higher-level of abstraction to \proglang{C++} code - written using the \pkg{Rcpp} API. - - \sugar~is based on expression templates - \citep{Abrahams+Gurtovoy:2004:TemplateMetaprogramming,Vandevoorde+Josuttis:2003:Templates} and provides - some 'syntactic sugar' facilities directly in \pkg{Rcpp}. This is similar - to how \pkg{RcppArmadillo} \citep{CRAN:RcppArmadillo} offers - linear algebra \proglang{C++} classes based on \pkg{Armadillo} - \citep{Sanderson:2010:Armadillo}. - % TODO: reference to armadillo, blitz, etc ... -} - -\section{Motivation} - -\pkg{Rcpp} facilitates development of internal compiled code in an \proglang{R} -package by abstracting low-level details of the \proglang{R} API \citep{R:Extensions} -into a consistent set of \proglang{C++} classes. - -Code written using \pkg{Rcpp} classes is easier to read, write and maintain, -without loosing performance. Consider the following code example which -provides a function \texttt{foo} as a \proglang{C++} extension to -\proglang{R} by using the \pkg{Rcpp} API: - -<>= -RcppExport SEXP foo( SEXP x, SEXP y){ - Rcpp::NumericVector xx(x), yy(y) ; - int n = xx.size() ; - Rcpp::NumericVector res( n ) ; - double x_ = 0.0, y_ = 0.0 ; - for( int i=0; i>= -foo <- function(x, y){ - ifelse( x < y, x*x, -(y*y) ) -} -@ - -Put succinctly, the motivation of \sugar~is to bring a subset of the -high-level \proglang{R} syntax in \proglang{C++}. Hence, with \sugar, the -\proglang{C++} version of \texttt{foo} now becomes: - -<>= -RcppExport SEXP foo( SEXP xs, SEXP ys){ - Rcpp::NumericVector x(xs) ; - Rcpp::NumericVector y(ys) ; - return Rcpp::wrap( ifelse( x < y, x*x, -(y*y) )) ; -} -@ - -Apart from the fact that we need to assign the two objects we obtain from -\proglang{R}---which is a simple statement each thanks to the template magic -in \pkg{Rcpp}---and the need for explicit \texttt{return} and -\texttt{Rcpp::wrap} statements, the code is now identical between -highly-vectorised \proglang{R} and \proglang{C++}. - -\sugar~is written using expression templates and lazy evaluation techniques -\citep{Abrahams+Gurtovoy:2004:TemplateMetaprogramming,Vandevoorde+Josuttis:2003:Templates}. -This not only allows a much nicer high-level syntax, but also makes it -rather efficient (as we detail in section~\ref{sec:performance} below). - -\section{Operators} - -\sugar~takes advantage of \proglang{C++} operator overloading. The next few -sections discuss several examples. - -\subsection{Binary arithmetic operators} - -\sugar~defines the usual binary arithmetic operators : \texttt{+}, \texttt{-}, -\texttt{*}, \texttt{/}. - -<>= -// two numeric vectors of the same size -NumericVector x ; -NumericVector y ; - -// expressions involving two vectors -NumericVector res = x + y ; -NumericVector res = x - y ; -NumericVector res = x * y ; -NumericVector res = x / y ; - -// one vector, one single value -NumericVector res = x + 2.0 ; -NumericVector res = 2.0 - x; -NumericVector res = y * 2.0 ; -NumericVector res = 2.0 / y; - -// two expressions -NumericVector res = x * y + y / 2.0 ; -NumericVector res = x * ( y - 2.0 ) ; -NumericVector res = x / ( y * y ) ; -@ - -The left hand side (lhs) and the right hand side (rhs) of each binary -arithmetic expression must be of the same type (for example they should be both -\texttt{numeric} expressions). - -The lhs and the rhs can either have the same size or one of them could -be a primitive value of the appropriate type, for example adding a -\texttt{NumericVector} and a \texttt{double}. - -\subsection{Binary logical operators} - -Binary logical operators create a \texttt{logical} sugar expression -from either two sugar expressions of the same type or one sugar expression -and a primitive value of the associated type. - -<>= -// two integer vectors of the same size -NumericVector x ; -NumericVector y ; - -// expressions involving two vectors -LogicalVector res = x < y ; -LogicalVector res = x > y ; -LogicalVector res = x <= y ; -LogicalVector res = x >= y ; -LogicalVector res = x == y ; -LogicalVector res = x != y ; - -// one vector, one single value -LogicalVector res = x < 2 ; -LogicalVector res = 2 > x; -LogicalVector res = y <= 2 ; -LogicalVector res = 2 != y; - -// two expressions -LogicalVector res = ( x + y ) < ( x*x ) ; -LogicalVector res = ( x + y ) >= ( x*x ) ; -LogicalVector res = ( x + y ) == ( x*x ) ; -@ - -\subsection{Unary operators} - -The unary \texttt{operator-} can be used to negate a (numeric) sugar expression. -whereas the unary \texttt{operator!} negates a logical sugar expression: - -<>= -// a numeric vector -NumericVector x ; - -// negate x -NumericVector res = -x ; - -// use it as part of a numerical expression -NumericVector res = -x * ( x + 2.0 ) ; - - -// two integer vectors of the same size -NumericVector y ; -NumericVector z ; - -// negate the logical expression "y < z" -LogicalVector res = ! ( y < z ); -@ - -\section{Functions} - -\sugar~defines functions that closely match the behavior of \proglang{R} -functions of the same name. - -\subsection{Functions producing a single logical result} - -Given a logical sugar expression, the \texttt{all} function identifies if all -the elements are \texttt{TRUE}. Similarly, the \texttt{any} function -identifies if any the element is \texttt{TRUE} when -given a logical sugar expression. - - -<>= -IntegerVector x = seq_len( 1000 ) ; -all( x*x < 3 ) ; - -any( x*x < 3 ) ; -@ - -Either call to \texttt{all} and \texttt{any} creates an object of a class -that has member functions \texttt{is\_true}, \texttt{is\_false}, -\texttt{is\_na} and a conversion to \texttt{SEXP} operator. - -One important thing to highlight is that \texttt{all} is lazy. Unlike -\proglang{R}, there is no need to fully evaluate the expression. In the -example above, the result of \texttt{all} is fully resolved after evaluating -only the two first indices of the expression \verb|x * x < 3|. \texttt{any} -is lazy too, so it will only need to resolve the first element of the example -above. - -%\subsubsection{Conversion to bool} - -One important thing to note concernc the conversion to the \texttt{bool} -type. In order to respect the concept of missing values (\texttt{NA}) in -\proglang{R}, expressions generated by \texttt{any} or \texttt{all} can not -be converted to \texttt{bool}. Instead one must use \texttt{is\_true}, -\texttt{is\_false} or \texttt{is\_na}: - -<>= -// wrong: will generate a compile error -bool res = any( x < y) ) ; - -// ok -bool res = is_true( any( x < y ) ) -bool res = is_false( any( x < y ) ) -bool res = is_na( any( x < y ) ) -@ - -% FIXME this may need some expanding the trivariate bool and how to use it - - -\subsection{Functions producing sugar expressions} - -\subsubsection{is\_na} - -Given a sugar expression of any type, \verb|is_na| (just like the other -functions in this section) produces a logical sugar expression of the same -length. Each element of the result expression evaluates to \texttt{TRUE} if -the corresponding input is a missing value, or \texttt{FALSE} otherwise. - -<>= -IntegerVector x = IntegerVector::create( 0, 1, NA_INTEGER, 3 ) ; - -is_na( x ) -all( is_na( x ) ) -any( ! is_na( x ) ) -@ - -\subsubsection{seq\_along} - -Given a sugar expression of any type, \texttt{seq\_along} creates an -integer sugar expression whose values go from 1 to the sire of the input. - -<>= -IntegerVector x = IntegerVector::create( 0, 1, NA_INTEGER, 3 ) ; - -seq_along( x ) -seq_along( x * x * x * x * x * x * x ) -@ - -This is the most lazy function, as it only needs to call the \texttt{size} -member function of the input expression. The input expression need not to be -resolved. The two examples above gives the same result with the same efficiency -at runtime. The compile time will be affected by the complexity of the -second expression, since the abstract syntax tree is built at compile time. - -\subsubsection{seq\_len} - -\texttt{seq\_len} creates an integer sugar expression whose \ith\ -element expands to \texttt{i}. \texttt{seq\_len} is particularly useful in -conjunction with \texttt{sapply} and \texttt{lapply}. - -<>= -// 1, 2, ..., 10 -IntegerVector x = seq_len( 10 ) ; - -lapply( seq_len(10), seq_len ) -@ - -\subsubsection{pmin and pmax} - -Given two sugar expressions of the same type and size, or one expression and -one primitive value of the appropriate type, \texttt{pmin} (\texttt{pmax}) -generates a sugar expression of the same type whose \ith\ element expands to -the lowest (highest) value between the \ith\ element of the first expression -and the \ith element of the second expression. - -<>= -IntegerVector x = seq_len( 10 ) ; - -pmin( x, x*x ) -pmin( x*x, 2 ) - -pmin( x, x*x ) -pmin( x*x, 2 ) -@ - -\subsubsection{ifelse} - -Given a logical sugar expression and either : -\begin{itemize} -\item two compatible sugar expression (same type, same size) -\item one sugar expression and one compatible primitive -\end{itemize} -\texttt{ifelse} expands to a sugar expression whose \ith\ -element is the \ith\ element of the first expression -if the \ith\ element of the condition expands to \texttt{TRUE} -or the \ith\ of the second expression if -the \ith\ element of the condition expands to \texttt{FALSE}, -or the appropriate missing value otherwise. - -<>= -IntegerVector x ; -IntegerVector y ; - -ifelse( x < y, x, (x+y)*y ) -ifelse( x > y, x, 2 ) -@ - -\subsubsection{sapply} - -\texttt{sapply} applies a \proglang{C++} function to each element -of the given expression to create a new expression. The type of the -resulting expression is deduced by the compiler from the result type of -the function. - -The function can be a free \proglang{C++} function such as the overload -generated by the template function below: - -<>= -template -T square( const T& x){ - return x * x ; -} -sapply( seq_len(10), square ) ; -@ - -Alternatively, the function can be a functor whose type has a nested type -called \texttt{result\_type} - -<>= -template -struct square : std::unary_function { - T operator()(const T& x){ - return x * x ; - } -} -sapply( seq_len(10), square() ) ; -@ - -\subsubsection{lapply} - -\texttt{lapply} is similar to \texttt{sapply} except that the result is -allways an list expression (an expression of type \texttt{VECSXP}). - -\subsubsection{sign} - -Given a numeric or integer expression, \texttt{sign} expands to an expression -whose values are one of 1, 0, -1 or \texttt{NA}, depending on the sign -of the input expression. - -<>= -IntegerVector xx; - -sign( xx ) -sign( xx * xx ) -@ - -\subsubsection{diff} - -The \ith\ element of the result of \texttt{diff} is -the difference between the $(i+1)$\textsuperscript{th} and the -\ith\ element of the input expression. Supported types are -integer and numeric. - -<>= -IntegerVector xx; - -diff( xx ) -@ - -\subsection{Mathematical functions} - -For the following set of functions, generally speaking, the \ith\ element of -the result of the given function (say, \texttt{abs}) is the result of -applying that function to this \ith\ element of the input expression. -Supported types are integer and numeric. - -<>= -IntegerVector x; - -abs( x ) -exp( x ) -floor( x ) -ceil( x ) -pow(x, z) # x to the power of z -@ - -% log() and log10() maybe? Or ln() ? - -\subsection{The d/q/p/q statistical functions} - -The framework provided by \sugar also permits easy and efficient access the -density, distribution function, quantile and random number generation -functions function by \proglang{R} in the \code{Rmath} library. - -Currently, most of these functions are vectorised for the first element which -denote size. Consequently, these calls works in \proglang{C++} just as they -would in \proglang{R}: - -<>= -x1 = dnorm(y1, 0, 1); // density of y1 at m=0, sd=1 -x2 = pnorm(y2, 0, 1); // distribution function of y2 -x3 = qnorm(y3, 0, 1); // quantiles of y3 -x4 = rnorm(n, 0, 1); // 'n' RNG draws of N(0, 1) -@ - -Similar d/q/p/r functions are provided for the most common distributions: -beta, binom, cauchy, chisq, exp, f, gamma, geom, hyper, lnorm, logis, nbeta, -nbinom, nbinom\_mu, nchisq, nf, norm, nt, pois, t, unif, and weibull. - -One point to note is that the programmer using these functions needs to -initialize the state of the random number generator as detailed in Section -6.3 of the `Writing R Extensions' manual \citep{R:Extensions}. A nice -\proglang{C++} solution for this is to use a \textsl{scoped} class that sets -the random number generatator on entry to a block and resets it on exit. We -offer the \code{RNGScope} class which allows code such as - -<>= -RcppExport SEXP getRGamma() { - RNGScope scope; - NumericVector x = rgamma( 10, 1, 1 ); - return x; -} -@ - -As there is some computational overhead involved in using \code{RNGScope}, we -are not wrapping it around each inner function. Rather, the user of these -functions (\textsl{i.e.} you) should place an \code{RNGScope} at the -appropriate level of your code. - - -\section{Performance} -\label{sec:performance} - -TBD - -\section{Implementation} - -This section details some of the techniques used in the implementation of -\sugar. Note that the user need not to be familiar with the implementation -details in order to use \sugar, so this section can be skipped upon a first -read of the paper. - -Writing \sugar~functions is fairly repetitive and follows a well-structured -pattern. So once the basic concepts are mastered (which may take time given -the inherent complexities in template programming), it should be possible to -extend the set of function further following the established pattern.. - -\subsection{The curiously recurring template pattern} - -Expression templates such as those used by \sugar~use a technique -called the \emph{Curiously Recurring Template Pattern} (CRTP). The general -form of CRTP is: - -<>= -// The Curiously Recurring Template Pattern (CRTP) -template -struct base { - // ... -}; -struct derived : base { - // ... -}; -@ - -The \texttt{base} class is templated by the class that derives from it : -\texttt{derived}. This shifts the relationship between a base class and a -derived class as it allows the base class to access methods of the derived -class. - -\subsection{The VectorBase class} - -The CRTP is used as the basis for \sugar~with the \texttt{VectorBase} -class template. All sugar expression derive from one class generated by the -\texttt{VectorBase} template. The current definition of \texttt{VectorBase} -is given here: - -<>= -template -class VectorBase { -public: - struct r_type : traits::integral_constant{} ; - struct can_have_na : traits::integral_constant{} ; - typedef typename traits::storage_type::type stored_type ; - - VECTOR& get_ref(){ - return static_cast(*this) ; - } - - inline stored_type operator[]( int i) const { - return static_cast(this)->operator[](i) ; - } - - inline int size() const { return static_cast(this)->size() ; } - - /* definition ommited here */ - class iterator ; - - inline iterator begin() const { return iterator(*this, 0) ; } - inline iterator end() const { return iterator(*this, size() ) ; } -} -@ - -The \texttt{VectorBase} template has three parameters: - -\begin{itemize} -\item \texttt{RTYPE}: This controls the type of expression (INTSXP, REALSXP, - ...) -\item \texttt{na}: This embeds in the derived type information about whether - instances may contain missing values. \pkg{Rcpp} vector types - (\texttt{IntegerVector}, ...) derive from \texttt{VectorBase} with this - parameter set to \texttt{true} because there is no way to know at - compile-time if the vector will contain missing values at run-time. - However, this parameter is set to \texttt{false} for types that are - generated by sugar expressions as these are guaranteed to produce - expressions that are without missing values. An example is the - \texttt{is\_na} function. This parameter is used in several places as part - of the compile time dispatch to limit the occurence of redundant - operations. -\item \texttt{VECTOR}: This parameter is the key of \sugar. This is the - manifestation of CRTP. The indexing operator and the \texttt{size} method - of \texttt{VectorBase} use a static cast of \texttt{this} to the - \texttt{VECTOR} type to forward calls to the actual method of the derived - class. -\end{itemize} - -\subsection{Example : sapply} - -As an example, the current implementation of \texttt{sapply}, supported by -the template class \texttt{Rcpp::sugar::Sapply} is given below: - -<>= -template -class Sapply : public VectorBase< - Rcpp::traits::r_sexptype_traits< - typename ::Rcpp::traits::result_of::type - >::rtype , - true , - Sapply -> { -public: - typedef typename ::Rcpp::traits::result_of::type ; - const static int RESULT_R_TYPE = - Rcpp::traits::r_sexptype_traits::rtype ; - typedef Rcpp::VectorBase VEC ; - typedef typename Rcpp::traits::r_vector_element_converter::type - converter_type ; - typedef typename Rcpp::traits::storage_type::type STORAGE ; - - Sapply( const VEC& vec_, Function fun_ ) : vec(vec_), fun(fun_){} - - inline STORAGE operator[]( int i ) const { - return converter_type::get( fun( vec[i] ) ); - } - inline int size() const { return vec.size() ; } - -private: - const VEC& vec ; - Function fun ; -} ; - -// sugar - -template -inline sugar::Sapply -sapply( const Rcpp::VectorBase& t, Function fun ){ - return sugar::Sapply( t, fun ) ; -} -@ - -\subsubsection{The sapply function} - -\texttt{sapply} is a template function that takes two arguments. -\begin{itemize} -\item The first argument -is a sugar expression, which we recognize because of the relationship with -the \texttt{VectorBase} class template. -\item The second argument is the function to apply. -\end{itemize} - -The \texttt{sapply} function itself does not do anything, it is just used -to trigger compiler detection of the template parameters that will be used -in the \texttt{sugar::Sapply} template. - -\subsubsection{Detection of return type of the function} - -In order to decide which kind of expression is built, the \texttt{Sapply} -template class queries the template argument via the \texttt{Rcpp::traits::result\_of} -template. - -<>= -typedef typename ::Rcpp::traits::result_of::type result_type ; -@ - -The \texttt{result\_of} type trait is implemented as such: - -<>= -template -struct result_of{ - typedef typename T::result_type type ; -} ; - -template -struct result_of< RESULT_TYPE (*)(INPUT_TYPE) >{ - typedef RESULT_TYPE type ; -} ; -@ - -The generic definition of \texttt{result\_of} targets functors -with a nested \texttt{result\_type} type. - -The second definition is a partial specialization targetting -function pointers. - -\subsubsection{Indentification of expression type} - -Based on the result type of the function, the \texttt{r\_sexptype\_traits} -trait is used to identify the expression type. - -<>= -const static int RESULT_R_TYPE = - Rcpp::traits::r_sexptype_traits::rtype ; -@ - -\subsubsection{Converter} - -The \texttt{r\_vector\_element\_converter} class is used to convert an -object of the function's result type to the actual storage type suitable -for the sugar expression. - -<>= -typedef typename Rcpp::traits::r_vector_element_converter::type - converter_type ; - -@ - -\subsubsection{Storage type} - -The \texttt{storage\_type} trait is used to get access to the storage type -associated with a sugar expression type. For example, the storage type -of a \texttt{REALSXP} expression is \texttt{double}. - -<>= -typedef typename Rcpp::traits::storage_type::type STORAGE ; -@ - -\subsubsection{Input expression base type} - -The input expression --- the expression over which \texttt{sapply} runs --- is -also typedef'ed for convenience: - -<>= -typedef Rcpp::VectorBase VEC ; -@ - -\subsubsection{Output expression base type} - -In order to be part of the \sugar~system, the type generated by the -\texttt{Sapply} class template must inherit from \texttt{VectorBase}. - -<>= -template -class Sapply : public VectorBase< - Rcpp::traits::r_sexptype_traits< - typename ::Rcpp::traits::result_of::type - >::rtype , - true , - Sapply -> -@ - -The expression built by \texttt{Sapply} depends on the result type -of the function, may contain missing values, and the third argument -is the manifestation of the \emph{CRTP}. - -\subsubsection{Constructor} - -The constructor of the \texttt{Sapply} class template is straightforward, it -simply consists of holding the reference to the input expression and the -function. - -<>= -Sapply( const VEC& vec_, Function fun_ ) : vec(vec_), fun(fun_){} - -private: - const VEC& vec ; - Function fun ; -@ - -\subsubsection{Implementation} - -The indexing operator and the \texttt{size} member function is what -the \texttt{VectorBase} expects. The size of the result expression is -the same as the size of the input expression and the i\textsuperscript{th} -element of the result is simply retrieved by applying the function -and the converter. Both these methods are inline to maximize performance: - -<>= -inline STORAGE operator[]( int i ) const { - return converter_type::get( fun( vec[i] ) ); -} -inline int size() const { return vec.size() ; } -@ - -\section{Summary} - -TBD - -\bibliographystyle{plainnat} -\bibliography{Rcpp} - -\end{document} - Deleted: pkg/Rcpp/inst/doc/Rcpp.bib =================================================================== --- pkg/Rcpp/inst/doc/Rcpp.bib 2013-08-31 18:44:09 UTC (rev 4454) +++ pkg/Rcpp/inst/doc/Rcpp.bib 2013-08-31 18:52:29 UTC (rev 4455) @@ -1,628 +0,0 @@ - at String{CRAN = "http://CRAN.R-Project.org/" } - at String{manuals = CRAN # "doc/manuals/" } - at String{RCoreTeam = "{R Development Core Team}" } - at String{RFoundation = "R Foundation for Statistical Computing" } - at String{R-Forge = "http://R-Forge.R-Project.org/" } - - at Misc{Cpp11, - author = "ISO/IEC", - organization = "{International Organization for Standardization}", - title = "\proglang{C++} 2011 Standard Document 14882:2011", - howpublished = {ISO/IEC Standard Group for Information Technology / Programming Languages / C++}, - year = 2011, - url = "http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372", - urlansi = "http://webstore.ansi.org/RecordDetail.aspx?sku=ISO/IEC%2014882:2011" -} - - at manual{Abrahams+Grosse-Kunstleve:2003:Boost.Python, - author = { David Abrahams and Ralf W. Grosse-Kunstleve }, - organization = "Boost Consulting", - title = "Building Hybrid Systems with Boost.Python", - year = 2003, - url = "http://www.boostpro.com/writing/bpl.pdf" -} - - at Book{Abrahams+Gurtovoy:2004:TemplateMetaprogramming, - author = {David Abrahams and Aleksey Gurtovoy}, - title = {{C++} {T}emplate {M}etaprogramming: Concepts, Tools - and Techniques from {B}oost and Beyond}, - publisher = {Addison-Wesley}, - year = 2004, - address = {Boston} -} - - at Manual{Armstrong:2009:RAbstraction, - title = {{RAbstraction}: {C++} abstraction for {R} objects}, - author = {Whit Armstrong}, - year = 2009, - note = {Code repository last updated 2009-07-22.}, - url = {http://github.com/armstrtw/rabstraction} -} - - at Manual{Armstrong:2009:RObjects, - title = {{RObjects}: {C++} wrapper for R objects (a better - implementation of {RAbstraction}}, - author = {Whit Armstrong}, - year = 2009, - note = {Code repository last updated 2009-11-28.}, - url = {http://github.com/armstrtw/RObjects} -} - - at InProceedings{Bates+DebRoy:2001:C++Classes, - author = {Douglas M. Bates and Saikat DebRoy}, - title = {{C++} Classes for {R} Objects}, - booktitle = {Proceedings of the 2nd International Workshop on Distributed - Statistical Computing, March 15--17, 2001, Technische - Universit\"at Wien, Vienna, Austria}, - editor = {Kurt Hornik and Friedrich Leisch}, - year = {2001}, - url = {http://www.ci.tuwien.ac.at/Conferences/DSC-2001/Proceedings/}, - note = {ISSN 1609-395X} -} - - - at Misc{Brokken:2011:Cpp, - author = {Frank B. Brokken}, - title = {C++ Annotations}, - howpublished = {Electronic book, University of Groningen}, - year = 2011, - url = {http://www.icce.rug.nl/documents/cplusplus/} -} - - at Book{Chambers:2008:SoDA, - author = {John M. Chambers}, - title = {Software for Data Analysis: Programming with {R}}, - publisher = {Springer-Verlag}, - year = 2008, - series = {Statistics and Computing}, - address = {Heidelberg}, - note = {{ISBN} 978-0-387-75935-7} -} - - at Book{Chambers:1998:PwD, - author = {John M. Chambers}, - title = {Programming with Data: {A} Guide to the {S} Language}, - publisher = {Springer-Verlag}, - year = 1998, - address = {Heidelberg}, - note = {{ISBN} 978-0387985039} -} - - at Manual{CRAN:RInside, - title = {RInside: C++ classes to embed R in C++ applications}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - year = 2012, - note = {R package version 0.2.10}, - url = CRAN # "package=RInside" -} - - at Manual{CRAN:RProtoBuf, - title = {RProtoBuf: R Interface to the Protocol Buffers API}, - author = {Romain Fran\c{c}ois and Dirk Eddelbuettel}, - year = 2012, - note = {R package version 0.2.6}, - url = CRAN # "package=RProtoBuf" -} - - at Manual{CRAN:RQuantLib, - title = {RQuantLib: {R} interface to the {QuantLib} library}, - author = {Dirk Eddelbuettel and Khanh Nguyen}, - year = 2013, - note = {R package version 0.3.10}, - url = CRAN # "package=RQuantLib" -} - - at Manual{CRAN:rbenchmark, - title = {\pkg{rbenchmark}: Benchmarking routine for \proglang{R}}, - author = {Wacek Kusnierczyk}, - year = 2012, - note = {R package version 1.0.0}, - url = CRAN # "package=rbenchmark" -} - - at Article{JSS:Rcpp, - title = {{Rcpp}: Seamless {R} and {C++} Integration}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - journal = {Journal of Statistical Software}, - year = 2011, - volume = 40, - number = 8, - pages = {1--18}, - url = {http://www.jstatsoft.org/v40/i08/}, -} - - at Manual{CRAN:Rcpp, - title = {{Rcpp}: Seamless {R} and {C++} Integration}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - year = 2013, - note = {R package version 0.10.4}, - url = CRAN # "package=Rcpp" -} - - at Manual{CRAN:Rcpp:Attributes, - crossref = {CRAN:Rcpp}, - author = {J. J. Allaire and Dirk Eddelbuettel and Romain Fran\c{c}ois}, - title = {{Rcpp} Attributes}, - year = 2013, - note = {Vignette included in R package Rcpp}, - url = CRAN # "package=Rcpp" -} - - at Manual{CRAN:Rcpp:Modules, - crossref = {CRAN:Rcpp}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - title = {Exposing {C++} functions and classes with {Rcpp} modules}, - year = 2013, - note = {Vignette included in R package Rcpp}, - url = CRAN # "package=Rcpp" -} - - at Manual{CRAN:Rcpp:Sugar, - crossref = {CRAN:Rcpp}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - title = {{Rcpp} syntactic sugar}, - year = 2013, - note = {Vignette included in R package Rcpp}, - url = CRAN # "package=Rcpp" -} - - at Manual{CRAN:RcppArmadillo, - title = {RcppArmadillo: Rcpp integration for Armadillo - templated linear algebra library}, - author = {Romain Fran\c{c}ois and Dirk Eddelbuettel and - Douglas Bates}, - year = 2013, - note = {R package version 0.3.900.0}, - url = CRAN # "package=RcppArmadillo" -} - - at Manual{CRAN:RcppClassic, - title = {RcppClassic: Deprecated 'classic' Rcpp API}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - year = 2012, - note = {R package version 0.9.3}, - url = CRAN # "package=RcppClassic" -} - - at Manual{CRAN:RcppDE, - title = {RcppDE: Global optimization by differential evolution in C++}, - author = {Dirk Eddelbuettel}, - year = 2010, - note = {R package version 0.1.0}, - url = CRAN # "package=RcppDE" -} - - at Manual{CRAN:RcppEigen, - title = {RcppEigen: Rcpp integration for the Eigen templated linear - algebra library}, - author = {Douglas Bates and Romain Fran\c{c}ois and Dirk Eddelbuettel}, - year = 2013, - note = {{R} package version 0.3.1.2.1}, - url = CRAN # "package=RcppEigen" -} - - at Article{JSS:RcppEigen, - title = {Fast and Elegant Numerical Linear Algebra Using the - {RcppEigen} Package}, - author = {Douglas Bates and Dirk Eddelbuettel}, - journal = {Journal of Statistical Software}, - year = {2013}, - volume = {52}, - number = {5}, - pages = {1--24}, - url = {http://www.jstatsoft.org/v52/i05/}, -} - - at Manual{CRAN:RcppExamples, - title = {RcppExamples: Examples using {Rcpp} to interface {R} - and {C++}}, - author = {Dirk Eddelbuettel and Romain Fran\c{c}ois}, - year = 2013, - note = {R package version 0.1.6}, - url = CRAN # "package=RcppExamples" -} - - at Manual{CRAN:RcppGSL, - title = {RcppGSL: Rcpp integration for GNU GSL vectors and matrices}, - author = {Romain Fran\c{c}ois and Dirk Eddelbuettel}, - year = 2012, - note = {R package version 0.2.0}, - url = CRAN # "package=RcppGSL" -} - - at Manual{CRAN:Rserve, - title = {Rserve: Binary R server}, - author = {Simon Urbanek}, - year = 2013, - note = {R package version 0.6-8.1}, - url = CRAN # "package=Rserve" -} - - at Manual{CRAN:cxxPack, - title = {cxxpack: {R/C++} Tools for Literate Statistical - Practice}, - author = {Dominick Samperi}, - year = 2010, - note = {R package version 7.0.6}, - url = CRAN # "package=cxxPack" -} - - at Manual{CRAN:highlight, - title = {highlight: Syntax highlighter}, - author = {Romain Fran\c{c}ois}, - year = 2013, - note = {R package with version 0.4.1}, - url = CRAN # "package=highlight" -} - - at Manual{CRAN:inline, - title = {inline: Inline C, C++, Fortran function calls from - R}, - author = {Oleg Sklyar and Duncan Murdoch and Mike Smith and - Dirk Eddelbuettel and Romain Fran\c{c}ois}, [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4455 From noreply at r-forge.r-project.org Sat Aug 31 20:54:32 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 20:54:32 +0200 (CEST) Subject: [Rcpp-commits] r4456 - in pkg/Rcpp: inst/doc/Rcpp-package inst/doc/Rcpp-quickref vignettes Message-ID: <20130831185432.9EDE3185DB9@r-forge.r-project.org> Author: edd Date: 2013-08-31 20:54:32 +0200 (Sat, 31 Aug 2013) New Revision: 4456 Added: pkg/Rcpp/vignettes/Rcpp-package.Rnw pkg/Rcpp/vignettes/Rcpp-quickref.Rnw Removed: pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw Log: Rcpp-quickref and Rcpp-package vignettes moved to vignettes/ Deleted: pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw 2013-08-31 18:52:29 UTC (rev 4455) +++ pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw 2013-08-31 18:54:32 UTC (rev 4456) @@ -1,389 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-package} -\usepackage[USletter]{vmargin} -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} -\usepackage{color,alltt} -\usepackage[authoryear,round,longnamesfirst]{natbib} - -\usepackage[colorlinks]{hyperref} -\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -\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") -@ - -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{Writing a package that uses \pkg{Rcpp} } -\date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} - -<>= -require( Rcpp ) -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 - -\abstract{ - \noindent This document provides a short overview of how to use - \pkg{Rcpp}~\citep{CRAN:Rcpp,JSS:Rcpp} when writing an \proglang{R} package. It - shows how usage of the function \Sexpr{link("Rcpp.package.skeleton")} - which creates a complete and self-sufficient example package using - \pkg{Rcpp}. All components of the directory tree created by - \Sexpr{link("Rcpp.package.skeleton")} are discussed in detail. This - document thereby complements the \textsl{Writing R Extensions} - manual~\citep{R:Extensions} which is the authoritative source on how to extend - \proglang{R} in general. -} - -\section{Introduction} - -\pkg{Rcpp}~\citep{CRAN:Rcpp,JSS:Rcpp} is an extension package for \proglang{R} which -offers an easy-to-use yet featureful interface between \proglang{C++} and -\proglang{R}. However, it is somewhat different from a traditional -\proglang{R} package because its key component is a \proglang{C++} library. A -client package that wants to make use of the \pkg{Rcpp} features must link -against the library provided by \pkg{Rcpp}. - -It should be noted that \proglang{R} has only limited support for -\proglang{C(++)}-level dependencies between packages~\citep{R:Extensions}. The -\texttt{LinkingTo} declaration in the package \texttt{DESCRIPTION} file -allows the client package to retrieve the headers of the target package (here -\pkg{Rcpp}), but support for linking against a library is not provided by -\proglang{R} and has to be added manually. - -This document follows the steps of the \Sexpr{link("Rcpp.package.skeleton")} -function to illustrate a recommended way of using \pkg{Rcpp} from a client -package. We illustrate this using a simple \proglang{C++} function -which will be called by an \proglang{R} function. - -We strongly encourage the reader to become familiar with the material in the -\textsl{Writing R Extensions} manual~\citep{R:Extensions}, as well as with other -documents on \proglang{R} package creation such as \cite{Leisch:2008:Tutorial}. Given -a basic understanding of how to create \proglang{R} package, the present -document aims to provide the additional information on how to use \pkg{Rcpp} -in such add-on packages. - -\section{Using \texttt{Rcpp.package.skeleton}} - -\subsection{Overview} - -\pkg{Rcpp} provides a function \Sexpr{link("Rcpp.package.skeleton")}, modeled -after the base \proglang{R} function \Sexpr{link("package.skeleton")}, which -facilitates creation of a skeleton package using \pkg{Rcpp}. - -\Sexpr{link("Rcpp.package.skeleton")} has a number of arguments documented on -its help page (and similar to those of \Sexpr{link("package.skeleton")}). The -main argument is the first one which provides the name of the package one -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" ) -% writeLines( system( "tree" , intern = TRUE ) ) -% @ -\begin{Hchunk} -\begin{Hinput} -\ttfamily\noindent -\hlprompt{\usebox{\hlboxgreaterthan}{\ }}\hlfunctioncall{Rcpp.package.skeleton}\hlkeyword{(}{\ }\hlstring{"mypackage"}{\ }\hlkeyword{)}\mbox{} -\normalfont - -\end{Hinput} - -\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} - -\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} -\end{Hchunk} - -Using \Sexpr{link("Rcpp.package.skeleton")} is by far the simplest approach -as it fulfills two roles. It creates the complete set of files needed for a -package, and it also includes the different components needed for using -\pkg{Rcpp} that we discuss in the following sections. - -\subsection{\proglang{R} 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}. - -<>= -highlight( - file.path( gendir, "mypackage", "R", "rcpp_hello_world.R" ), - renderer = renderer_latex( doc = FALSE ) - ) -@ - -\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. - -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. - -\subsection{\proglang{C++} code} - -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 - ) -@ - -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 -) -@ - -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: - -<<>>= -rcpp_hello_world( ) -@ - -\subsection{\texttt{DESCRIPTION}} - -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 ) -}) -@ - -\Sexpr{link("Rcpp.package.skeleton")} adds the three last lines to the -\texttt{DESCRIPTION} file generated by \Sexpr{link("package.skeleton")}. - -The \texttt{Depends} declaration indicates \proglang{R}-level dependency -between the client package and \pkg{Rcpp}. The \texttt{LinkingTo} declaration -indicates that the client package needs to use header files exposed by -\pkg{Rcpp}. - -\subsection{\texttt{Makevars} and \texttt{Makevars.win}} - -Unfortunately, the \texttt{LinkingTo} declaration in itself is not -enough to link to the user \proglang{C++} library of \pkg{Rcpp}. Until more -explicit support for libraries is added to \proglang{R}, we need to manually -add the \pkg{Rcpp} library to the \texttt{PKG\_LIBS} variable in the -\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 ) -}) -@ - -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 ) -}) -@ - -\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 ) -}) -@ - -This file serves two purposes. First, it ensure that the dynamic library -contained in the package we are creating via -\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. - -\subsection{Help files} - -Also created is a directory \texttt{man} containing two help files. One is -for the package itself, the other for the (single) \proglang{R} function -being provided and exported. - -The \textsl{Writing R Extensions} manual~\citep{R:Extensions} provides the complete -documentation on how to create suitable content for help files. - -\subsubsection{\texttt{mypackage-package.Rd}} - -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 ) -}) -@ - - -\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 ) -}) -@ - - -\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} -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 -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 -be found at the \href{http://CRAN.R-project.org/package=Rcpp}{CRAN page} of -\pkg{Rcpp}. - -\section{Other compilers} - -Less experienced \proglang{R} users on the Windows platform frequently ask -about using \pkg{Rcpp} with the Visual Studio toolchain. That is simply not -possible as \proglang{R} is built with the \pkg{gcc} compiler. Different -compilers have different linking conventions. These conventions are -particularly hairy when it comes to using \proglang{C++}. In short, it is -not possible to simply drop sources (or header files) from \pkg{Rcpp} into a -\proglang{C++} project built with Visual Studio, and this note makes no -attempt at claiming otherwise. - -\pkg{Rcpp} is fully usable on Windows provided the standard Windows -toolchain for \proglang{R} is used. See the \textsl{Writing R Extensions} -manual~\citep{R:Extensions} for details. - -\section{Summary} - -This document described how to use the \pkg{Rcpp} package for \proglang{R} -and \proglang{C++} integration when writing an \proglang{R} extension -package. The use of the \Sexpr{link("Rcpp.package.skeleton")} was shown in -detail, and references to further examples were provided. - -\bibliographystyle{plainnat} -\bibliography{Rcpp} - -\end{document} - Deleted: pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw 2013-08-31 18:52:29 UTC (rev 4455) +++ pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw 2013-08-31 18:54:32 UTC (rev 4456) @@ -1,379 +0,0 @@ -\documentclass[8pt,twocolumn,a4paper]{article} -%\VignetteIndexEntry{Rcpp-quickref} - -\setlength{\hoffset}{-0.8in} -\setlength{\voffset}{-0.8in} - -\setlength{\marginparwidth}{0pt} -\setlength{\marginparsep}{0pt} -\setlength{\oddsidemargin}{0pt} -\setlength{\headheight}{0pt} -\setlength{\topmargin}{0pt} -\setlength{\headsep}{0pt} -\setlength{\footskip}{0pt} -\setlength{\textheight}{27cm} -\setlength{\textwidth}{20cm} - -\usepackage[colorlinks]{hyperref} - -\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} - -<>= -options( width= 50) -library( "Rcpp" ) -prettyVersion <- packageDescription("Rcpp")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -@ - -\author{Romain Fran\c{c}ois \and Dirk Eddelbuettel} -\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}}% - -\begin{document} -\maketitle -\thispagestyle{empty} - -% without the ~, latex does not want to newline -% a newline between paragraph and code disconnects them and can orphan heading - -\paragraph{Important Notes}~ - \newline -<>= -// If you experience compiler errors, please check that you have an appropriate version of g++. See `Rcpp-FAQ' for more information. - -// Many of the examples here imply the following: -using namespace Rcpp; -// The inline package adds this for you. Alternately, use e.g.: -Rcpp::NumericVector xx(10); -@ - -\paragraph{Create simple vectors}~ - \newline -<>= -SEXP x; std::vector y(10); - -// from SEXP -NumericVector xx(x); - -// of a given size (filled with 0) -NumericVector xx(10); -// ... with a default for all values -NumericVector xx(10, 2.0); - -// range constructor -NumericVector xx( y.begin(), y.end() ); - -// using create -NumericVector xx = NumericVector::create( - 1.0, 2.0, 3.0, 4.0 ); -NumericVector yy = NumericVector::create( - Named["foo"] = 1.0, - _["bar"] = 2.0 ); // short for Named -@ - -\paragraph{Extract and set single elements}~ - \newline -<>= -// extract single values -double x0 = xx[0]; -double x1 = xx(1); - -double y0 = yy["foo"]; -double y1 = yy["bar"]; - -// set single values -xx[0] = 2.1; -xx(1) = 4.2; - -yy["foo"] = 3.0; - -// grow the vector -yy["foobar"] = 10.0; -@ - -\paragraph{Using matrices}~ - \newline -<>= -// Initializing from SEXP, -// dimensions handled automatically -SEXP x; -NumericMatrix xx(x); - -// Matrix of 4 rows & 5 columns (filled with 0) -NumericMatrix xx(4, 5); - -// Fill with value -int xsize = xx.nrow() * xx.ncol(); -for (int i = 0; i < xsize; i++) { - xx[i] = 7; -} -// Same as above, using STL fill -std::fill(xx.begin(), xx.end(), 8); - -// Assign this value to single element -// (1st row, 2nd col) -xx(0,1) = 4; - -// Reference the second column -// Changes propagate to xx (same applies for Row) -NumericMatrix::Column zzcol = xx( _, 1); -zzcol = zzcol * 2; - -// Copy the second column into new object -NumericVector zz1 = xx( _, 1); -// Copy the submatrix (top left 3x3) into new object -NumericMatrix zz2 = xx( Range(0,2), Range(0,2)); -@ - -\paragraph{Inline}~ - \newline -<>= -## Note - this is R code. inline allows rapid testing. -require(inline) -testfun = cxxfunction( - signature(x="numeric", i="integer"), - body = ' - NumericVector xx(x); - int ii = as(i); - xx = xx * ii; - return( xx ); - ', plugin="Rcpp") -testfun(1:5, 3) -@ - -\paragraph{Interface with R}~ - \newline -<>= -## In R, create a package shell. For details, see the "Writing R Extensions" manual. - -Rcpp.package.skeleton("myPackage") - -## Add R code to pkg R/ directory. Call C++ function. Do type-checking in R. - -myfunR = function(Rx, Ry) { - ret = .Call("myCfun", Rx, Ry, - package="myPackage") - return(ret) -} - -// Add C++ code to pkg src/ directory. -using namespace Rcpp; -// Define function as extern with RcppExport -RcppExport SEXP myCfun( SEXP x, SEXP y) { - // If R/C++ types match, use pointer to x. Pointer is faster, but changes to xx propagate to R ( xx -> x == Rx). - NumericVector xx(x); - // clone is slower and uses extra memory. Safe, R-like. - NumericVector yy(clone(y)); - xx[0] = yy[0] = -1.5; - int zz = xx[0]; - // use wrap() to return non-SEXP objects, e.g: - // return(wrap(zz)); - // Build and return a list - List ret; ret["x"] = xx; ret["y"] = yy; - return(ret); -} - -## From shell, above package directory -R CMD check myPackage ## Optional -R CMD INSTALL myPackage - -## In R: -require(myPackage) -aa = 1.5; bb = 1.5; cc = myfunR(aa, bb) -aa == bb ## FALSE, C++ modifies aa -aa = 1:2; bb = 1:2; cc = myfunR(aa, bb) -identical(aa, bb) -## TRUE, R/C++ types don't match -@ - -\paragraph{STL interface}~ - \newline -<>= -// sum a vector from beginning to end -double s = std::accumulate(x.begin(), - x.end(), 0.0); -// prod of elements from beginning to end -int p = std::accumulate(vec.begin(), - vec.end(), 1, std::multiplies()); -// inner_product to compute sum of squares -double s2 = std::inner_product(res.begin(), - res.end(), res.begin(), 0.0); -@ - -\paragraph{Function}~ - \newline -<>= -Function rnorm("rnorm"); -rnorm(100, _["mean"] = 10.2, _["sd"] = 3.2 ); -@ - -\paragraph{Environment}~ - \newline -<>= -Environment stats("package:stats"); -Environment env( 2 ); // by position - -// special environments -Environment::Rcpp_namespace(); -Environment::base_env(); -Environment::base_namespace(); -Environment::global_env(); -Environment::empty_env(); - -Function rnorm = stats["rnorm"]; -glob["x"] = "foo"; -glob["y"] = 3; -std::string x = glob["x"]; - -glob.assign( "foo" , 3 ); -int foo = glob.get( "foo" ); -int foo = glob.find( "foo" ); -CharacterVector names = glob.ls() -bool b = glob.exists( "foo" ); -glob.remove( "foo" ); - -glob.lockBinding("foo"); -glob.unlockBinding("foo"); -bool b = glob.bindingIsLocked("foo"); -bool b = glob.bindingIsActive("foo"); - -Environment e = stats.parent(); -Environment e = glob.new_child(); -@ - -\paragraph{Modules}~ - \newline -<>= -// Warning -- At present, module-based objects do not persist across quit(save="yes")/reload cycles. To be safe, save results to R objects and remove module objects before exiting R. - -// To create a module-containing package from R, use: -Rcpp.package.skeleton("mypackage",module=TRUE) -// You will need to edit the RcppModules: line of the DESCRIPTION file to match your module name (in this example, from yada to mod_bar). - -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, - "Docstring for x" ) - .method( "stats", &Bar::stats, - "Docstring for stats") -;} - -## The following is R code. -require(mypackage); show(Bar) -b <- new(Bar, 10); b$x <- 10 -b_persist <- list(stats=b$stats(), x=b$x) -rm(b) -@ - -\newpage - -\paragraph{Rcpp sugar}~ - \newline -<>= -NumericVector x = NumericVector::create( - -2.0, -1.0, 0.0, 1.0, 2.0 ); -IntegerVector y = IntegerVector::create( - -2, -1, 0, 1, 2 ); - -NumericVector xx = abs( x ); -IntegerVector yy = abs( y ); - -bool b = all( x < 3.0 ).is_true() ; -bool b = any( y > 2 ).is_true(); - -NumericVector xx = ceil( x ); -NumericVector xx = ceiling( x ); -NumericVector yy = floor( y ); -NumericVector yy = floor( y ); - -NumericVector xx = exp( x ); -NumericVector yy = exp( y ); - -NumericVector xx = head( x, 2 ); -IntegerVector yy = head( y, 2 ); - -IntegerVector xx = seq_len( 10 ); -IntegerVector yy = seq_along( y ); - -NumericVector xx = rep( x, 3 ); -NumericVector xx = rep_len( x, 10 ); -NumericVector xx = rep_each( x, 3 ); - -IntegerVector yy = rev( y ); -@ - - - -\paragraph{Random functions}~ - \newline -<>= -// Set seed -RNGScope scope; - -// For details see Section 6.7.1--Distribution functions of the `Writing R Extensions' manual. In some cases (e.g. rnorm), distribution-specific arguments can be omitted; when in doubt, specify all dist-specific arguments. The use of doubles rather than integers for dist-specific arguments is recommended. Unless explicitly specified, log=FALSE. - -// Equivalent to R calls -NumericVector xx = runif(20); -NumericVector xx1 = rnorm(20); -NumericVector xx1 = rnorm(20, 0); -NumericVector xx1 = rnorm(20, 0, 1); - -// Example vector of quantiles -NumericVector quants(5); -for (int i = 0; i < 5; i++) { - quants[i] = (i-2); -} - -// in R, dnorm(-2:2) -NumericVector yy = dnorm(quants) ; -NumericVector yy = dnorm(quants, 0.0, 1.0) ; - -// in R, dnorm(-2:2, mean=2, log=TRUE) -NumericVector yy = dnorm(quants, 2.0, true) ; - -// Note - cannot specify sd without mean -// in R, dnorm(-2:2, mean=0, sd=2, log=TRUE) -NumericVector yy = dnorm(quants, 0.0, 2.0, true) ; - -// To get original R api, use Rf_* -double zz = Rf_rnorm(0, 2); -@ - - - -\end{document} Copied: pkg/Rcpp/vignettes/Rcpp-package.Rnw (from rev 4448, pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw) =================================================================== --- pkg/Rcpp/vignettes/Rcpp-package.Rnw (rev 0) +++ pkg/Rcpp/vignettes/Rcpp-package.Rnw 2013-08-31 18:54:32 UTC (rev 4456) @@ -0,0 +1,389 @@ +\documentclass[10pt]{article} +%\VignetteIndexEntry{Rcpp-package} +\usepackage[USletter]{vmargin} +\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} +\usepackage{color,alltt} +\usepackage[authoryear,round,longnamesfirst]{natbib} + +\usepackage[colorlinks]{hyperref} +\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty +\hypersetup{ + colorlinks,% + citecolor=link,% + filecolor=link,% + linkcolor=link,% + urlcolor=link +} + +\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") +@ + +\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} +\title{Writing a package that uses \pkg{Rcpp} } +\date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} + +<>= +require( Rcpp ) +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 + +\abstract{ + \noindent This document provides a short overview of how to use + \pkg{Rcpp}~\citep{CRAN:Rcpp,JSS:Rcpp} when writing an \proglang{R} package. It + shows how usage of the function \Sexpr{link("Rcpp.package.skeleton")} + which creates a complete and self-sufficient example package using + \pkg{Rcpp}. All components of the directory tree created by + \Sexpr{link("Rcpp.package.skeleton")} are discussed in detail. This + document thereby complements the \textsl{Writing R Extensions} + manual~\citep{R:Extensions} which is the authoritative source on how to extend + \proglang{R} in general. +} + +\section{Introduction} + +\pkg{Rcpp}~\citep{CRAN:Rcpp,JSS:Rcpp} is an extension package for \proglang{R} which +offers an easy-to-use yet featureful interface between \proglang{C++} and +\proglang{R}. However, it is somewhat different from a traditional +\proglang{R} package because its key component is a \proglang{C++} library. A +client package that wants to make use of the \pkg{Rcpp} features must link +against the library provided by \pkg{Rcpp}. + +It should be noted that \proglang{R} has only limited support for +\proglang{C(++)}-level dependencies between packages~\citep{R:Extensions}. The +\texttt{LinkingTo} declaration in the package \texttt{DESCRIPTION} file +allows the client package to retrieve the headers of the target package (here +\pkg{Rcpp}), but support for linking against a library is not provided by +\proglang{R} and has to be added manually. + +This document follows the steps of the \Sexpr{link("Rcpp.package.skeleton")} +function to illustrate a recommended way of using \pkg{Rcpp} from a client +package. We illustrate this using a simple \proglang{C++} function +which will be called by an \proglang{R} function. + +We strongly encourage the reader to become familiar with the material in the +\textsl{Writing R Extensions} manual~\citep{R:Extensions}, as well as with other +documents on \proglang{R} package creation such as \cite{Leisch:2008:Tutorial}. Given +a basic understanding of how to create \proglang{R} package, the present +document aims to provide the additional information on how to use \pkg{Rcpp} +in such add-on packages. + +\section{Using \texttt{Rcpp.package.skeleton}} + +\subsection{Overview} + +\pkg{Rcpp} provides a function \Sexpr{link("Rcpp.package.skeleton")}, modeled +after the base \proglang{R} function \Sexpr{link("package.skeleton")}, which +facilitates creation of a skeleton package using \pkg{Rcpp}. + +\Sexpr{link("Rcpp.package.skeleton")} has a number of arguments documented on +its help page (and similar to those of \Sexpr{link("package.skeleton")}). The +main argument is the first one which provides the name of the package one +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" ) +% writeLines( system( "tree" , intern = TRUE ) ) +% @ +\begin{Hchunk} +\begin{Hinput} +\ttfamily\noindent +\hlprompt{\usebox{\hlboxgreaterthan}{\ }}\hlfunctioncall{Rcpp.package.skeleton}\hlkeyword{(}{\ }\hlstring{"mypackage"}{\ }\hlkeyword{)}\mbox{} +\normalfont + +\end{Hinput} + +\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} + +\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} +\end{Hchunk} + +Using \Sexpr{link("Rcpp.package.skeleton")} is by far the simplest approach +as it fulfills two roles. It creates the complete set of files needed for a +package, and it also includes the different components needed for using +\pkg{Rcpp} that we discuss in the following sections. + +\subsection{\proglang{R} code} + [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4456 From noreply at r-forge.r-project.org Sat Aug 31 21:07:28 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:07:28 +0200 (CEST) Subject: [Rcpp-commits] r4457 - in pkg/Rcpp: inst/doc/Rcpp-FAQ inst/doc/Rcpp-modules vignettes Message-ID: <20130831190728.3191B185DB9@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:07:27 +0200 (Sat, 31 Aug 2013) New Revision: 4457 Added: pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw pkg/Rcpp/vignettes/Rcpp-modules.Rnw Removed: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw Modified: pkg/Rcpp/vignettes/Rcpp-package.Rnw Log: Rcpp-FAQ and Rcpp-modules vignettes moved to vignettes/ Deleted: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw 2013-08-31 18:54:32 UTC (rev 4456) +++ pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw 2013-08-31 19:07:27 UTC (rev 4457) @@ -1,761 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-FAQ} -\usepackage[USletter]{vmargin} -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} - -\usepackage{color,alltt} -\usepackage[authoryear,round,longnamesfirst]{natbib} -\usepackage[colorlinks]{hyperref} -\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -\newcommand{\proglang}[1]{\textsf{#1}} -\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} -\newcommand{\code}[1]{\texttt{#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") -@ - -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{Frequently Asked Questions about \pkg{Rcpp}} -\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 ) -} -require(inline) -@ - -\newcommand{\faq}[1]{FAQ~\ref{#1}} - -\begin{document} -\maketitle - -\abstract{ - \noindent This document attempts to answer the most Frequently Asked - Questions (FAQ) regarding the \pkg{Rcpp} \citep{CRAN:Rcpp,JSS:Rcpp} package. -} - -\section{Getting started} - -\subsection{How do I get started ?} - -If you have \pkg{Rcpp} installed, please execute the following command in \proglang{R} - -<>= -vignette( "Rcpp-introduction" ) -@ - -\noindent to access the vignette which provides a detailed introduction. - -If you do not have \pkg{Rcpp} installed, the document should also be available -whereever you found this document, \textsl{i.e.,} on every mirror of CRAN site. - -\subsection{What do I need ?} - -Obviously, \proglang{R} must be installed. \pkg{Rcpp} provides a -\proglang{C++} API as an extension to the \proglang{R} system. As such, it -is bound by the choices made by \proglang{R} and is also influenced by how -\proglang{R} is configured. - -In general, the standard environment for building a CRAN package from source -(particularly when it contains \proglang{C} or \proglang{C++} code) is required. This -means one needs: -\begin{itemize} -\item a development environment with a suitable compiler (see - below), header files and required libraries; -\item \proglang{R} should be built in a way that permits linking and possibly - embedding of \proglang{R}; this is typically ensured by the - \texttt{--enable-shared-lib} option; -\item standard development tools such as \texttt{make} etc. -\end{itemize} - - -\subsection{What compiler can I use ?} - -On almost all platforms, the GNU Compiler Collection (or \texttt{gcc}, which -is also the name of its \proglang{C} language compiler) has to be used along -with the corresponding \texttt{g++} compiler for the \proglang{C++} language. -A minimal suitable version is a final 4.2.* release; earlier 4.2.* were -lacking some \proglang{C++} features (and even 4.2.1, still used on OS X, has -issues). - -Generally speaking, and as of early -2011, the default compilers on all the common platforms are suitable. - -Specific per-platform notes: -\begin{description} - \item[Windows] users need the \texttt{Rtools} package from the site maintained by - Duncan Murdoch which contains all the required tools in a single package; - complete instructions specific to Windows are in the `R Administration' - manual \citep[Appendix D]{R:Administration}. - \item[OS X] users, as noted in the `R Administration' manual \citep[Appendix - C.4]{R:Administration}, need to install the Apple Developer Tools - (\textsl{e.g.}, \texttt{Xcode}) (as well as \texttt{gfortran} if \proglang{R} or - Fortran-using packages are to be built); also see \faq{q:OSX} below. - \item[Linux] user need to install the standard developement packages. Some - distributions provide helper packages which pull in all the required - packages; the \texttt{r-base-dev} package on Debian and Ubuntu is an example. -\end{description} - -The \texttt{clang} and \texttt{clang++} compilers from the LLVM project can -also be used as they are inter-operable with \texttt{gcc} et al. The -\texttt{clang++} compiler is particularly interesting as it emits much more -comprehensible error messages than \texttt{g++}. - -The Intel \texttt{icc} family has also been used successfully as its output -files can also be combined with those from \texttt{gcc}. - -\subsection{What other packages are useful ?} - -Additional packages that we have found useful are - -\begin{description} -\item[\pkg{inline}] which is invaluable for direct compilation, linking and loading - of short code snippets; -\item[\pkg{RUnit}] is used for unit testing; the package is recommended and will be needed to re-run - some of our tests but it is not strictly required; -\item[\pkg{rbenchmark}] to run simple timing comparisons and benchmarks; it is also - recommended but not required. -\end{description} - - -\section{Compiling and Linking} - -\subsection{How do I use \pkg{Rcpp} in my package ?} -\label{make-package} - -\pkg{Rcpp} has been specifically designed to be used by other packages. -Making a package that uses \pkg{Rcpp} depends on the same mechanics that are -involved in making any \proglang{R} package that use compiled code --- so -reading the \textsl{Writing R Extensions} manual \citep{R:Extensions} is a required -first step. - -Further steps, specific to \pkg{Rcpp}, are described in a separate vignette. - -<>= -vignette( "Rcpp-package" ) -@ - -\subsection{How do I quickly prototype my code using inline?} -\label{using-inline} - -The \pkg{inline} package \citep{CRAN:inline} provides the functions -\Sexpr{link("cfunction")} and \Sexpr{link("cxxfunction")}. Below is a simple -function that uses \texttt{accumulate} from the (\proglang{C++}) Standard -Template Library to sum the elements of a numeric vector. - -<<>>= -fx <- cxxfunction(signature( x = "numeric" ), - 'NumericVector xx(x); - return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));', - plugin = "Rcpp") -res <- fx( seq( 1, 10, by = 0.5 ) ) -res -<>= -stopifnot( identical( res, sum( seq( 1, 10, by = 0.5 ) ) ) ) -@ - -\pkg{Rcpp} uses \pkg{inline} to power its entire unit test suite. Consult the -\texttt{unitTests} directory of \pkg{Rcpp} for several hundred further examples. - -<>= -list.files( system.file( "unitTests", package = "Rcpp" ), pattern = "^runit[.]" ) -@ - -One might want to use code that lives in a \proglang{C++} file instead of writing -the code in a character string in R. This is easily achieved by using -\Sexpr{link("readLines")} : - -<>= -fx <- cxxfunction( signature(), - paste( readLines( "myfile.cpp"), collapse = "\n" ), - plugin = "Rcpp" ) -@ - -The \texttt{verbose} argument of \Sexpr{link("cxxfunction")} is very -useful as it shows how \pkg{inline} runs the show. - -Update: Also see question \ref{using-attributes} below about 'Rcpp -Attributes' \citep{CRAN:Rcpp:Attributes}. - -\subsection{How do I convert my prototyped code to a package ?} -\label{from-inline-to-package} - -Since release 0.3.5 of \pkg{inline}, one can combine \faq{using-inline} and -\faq{make-package}. See \verb|help("package.skeleton-methods")| once -\pkg{inline} is loaded and use the skeleton-generating functionality to -transform a prototyped function into the minimal structure of a package. -After that you can proceed with working on the package in the spirit of -\faq{make-package}. - -\subsection{How do I quickly prototype my code in a package?} -\label{using-a-package} - -The simplest way may be to work directly with a package. Changes to both the -\proglang{R} and \proglang{C++} code can be compiled and tested from the -command line via: - -<>= -$ R CMD INSTALL mypkg && Rscript --default-packages=mypkg -e 'someFunctionToTickle(3.14)' -@ - -This first installs the packages, and then uses the command-line tool -\code{Rscript} (which ships with \code{R}) to load the package, and execute -the \proglang{R} expression following the \code{-e} switch. Such an -expression can contain multiple statements separated by semicolons. -\code{Rscript} is available on all three core operating systems. - -On Linux, one can also use \code{r} from the \code{littler} package by Horner -and Eddelbuettel which is an alternative front end to \proglang{R} designed -for both \verb|#!| (hashbang) scripting and command-line use. It has slightly -faster start-up times than \code{Rscript}; and both give a guaranteed clean -slate as a new session is created. - -The example then becomes - -<>= - $ R CMD INSTALL mypkg && r -l mypkg -e 'someFunctionToTickle(3.14)' -@ - -The \code{-l} option calls 'suppressMessages(library(mypkg))' before executing the -\proglang{R} expression. Several packages can be listed, separated by a comma. - -\subsection{But I want to compile my code with R CMD SHLIB !} -\label{using-r-cmd-shlib} - -The recommended way is to create a package and follow \faq{make-package}. The -alternate recommendation is to use \pkg{inline} and follow \faq{using-inline} -because it takes care of all the details. - -However, some people have shown that they prefer not to follow recommended -guidelines and compile their code using the traditional \texttt{R CMD SHLIB}. To -do so, we need to help \texttt{SHLIB} and let it know about the header files -that \pkg{Rcpp} provides and the \proglang{C++} library the code must link -against. - -On the Linux command-line, you can do the following:\newline -<>= -$ export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"` -$ export PKG_CXXFLAGS=`Rscript -e "Rcpp:::CxxFlags()"` -$ R CMD SHLIB myfile.cpp -@ -which first defines and exports two relevant environment variables which -\texttt{R CMD SHLIB} then relies on. On other operating systems, appropriate -settings may have to be used to define the environment variables. - -This approach corresponds to the very earliest ways of building programs and -can still be found in some deprecated documents (as \textit{e.g.} some of -Dirk's older 'Intro to HPC with R' tutorial slides). It is still not -recommended as there are tools and automation mechanisms that can do the work -for you. - -An alternative, which might work better on Windows is to use the -unexported function \texttt{Rcpp:::SHLIB} : - -<>= -$ Rscript -e "Rcpp:::SHLIB('myfile.cpp')" -@ - -\subsection{But R CMD SHLIB still does not work !} - -We have had reports in the past where build failures occurred when users had -non-standard code in their \verb|~/.Rprofile| or \texttt{Rprofile.site} (or -equivalent) files. - -If such code emits text on \texttt{stdout}, the frequent and implicit -invocation of \texttt{Rscript -e "..."} (as in \faq{using-r-cmd-shlib} -above) to retrieve settings directly from \pkg{Rcpp} will fail. - -You may need to uncomment such non-standard code, or protect it by wrapping -it inside \texttt{if (interactive())}, or possibly try to use \texttt{Rscript - --vanilla} instead of plain \texttt{Rscript}. - - -\subsection{What about \texttt{LinkingTo} ?} - -\proglang{R} has only limited support for cross-package linkage. - -We now employ the \texttt{LinkingTo} field of the \texttt{DESCRIPTION} file -of packages using \pkg{Rcpp}. But this only helps in having \proglang{R} -compute the location of the header files for us. - -The actual library location and argument still needs to be provided by the -user. How to do so has been shown above, and we recommned you use either -\faq{make-package} or \faq{using-inline} both which use the \pkg{Rcpp} -function \texttt{Rcpp:::LdFlags()}. - -If and when \texttt{LinkingTo} changes and lives up to its name, we will be -sure to adapt \pkg{Rcpp} as well. - - -\subsection{Does \pkg{Rcpp} work on windows ?} - -Yes of course. See the Windows binaries provided by CRAN. - -\subsection{Can I use \pkg{Rcpp} with Visual Studio ?} - -Not a chance. - -And that is not because we are meanies but because \proglang{R} and Visual -Studio simply do not get along. As \pkg{Rcpp} is all about extending -\proglang{R} with \proglang{C++} interfaces, we are bound by the available -toolchain. And \proglang{R} simply does not compile with Visual Studio. Go -complain to its vendor if you are still upset. - -\subsection{I am having problems building Rcpp on OS X, any help ?} -\label{q:OSX} - -OS X is a little more conservative with compiler versions, so it pays to get -the latest of whatever Apple releases which may already be a little behind -what is used on Linux or Windows. - -At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp} -(just like CRAN) supports all OS X releases greater or equal to 10.5. -However, building \pkg{Rcpp} from source (or building packages using -\pkg{Rcpp}) also requires a recent-enough version of Xcode. For the -\textsl{Leopard} release of OS X, the current version is 3.1.4 which can be -downloaded free of charge from the Apple Developer site. Users may have to -manually select \code{g++-4.2} via the symbolic link \code{/usr/bin/g++}. -The \textsl{Snow Leopard} release already comes with Xcode 3.2.x and work as -is. - -\subsection{Does \pkg{Rcpp} work on solaris/suncc ?} - -Yes, it generally does. But as we do not have access to such systems, some -issues persist on the CRAN test systems. - -\subsection{Does \pkg{Rcpp} work with Revolution R ?} - -We have not tested it yet. \pkg{Rcpp} might need a few tweaks to work -with the compilers used by Revolution R (if those differ from the defaults). - -\subsection{Is it related to CXXR ?} - -CXXR is an ambitious project that aims to totally refactor the \proglang{R} -interpreter in \proglang{C++}. There are a few similaritites with \pkg{Rcpp} -but the projects are unrelated. - -CXXR and \pkg{Rcpp} both want \proglang{R} to make more use of \proglang{C++} -but they do it in very different ways. - -\subsection{How do I quickly prototype my code using Attributes?} -\label{using-attributes} - -\pkg{Rcpp} version 0.10.0 and later offer a new feature 'Rcpp Attributes' -which is described in detail in its own vignette -\citep{CRAN:Rcpp:Attributes}. In short, it offers functions \code{evalCpp}, -\code{cppFunction} and \code{sourceCpp} which extend the functionality of the -\code{cxxfunction} function. - - - -\section{Examples} - -The following questions were asked on the \texttt{rcpp-devel} mailing list, -which is generally the best place to ask questions. - -\subsection{Can I use templates with \pkg{Rcpp} and \pkg{inline} ? } - -\begin{quote} - \emph{I'm curious whether one can provide a class definition inline in an R - script and then initialize an instance of the class and call a method on - the class, all inline in R.} -\end{quote} - -\noindent Most certainly, consider this simple example of a templated class -which squares its argument: - -<>= -inc <- 'template - class square : public std::unary_function { - public: - T operator()( T t) const { return t*t ;} - }; - ' - -src <- ' - double x = Rcpp::as(xs); - int i = Rcpp::as(is); - square sqdbl; - square sqint; - return Rcpp::DataFrame::create(Rcpp::Named("x", sqdbl(x)), - Rcpp::Named("i", sqint(i))); - ' -fun <- cxxfunction(signature(xs="numeric", is="integer"), - body=src, include=inc, plugin="Rcpp") - -fun(2.2, 3L) -@ - -Update: Also see question \ref{using-attributes} above about 'Rcpp -Attributes' \citep{CRAN:Rcpp:Attributes} and its \code{sourceCpp} function. - -\subsection{Can I do matrix algebra with \pkg{Rcpp} ?} - -\begin{quote} - \emph{\pkg{Rcpp} allows element-wise operations on vector and matrices through - operator overloading and STL interface, but what if I want to multiply a - matrix by a vector, etc ...} -\end{quote} - -\noindent Currently, \pkg{Rcpp} does not provide binary operators to allow operations -involving entire objects. Adding operators to \pkg{Rcpp} would be a major -project (if done right) involving advanced techniques such as expression -templates. We currently do not plan to go in this direction, but we would -welcome external help. Please send us a design document. - -However, we have developed the \pkg{RcppArmadillo} package \citep{CRAN:RcppArmadillo} that provides a -bridge between \pkg{Rcpp} and \pkg{Armadillo} \citep{Sanderson:2010:Armadillo}. \pkg{Armadillo} -supports binary operators on its types in a way that takes full advantage of -expression templates to remove temporaries and allow chaining of -operations. That is a mouthful of words meaning that it makes the code go -faster by using fiendishly clever ways available via the so-called template -meta programming, an advanced \proglang{C++} technique. -Also, the \pkg{RcppEigen} package provides an alternative using the -\href{Eigen}{http://eigen.tuxfamily.org} template library. - - -The following example is adapted from the examples available at the project -page of Armadillo. It calculates $ x' \times Y^{-1} \times z$ - -<>= -writeLines( ' - // copy the data to armadillo structures - arma::colvec x = Rcpp::as (x_); - arma::mat Y = Rcpp::as( Y_ ) ; - arma::colvec z = Rcpp::as( z_ ) ; - - // calculate the result - double result = arma::as_scalar( - arma::trans(x) * arma::inv(Y) * z - ); - - // return it to R - return Rcpp::wrap( result ); -', "myfile.cpp" ) -@ -<>= -external_highlight( "myfile.cpp", type = "LATEX", doc = FALSE ) -@ - -<<>>= -fx <- cxxfunction( - signature(x_ = "numeric", Y_ = "matrix", z_ = "numeric" ), - paste( readLines( "myfile.cpp" ), collapse = "\n" ), - plugin = "RcppArmadillo" ) -fx( 1:4, diag( 4 ), 1:4 ) -@ -<>= -unlink( "myfile.cpp" ) -@ - -The focus is on the code \verb|arma::trans(x) * arma::inv(Y) * z|, which -performs the same operation as the R code \verb|t(x) %*% solve(Y) %*% z|, -although Armadillo turns it into only one operation, which makes it quite fast. -Armadillo benchmarks against other \proglang{C++} matrix algebra libraries -are provided on \href{http://arma.sourceforge.net/speed.html}{the Armadillo website}. - -It should be noted that code below depends on the version \texttt{0.3.5} of -\pkg{inline} and the version \texttt{0.2.2} of \pkg{RcppArmadillo} - -\subsection{Can I use code from the Rmath header and library with \pkg{Rcpp} ?} - -\begin{quote} - \emph{Can I call functions defined in the Rmath header file and the - standalone math library for R--as for example the random number generators?} -\end{quote} - -\noindent Yes, of course. This math library exports a subset of R, but \pkg{Rcpp} has -access to much more. Here is another simple example. Note how we have to use -and instance of the \texttt{RNGScope} class to set and re-set the -random-number generator. This also illustrates Rcpp sugar as we are using a -vectorised call to \texttt{rnorm}. Moreover, because the RNG is reset, the -two calls result in the same random draws. If we wanted to control the draws, -we could explicitly set the seed after the \texttt{RNGScope} object has been -instantiated. - -<<>>= -fx <- cxxfunction(signature(), - 'RNGScope(); - return rnorm(5, 0, 100);', - plugin="Rcpp") -fx() -fx() -@ - -\subsection{Can I use NA and Inf with \pkg{Rcpp} ?} - -\begin{quote} - \emph{R knows about NA and Inf. How do I use them from C++?} -\end{quote} - -\noindent Yes, see the following example: - -<<>>= -src <- 'Rcpp::NumericVector v(4); - v[0] = R_NegInf; // -Inf - v[1] = NA_REAL; // NA - v[2] = R_PosInf; // Inf - v[3] = 42; // see the Hitchhiker Guide - return Rcpp::wrap(v);' -fun <- cxxfunction(signature(), src, plugin="Rcpp") -fun() -@ - - -\subsection{Can I easily multiply matrices ?} - -\begin{quote} - \emph{Can I multiply matrices easily?} -\end{quote} - -\noindent Yes, via the \pkg{RcppArmadillo} package which builds upon \pkg{Rcpp} and the -wonderful Armadillo library at \url{http://arma.sf.net}: - -<>= -txt <- 'arma::mat Am = Rcpp::as< arma::mat >(A); - arma::mat Bm = Rcpp::as< arma::mat >(B); - return Rcpp::wrap( Am * Bm );' -mmult <- cxxfunction(signature(A="numeric", B="numeric"), - body=txt, plugin="RcppArmadillo") -A <- matrix(1:9, 3, 3) -B <- matrix(9:1, 3, 3) -C <- mmult(A, B) -@ -% < < echo=FALSE,print=FALSE > > = -% A <- matrix(1:9, 3, 3) -% B <- matrix(9:1, 3, 3) -% A %*% B -% @ - -Armadillo supports a full range of common linear algebra operations. - -The \pkg{RcppEigen} package provides an alternative using the -\href{Eigen}{http://eigen.tuxfamily.org} template library. - -\subsection{How do I write a plugin for \pkg{inline} ?} - -\begin{quote} - \emph{How can I create my own plugin for use by the \pkg{inline} package?} -\end{quote} - -\noindent Here is an example which shows how to it using GSL libraries as an -example. This is merely for demonstration, it is also not perfectly general -as we do not detect locations first---but it serves as an example: - -<>= -## simple example of seeding RNG and drawing one random number -gslrng <- ' -int seed = Rcpp::as(par) ; -gsl_rng_env_setup(); -gsl_rng *r = gsl_rng_alloc (gsl_rng_default); -gsl_rng_set (r, (unsigned long) seed); -double v = gsl_rng_get (r); -gsl_rng_free(r); -return Rcpp::wrap(v);' - -plug <- Rcpp:::Rcpp.plugin.maker( - include.before = "#include ", - libs = paste("-L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp", - "-Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib", - "-L/usr/lib -lgsl -lgslcblas -lm")) -registerPlugin("gslDemo", plug ) -fun <- cxxfunction(signature(par="numeric"), gslrng, plugin="gslDemo") -fun(0) -@ -% - -Here the \pkg{Rcpp} function \code{Rcpp.plugin.maker} is used to create a -plugin 'plug' which is then registered, and subsequently used by \pkg{inline}. - - -\subsection{How can I pass one additional flag to the compiler?} - -\begin{quote} - \emph{How can I pass another flag to the \code{g++} compiler without writing a new plugin?} -\end{quote} - -The quickest way is to modify the return value from an existing plugin. Here -we use the default one from \pkg{Rcpp} itself in order to pass the new flag -\verb|-std=c++0x|. As it does not set the \verb|PKG_CXXFLAGS| variable, we -simply assign this. For other plugins, one may need to append to the existing -values instead. - -<>= -myplugin <- getPlugin("Rcpp") -myplugin$env$PKG_CXXFLAGS <- "-std=c++0x" -f <- cxxfunction(signature(), settings=myplugin, body=' -+ std::vector x = { 1.0, 2.0, 3.0 }; // fails without -std=c++0x -+ return Rcpp::wrap(x); -+ ') -f() -@ - -\subsection{How can I set matrix row and column names ?} - -\begin{quote} - \emph{Ok, I can create a matrix, but how do I set its row and columns names?} -\end{quote} - -Pretty much the same way as in \proglang{R} itself: We define a list with two -character vectors, one each for row and column names, and assign this to the -\code{dimnames} attribute: - -<>= -src <- ' - Rcpp::NumericMatrix x(2,2); - x.fill(42); // or more interesting values - Rcpp::List dimnms = // two vec. with static names - Rcpp::List::create(Rcpp::CharacterVector::create("cc", "dd"), - Rcpp::CharacterVector::create("ee", "ff")); - // and assign it - x.attr("dimnames") = dimnms; - return(x); -' -fun <- cxxfunction(signature(), body=src, plugin="Rcpp") -fun() -@ -% - -\subsection{Why can long long types not be cast correctly?} - -That is a good and open question. We rely on the basic \proglang{R} types, -notably \code{integer} and \code{numeric}. These can be cast to and from -\proglang{C++} types without problems. But there are corner cases. The -following example, contributed by a user, shows that we cannot reliably cast -\code{long} types (on a 64-bit machines). - -<>= -BigInts <- cxxfunction(signature(), - 'std::vector bigints; - bigints.push_back(12345678901234567LL); - bigints.push_back(12345678901234568LL); - Rprintf("Difference of %ld\\n", 12345678901234568LL - 12345678901234567LL); - return wrap(bigints);', plugin="Rcpp", includes="#include ") - -retval<-BigInts() - -# Unique 64-bit integers were cast to identical lower precision numerics -# behind my back with no warnings or errors whatsoever. Error. - -stopifnot(length(unique(retval)) == 2) -@ -% - -While the difference of one is evident at the \proglang{C++} level, it is no -longer present once cast to \proglang{R}. The 64-bit integer values get cast -to a floating point types with a 53-bit mantissa. We do not have a good -suggestion or fix for casting 64-bit integer values: 32-bit integer values -fit into \code{integer} types, up to 53 bit precision fits into -\code{numeric} and beyond that truly large integers may have to converted -(rather crudely) to text and re-parsed. Using a different representation as -for example from the \href{http://gmplib.org/}{GNU Multiple Precision Arithmetic - Library} may be an alternative. - -\section{Support} - -\subsection{Is the API documented ?} - -You bet. We use \proglang{doxygen} to generate html, latex and man page -documentation from the source. The html documentation is available for -\href{http://dirk.eddelbuettel.com/code/rcpp/html/index.html}{browsing}, as a -\href{http://dirk.eddelbuettel.com/code/rcpp/Rcpp_refman.pdf}{very large pdf file}, -and all three formats are also available a zip-archives: -\href{http://dirk.eddelbuettel.com/code/rcpp/rcpp-doc-html.zip}{html}, -\href{http://dirk.eddelbuettel.com/code/rcpp/rcpp-doc-latex.zip}{latex}, and -\href{http://dirk.eddelbuettel.com/code/rcpp/rcpp-doc-man.zip}{man}. - -\subsection{Does it really work ?} - -We take quality seriously and have developped an extensive unit test suite to -cover many possible uses of the \pkg{Rcpp} API. - -We are always on the look for more coverage in our testing. Please let us know -if something has not been tested enough. - - -\subsection{Where can I ask further questions ?} - -The -\href{https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel}{Rcpp-devel} -mailing list hosted at R-forge is by far the best place. You may also want -to look at the list archives to see if your question has been asked before. - -\subsection{Where can I read old questions and answers ?} - -The normal \href{https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel}{Rcpp-devel} -mailing list hosting at R-forge contains an archive, which can be -\href{http://lists.r-forge.r-project.org/mailman/swish.cgi?query=listname=rcpp-devel}{searched via swish}. - -Alternatively, one can also use -\href{http://thread.gmane.org/gmane.comp.lang.r.rcpp/}{Gmane on Rcpp-devel} as well as -\href{http://www.mail-archive.com/rcpp-devel at lists.r-forge.r-project.org/info.html}{Mail-Archive - on Rcpp-devel} both of which offer web-based interfaces, including -searching. - -\subsection{I like it. How can I help ?} -\label{helping} - -The current list of things to do is available in our \texttt{TODO} file. -\href{https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/TODO?view=markup&root=rcpp}. -If you are willing to donate time and have skills in C++, let us know. If you are -willing to donate money to sponsor improvements, let us know. - -You can also spread the word about \pkg{Rcpp}. There are many packages on CRAN -that use \proglang{C++}, yet are not using \pkg{Rcpp}. You could write a -review of \pkg{Rcpp} in \href{http://crantastic.org}{crantastic}, blog about -it or get the word out otherwise. - - -\subsection{I don't like it. How can I help ?} - -It is very generous of you to still want to help. Perhaps you can tell us -what it is that you dislike. We are very open to \emph{constructive} criticism. - -\subsection{Can I have commercial support for \pkg{Rcpp} ?} - -Sure you can. Just send us an email, and we will be happy to discuss the -request.. - -\subsection{I want to learn quickly. Do you provide training courses ?} - -Yes. Just send us an email. - -\bibliographystyle{plainnat} -\bibliography{Rcpp} - -\end{document} - Deleted: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2013-08-31 18:54:32 UTC (rev 4456) +++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2013-08-31 19:07:27 UTC (rev 4457) @@ -1,1262 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-modules} -\usepackage[USletter]{vmargin} -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} - -\usepackage{color, alltt} -\usepackage[authoryear,round,longnamesfirst]{natbib} -\usepackage[colorlinks]{hyperref} -\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -\newcommand{\code}[1]{\texttt{#1}} -\newcommand{\proglang}[1]{\textsf{#1}} -\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} - -<>= -require( inline ) -require( Rcpp ) -prettyVersion <- packageDescription("Rcpp")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -@ - -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\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 - -\abstract{ - \noindent - This note discusses \textsl{Rcpp modules}. \textsl{Rcpp modules} allow programmers to - expose \proglang{C++} functions and classes to \proglang{R} with relative - ease. \textsl{Rcpp modules} are inspired from the \pkg{Boost.Python} - \proglang{C++} library \citep{Abrahams+Grosse-Kunstleve:2003:Boost.Python} - which provides similar features for \proglang{Python}. -} - -\section{Motivation} - -Exposing \proglang{C++} functionality to \proglang{R} is greatly facilitated -by the \pkg{Rcpp} package and its underlying \proglang{C++} library -\citep{CRAN:Rcpp,JSS:Rcpp}. \pkg{Rcpp} smoothes many of the rough edges in -\proglang{R} and \proglang{C++} integration by replacing the traditional -\proglang{R} Application Programming Interface (API) described in -`\textsl{Writing R Extensions}' \citep{R:Extensions} with a consistent set of \proglang{C++} -classes. The `\textsl{Rcpp-introduction}' vignette \citep{CRAN:Rcpp,JSS:Rcpp} describes the API and -provides an introduction to using \pkg{Rcpp}. - -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 -conform to the \proglang{R} API) using classes of the \pkg{Rcpp} API as -described in the next section. - -\subsection{Exposing functions using \pkg{Rcpp}} - -Exposing existing \proglang{C++} functions to \proglang{R} through \pkg{Rcpp} -usually involves several steps. One approach is to write an additional wrapper [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4457 From noreply at r-forge.r-project.org Sat Aug 31 21:11:16 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:11:16 +0200 (CEST) Subject: [Rcpp-commits] r4458 - in pkg/Rcpp: inst/doc inst/doc/Rcpp-attributes inst/doc/Rcpp-extending vignettes Message-ID: <20130831191116.330BF185DB9@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:11:15 +0200 (Sat, 31 Aug 2013) New Revision: 4458 Added: pkg/Rcpp/vignettes/Rcpp-attributes.Rnw pkg/Rcpp/vignettes/Rcpp-extending.Rnw pkg/Rcpp/vignettes/Rcpp-introduction.Rnw Removed: pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw pkg/Rcpp/inst/doc/Rcpp-introduction.Rnw Log: Rcpp-attributes, Rcpp-extending and Rcpp-introduction vignettes moved to vignettes/ Deleted: pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw 2013-08-31 19:07:27 UTC (rev 4457) +++ pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw 2013-08-31 19:11:15 UTC (rev 4458) @@ -1,911 +0,0 @@ -\documentclass[11pt]{article} -%\VignetteIndexEntry{Rcpp-attributes} -\usepackage[USletter]{vmargin} -\setmargrb{1.25in}{1.25in}{1.25in}{1.25in} - - -\usepackage{textcomp} -\usepackage{color, alltt} -\usepackage[authoryear,round,longnamesfirst]{natbib} -\usepackage[colorlinks]{hyperref} -\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty -\hypersetup{ - colorlinks,% - citecolor=link,% - filecolor=link,% - linkcolor=link,% - urlcolor=link -} - -\newcommand{\proglang}[1]{\textsf{#1}} -\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} -\newcommand{\code}[1]{\texttt{#1}} - -<>= -prettyVersion <- packageDescription("Rcpp")$Version -prettyDate <- format(Sys.Date(), "%B %e, %Y") -@ - -\author{J.J. Allaire \and Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{\pkg{Rcpp} Attributes} -\date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} - - -%% highlights macros -%% Style definition file generated by highlight 2.7, http://www.andre-simon.de/ -% Highlighting theme definition: -\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlnum}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlesc}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -%\newcommand{\hlstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -\newcommand{\hlstr}[1]{\textcolor[rgb]{0.90,0.15,0.15}{#1}} -%green: \newcommand{\hlstr}[1]{\textcolor[rgb]{0.13,0.67,0.13}{#1}} % 0.74 -> % 0.90; 0.55 -> 0.25 -\newcommand{\hldstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -\newcommand{\hlslc}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} -\newcommand{\hlcom}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} -\newcommand{\hldir}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlsym}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlline}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}} -\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.61,0.13,0.93}{\bf{#1}}} -\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.13,0.54,0.13}{#1}} -\newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,1}{#1}} -\newcommand{\hlkwd}[1]{\textcolor[rgb]{0,0,0}{#1}} -\definecolor{bgcolor}{rgb}{1,1,1} -\newcommand{\hlppc}[1]{\textcolor[rgb]{0,0.51,0}{#1}} - -\usepackage{framed} -\definecolor{shadecolor}{RGB}{242, 242, 242} -\makeatletter -\newenvironment{kframe}{% - \def\at at end@of at kframe{}% - \ifinner\ifhmode% - \def\at at end@of at kframe{\end{minipage}}% - \begin{minipage}{\columnwidth}% - \fi\fi% - \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep - \colorbox{shadecolor}{##1}\hskip-\fboxsep - % There is no \\@totalrightmargin, so: - \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% - \MakeFramed {\advance\hsize-\width - \@totalleftmargin\z@ \linewidth\hsize - \@setminipage}}% - {\par\unskip\endMakeFramed% - \at at end@of at kframe} -\makeatother - - -\begin{document} -\maketitle - -\abstract{ - \noindent - \textsl{Rcpp attributes} provide a high-level syntax for declaring \proglang{C++} - functions as callable from \proglang{R} and automatically generating the code - required to invoke them. Attributes are intended to facilitate both interactive use - of \proglang{C++} within \proglang{R} sessions as well as to support \proglang{R} - package development. The implementation of attributes is based on previous - work in the \pkg{inline} package \citep{CRAN:inline}. -} - - -\section{Introduction} - -Attributes are a new feature of \pkg{Rcpp} version 0.10.0 \citep{CRAN:Rcpp,JSS:Rcpp} -that provide infrastructure for seamless language bindings between \proglang{R} and -\proglang{C++}. The motivation for attributes is several-fold: - -\begin{enumerate} -\item - Reduce the learning curve associated with using C++ and R together -\item - Eliminate boilerplate conversion and marshaling code wherever - possible -\item - Seamless use of C++ within interactive R sessions -\item - Unified syntax for interactive work and package development -\end{enumerate} - -The core concept is to add annotations to \proglang{C++} source -files that provide the context required to automatically generate \proglang{R} -bindings to \proglang{C++} functions. Attributes and their supporting -functions include: - -\begin{itemize} -\item - \texttt{Rcpp::export} attribute to export a \proglang{C++} function - to \proglang{R} -\item - \texttt{sourceCpp} function to source exported functions from a file -\item - \texttt{cppFunction} and \texttt{evalCpp} functions for inline - declarations and execution -\item - \texttt{Rcpp::depends} attribute for specifying additional build - dependencies for \texttt{sourceCpp} -\end{itemize} - -Attributes can also be used for package development via the -\texttt{compileAttributes} function, which automatically generates -\texttt{extern "C"} and \texttt{.Call} wrappers for \proglang{C++} -functions within pacakges. - -\section{Using Attributes} - -Attributes are annotations that are added to C++ source files to provide -additional information to the compiler. \pkg{Rcpp} supports attributes -to indicate that C++ functions should be made available as R functions, -as well as to optionally specify additional build dependencies for source files. - -\proglang{C++11} specifies a standard syntax for attributes -\citep{Maurer+Wong:2008:AttributesInC++}. Since this standard isn't yet -fully supported across all compilers, \pkg{Rcpp} attributes are included in -source files using specially formatted comments. - -\subsection{Exporting C++ Functions} - -The \texttt{sourceCpp} function parses a \proglang{C++} file and looks for -functions marked with the \texttt{Rcpp::export} attribute. A shared -library is then built and its exported functions are made available as R -functions in the specified environment. For example, this source file -contains an implementation of convolve (note the \texttt{Rcpp::export} -attribute in the comment above the function): - -% \begin{verbatim} -% #include -% using namespace Rcpp; - -% // [[Rcpp::export]] -% NumericVector convolveCpp(NumericVector a, NumericVector b) { - -% int na = a.size(), nb = b.size(); -% int nab = na + nb - 1; -% NumericVector xab(nab); - -% for (int i = 0; i < na; i++) -% for (int j = 0; j < nb; j++) -% xab[i + j] += a[i] * b[j]; - -% return xab; -% } -% \end{verbatim} - -%% can use "figure" or "quote" or ... -%% converted via 'highlight --enclose-pre --no-doc --out-format=latex --syntax=C++' -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlppc{\#include\ $<$Rcpp.h$>$}\hspace*{\fill}\\ -\hlstd{}\hlkwa{using\ namespace\ }\hlstd{Rcpp}\hlopt{;}\hspace*{\fill}\\ -\hlstd{}\hspace*{\fill}\\ -\hlslc{//\ {[}{[}Rcpp::export{]}{]}}\hspace*{\fill}\\ -\hlstd{NumericVector\ }\hlkwd{convolveCpp}\hlstd{}\hlopt{(}\hlstd{NumericVector\ a}\hlopt{,\ }\hlstd{NumericVector\ b}\hlopt{)\ \{}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwb{int\ }\hlstd{na\ }\hlopt{=\ }\hlstd{a}\hlopt{.}\hlstd{}\hlkwd{size}\hlstd{}\hlopt{(),\ }\hlstd{nb\ }\hlopt{=\ }\hlstd{b}\hlopt{.}\hlstd{}\hlkwd{size}\hlstd{}\hlopt{();}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{}\hlkwb{int\ }\hlstd{nab\ }\hlopt{=\ }\hlstd{na\ }\hlopt{+\ }\hlstd{nb\ }\hlopt{{-}\ }\hlstd{}\hlnum{1}\hlstd{}\hlopt{;}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{NumericVector\ }\hlkwd{xab}\hlstd{}\hlopt{(}\hlstd{nab}\hlopt{);}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwa{for\ }\hlstd{}\hlopt{(}\hlstd{}\hlkwb{int\ }\hlstd{i\ }\hlopt{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlopt{;\ }\hlstd{i\ }\hlopt{$<$\ }\hlstd{na}\hlopt{;\ }\hlstd{i}\hlopt{++)}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwa{for\ }\hlstd{}\hlopt{(}\hlstd{}\hlkwb{int\ }\hlstd{j\ }\hlopt{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlopt{;\ }\hlstd{j\ }\hlopt{$<$\ }\hlstd{nb}\hlopt{;\ }\hlstd{j}\hlopt{++)}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{xab}\hlopt{{[}}\hlstd{i\ }\hlopt{+\ }\hlstd{j}\hlopt{{]}\ +=\ }\hlstd{a}\hlopt{{[}}\hlstd{i}\hlopt{{]}\ {*}\ }\hlstd{b}\hlopt{{[}}\hlstd{j}\hlopt{{]};}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwa{return\ }\hlstd{xab}\hlopt{;}\hspace*{\fill}\\ -\hlstd{}\hlopt{\}}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -The addition of the export attribute allows us to do this from the \proglang{R} -prompt: - -% \begin{verbatim} -% > sourceCpp("convolve.cpp") -% > convolveCpp(x, y) -% \end{verbatim} - -%% converted via 'highlight --enclose-pre --no-doc --out-format=latex --syntax=R' -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{>\ }\hlstd{}\hlkwd{sourceCpp}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"convolve.cpp"}\hlstd{}\hlopt{)}\hspace*{\fill}\\ -\hlstd{}\hlopt{>\ }\hlstd{}\hlkwd{convolveCpp}\hlstd{}\hlopt{(}\hlstd{x}\hlopt{,\ }\hlstd{y}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - - -We can now write \proglang{C++} functions using built-in \proglang{C++} types -and \pkg{Rcpp} wrapper types and then source them just as we would an -\proglang{R} script. - -The \texttt{sourceCpp} function performs caching based on the last -modified date of the source file so as long as the source file does not -change the compilation will occur only once per R session. - -\subsection{Specifying Argument Defaults} - -If default argument values are provided in the C++ function definition -then these defaults are also used for the exported R function. For example, -the following C++ function: - -% \begin{verbatim} -% DataFrame readData( -% CharacterVector file, -% CharacterVector colNames = CharacterVector::create(), -% std::string commentChar = "#", -% bool header = true) -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{DataFrame\ }\hlkwd{readData}\hlstd{}\hlopt{(}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{CharacterVector\ file}\hlopt{,\ }\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{CharacterVector\ cols\ }\hlopt{=\ }\hlstd{CharacterVector}\hlopt{::}\hlstd{}\hlkwd{create}\hlstd{}\hlopt{(),}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{std}\hlopt{::}\hlstd{string\ comment\ }\hlopt{=\ }\hlstd{}\hlstr{"\#"}\hlstd{}\hlopt{,}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{}\hlkwb{bool\ }\hlstd{header\ }\hlopt{=\ }\hlstd{}\hlkwa{true}\hlstd{}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Will be exported to R as: - -% \begin{verbatim} -% function (file, colNames = character(), commentChar = "#", header = TRUE) -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlkwa{function\ }\hlstd{}\hlopt{(}\hlstd{file}\hlopt{,\ }\hlstd{cols\ }\hlopt{=\ }\hlstd{}\hlkwd{character}\hlstd{}\hlopt{(),\ }\hlstd{comment\ }\hlopt{=\ }\hlstd{}\hlstr{"\#"}\hlstd{}\hlopt{,\ }\hlstd{header\ }\hlopt{=\ }\hlstd{}\hlkwb{TRUE}\hlstd{}\hlopt{)\ }\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Note that C++ rules for default arguments still apply: they must occur -consecutively at the end of the function signature and (unlike R) can't rely -on the values of other arguments. - -Not all \proglang{C++} defualt argument values can be parsed into their -\proglang{R} equivalents, however the most common cases are supported, including: - -\begin{itemize} -\item - String literals delimited by quotes (e.g. \texttt{"foo"}) -\item - Decimal numeric values (e.g. \texttt{10} or \texttt{4.5}) -\item - Pre-defined constants including \texttt{true}, \texttt{false}, - \texttt{R\_NilValue}, \texttt{NA\_STRING}, \texttt{NA\_INTEGER}, - \texttt{NA\_REAL}, and \texttt{NA\_LOGICAL}. -\item - Selected vector types (\texttt{CharacterVector}, \texttt{IntegerVector}, - and \texttt{NumericVector}) instantiated using the \texttt{::create} - static member function. -\item - \texttt{Matrix} types instantiated using the \texttt{rows}, - \texttt{cols} constructor. -\end{itemize} - - -\pagebreak - -\subsection{Signaling Errors} - -Within \proglang{R} code the \texttt{stop} function is typically used to signal -errors. Within \proglang{R} extensions written in \proglang{C} the \texttt{Rf\_error} function is typically used. However, within \proglang{C++} code you cannot -safely use \texttt{Rf\_error} because it results in a \texttt{longjmp} over -any \proglang{C++} destructors on the stack. - -The correct way to signal errors within \proglang{C++} functions is to throw an \\\texttt{Rcpp::exception}. For example: - -% \begin{verbatim} -% if (unexpectedCondition) -% throw Rcpp::exception("Unexpected condition occurred"); -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlkwa{if\ }\hlstd{}\hlopt{(}\hlstd{unexpectedCondition}\hlopt{)}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{}\hlkwa{throw\ }\hlstd{Rcpp}\hlopt{::}\hlstd{}\hlkwd{exception}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"Unexpected\ condition\ occurred"}\hlstd{}\hlopt{);}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -There is also an \texttt{Rcpp::stop} function that is shorthand for throwing -an \\\texttt{Rcpp::exception}. For example: - -% \begin{verbatim} -% if (unexpectedCondition) -% Rcpp::stop("Unexpected condition occurred"); -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlkwa{if\ }\hlstd{}\hlopt{(}\hlstd{unexpectedCondition}\hlopt{)}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{Rcpp}\hlopt{::}\hlstd{}\hlkwd{stop}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"Unexpected\ condition\ occurred"}\hlstd{}\hlopt{);}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -In both cases the \proglang{C++} exception will be caught by \pkg{Rcpp} -prior to returning control to \proglang{R} and converted into the correct -signal to \proglang{R} that execution should stop with the specified message. - -\subsection{Embedding R Code} - -Typically \proglang{C++} and \proglang{R} code are kept in their own source -files. However, it's often convenient to bundle code from both languages into -a common source file that can be executed using single call to \texttt{sourceCpp}. - -To embed chunks of \proglang{R} code within a \proglang{C++} -source file you include the \proglang{R} code within a block comment that -has the prefix of \texttt{/*** R}. For example: - -% \begin{verbatim} -% /*** R -% -% # Call the fibonacci function defined in C++ -% fibonacci(10) -% -% */ -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{/{*}{*}{*}\ }\hlstd{R}\hspace*{\fill}\\ -\hspace*{\fill}\\ -\hlslc{\#\ Call\ the\ fibonacci\ function\ defined\ in\ C++}\hspace*{\fill}\\ -\hlstd{}\hlkwd{fibonacci}\hlstd{}\hlopt{(}\hlstd{}\hlnum{10}\hlstd{}\hlopt{)}\hspace*{\fill}\\ -\hlstd{}\hspace*{\fill}\\ -\hlopt{{*}/}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Multiple \proglang{R} code chunks can be included in a \proglang{C++} file. The -\texttt{sourceCpp} function will first compile the \proglang{C++} code into a -shared library and then source the embedded \proglang{R} code. - -\pagebreak - -\subsection{Modifying Function Names} - -You can change the name of an exported function as it appears to \proglang{R} by -adding a name parameter to \texttt{Rcpp::export}. For example: - -% \begin{verbatim} -% // [[Rcpp::export(".convolveCpp")]] -% NumericVector convolveCpp(NumericVector a, NumericVector b) -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlslc{//\ {[}{[}Rcpp::export(".convolveCpp"){]}{]}}\hspace*{\fill}\\ -\hlstd{NumericVector\ }\hlkwd{convolveCpp}\hlstd{}\hlopt{(}\hlstd{NumericVector\ a}\hlopt{,\ }\hlstd{NumericVector\ b}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Note that in this case since the specified name is prefaced by a \code{.} the exported R -function will be hidden. - -\subsection{Function Requirements} - -Functions marked with the \texttt{Rcpp::export} attribute must meet several -requirements to be correctly handled: - -\begin{itemize} -\item - Be defined in the global namespace (i.e. not within a C++ namespace declaration) -\item - Have a return type that is either void or compatible with \texttt{Rcpp::wrap} - and parameter types that are compatible with \texttt{Rcpp::as} (see sections - 3.1 and 3.2 of the `\textsl{Rcpp-introduction}' vignette for more details). - \item - Use fully qualified type names for the return value and all parameters. - Rcpp types may however appear without a namespace qualifier (i.e. - \texttt{DataFrame} is okay as a type name but \texttt{std::string} must be - specified fully). -\end{itemize} - -\subsection{Random Number Generation} - -\proglang{R} functions implemented in \proglang{C} or \proglang{C++} need -to be careful to surround use of internal random number geneneration routines -(e.g. \texttt{unif\_rand}) with calls to \texttt{GetRNGstate} and -\texttt{PutRNGstate}. - -Within \pkg{Rcpp}, this is typically done using the \texttt{RNGScope} class. -However, this is not necessary for \proglang{C++} functions exported using -attributes because an \texttt{RNGScope} is established for them automatically. -Note that \pkg{Rcpp} implements \texttt{RNGScope} using a counter, so it's -still safe to execute code that may establish it's own \texttt{RNGScope} (such -as the \pkg{Rcpp} sugar functions that deal with random number generation). - -\pagebreak - -\subsection{Importing Dependencies} - -It's also possible to use the \texttt{Rcpp::depends} attribute to declare -dependencies on other packages. For example: - -% \begin{verbatim} -% // [[Rcpp::depends(RcppArmadillo)]] - -% #include -% using namespace Rcpp - -% // [[Rcpp::export]] -% List fastLm(NumericVector yr, NumericMatrix Xr) { - -% int n = Xr.nrow(), k = Xr.ncol(); - -% arma::mat X(Xr.begin(), n, k, false); -% arma::colvec y(yr.begin(), yr.size(), false); - -% arma::colvec coef = arma::solve(X, y); -% arma::colvec resid = y - X*coef; - -% double sig2 = arma::as_scalar(arma::trans(resid)*resid/(n-k)); -% arma::colvec stderrest = arma::sqrt( -% sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) ); - -% return List::create(Named("coefficients") = coef, -% Named("stderr") = stderrest); -% } -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlslc{//\ {[}{[}Rcpp::depends(RcppArmadillo){]}{]}}\hspace*{\fill}\\ -\hlstd{}\hspace*{\fill}\\ -\hlppc{\#include\ $<$RcppArmadillo.h$>$}\hspace*{\fill}\\ -\hlstd{}\hlkwa{using\ namespace\ }\hlstd{Rcpp}\hspace*{\fill}\\ -\hspace*{\fill}\\ -\hlslc{//\ {[}{[}Rcpp::export{]}{]}}\hspace*{\fill}\\ -\hlstd{List\ }\hlkwd{fastLm}\hlstd{}\hlopt{(}\hlstd{NumericVector\ yr}\hlopt{,\ }\hlstd{NumericMatrix\ Xr}\hlopt{)\ \{}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwb{int\ }\hlstd{n\ }\hlopt{=\ }\hlstd{Xr}\hlopt{.}\hlstd{}\hlkwd{nrow}\hlstd{}\hlopt{(),\ }\hlstd{k\ }\hlopt{=\ }\hlstd{Xr}\hlopt{.}\hlstd{}\hlkwd{ncol}\hlstd{}\hlopt{();}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{arma}\hlopt{::}\hlstd{mat\ }\hlkwd{X}\hlstd{}\hlopt{(}\hlstd{Xr}\hlopt{.}\hlstd{}\hlkwd{begin}\hlstd{}\hlopt{(),\ }\hlstd{n}\hlopt{,\ }\hlstd{k}\hlopt{,\ }\hlstd{}\hlkwa{false}\hlstd{}\hlopt{);}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{arma}\hlopt{::}\hlstd{colvec\ }\hlkwd{y}\hlstd{}\hlopt{(}\hlstd{yr}\hlopt{.}\hlstd{}\hlkwd{begin}\hlstd{}\hlopt{(),\ }\hlstd{yr}\hlopt{.}\hlstd{}\hlkwd{size}\hlstd{}\hlopt{(),\ }\hlstd{}\hlkwa{false}\hlstd{}\hlopt{);}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{arma}\hlopt{::}\hlstd{colvec\ coef\ }\hlopt{=\ }\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{solve}\hlstd{}\hlopt{(}\hlstd{X}\hlopt{,\ }\hlstd{y}\hlopt{);}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{arma}\hlopt{::}\hlstd{colvec\ resid\ }\hlopt{=\ }\hlstd{y\ }\hlopt{{-}\ }\hlstd{X}\hlopt{{*}}\hlstd{coef}\hlopt{;}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwb{double\ }\hlstd{sig2\ }\hlopt{=\ }\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{as\textunderscore scalar}\hlstd{}\hlopt{(}\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{trans}\hlstd{}\hlopt{(}\hlstd{resid}\hlopt{){*}}\hlstd{resid}\hlopt{/(}\hlstd{n}\hlopt{{-}}\hlstd{k}\hlopt{));}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ }\hlstd{arma}\hlopt{::}\hlstd{colvec\ stderrest\ }\hlopt{=\ }\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{sqrt}\hlstd{}\hlopt{(}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ }\hlstd{sig2\ }\hlopt{{*}\ }\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{diagvec}\hlstd{}\hlopt{(\ }\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{inv}\hlstd{}\hlopt{(}\hlstd{arma}\hlopt{::}\hlstd{}\hlkwd{trans}\hlstd{}\hlopt{(}\hlstd{X}\hlopt{){*}}\hlstd{X}\hlopt{))\ );}\hspace*{\fill}\\ -\hlstd{\hspace*{\fill}\\ -}\hlstd{\ \ \ \ }\hlstd{}\hlkwa{return\ }\hlstd{List}\hlopt{::}\hlstd{}\hlkwd{create}\hlstd{}\hlopt{(}\hlstd{}\hlkwd{Named}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"coefficients"}\hlstd{}\hlopt{)\ =\ }\hlstd{coef}\hlopt{,}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlkwd{Named}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"stderr"}\hlstd{}\hlopt{)}\hlstd{\ \ \ \ \ \ \ }\hlopt{=\ }\hlstd{stderrest}\hlopt{);}\hspace*{\fill}\\ -\hlstd{}\hlopt{\}}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -The inclusion of the \texttt{Rcpp::depends} attribute causes \texttt{sourceCpp} -to configure the build environment to correctly compile and link against the -\pkg{RcppArmadillo} package. Source files can declare more than one dependency -either by using multiple \texttt{Rcpp::depends} attributes or with syntax like this: - -% \begin{verbatim} -% // [[Rcpp::depends(Matrix, RcppArmadillo)]] -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlslc{//\ {[}{[}Rcpp::depends(Matrix,\ RcppArmadillo){]}{]}}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Dependencies are discovered both by scanning for package include directories -and by invoking \pkg{inline} plugins if they are available for a package. - -Note that while the \texttt{Rcpp::depends} attribute establishes dependencies -for \texttt{sourceCpp}, it's important to note that if you include the same -source file in an \proglang{R} package these dependencies must still be -listed in the \texttt{Depends} and \texttt{LinkingTo} fields of the package -\texttt{DESCRIPTION} file. - - -\subsection{Including C++ Inline} - -Maintaining C++ code in it's own source file provides several benefits including -the ability to use \proglang{C++} aware text-editing tools and straightforward -mapping of compilation errors to lines in the source file. However, it's also -possible to do inline declaration and execution of C++ code. - -There are several ways to accomplish this, including passing a code -string to \texttt{sourceCpp} or using the shorter-form \texttt{cppFunction} -or \texttt{evalCpp} functions. For example: - -% \begin{verbatim} -% > cppFunction(' -% int fibonacci(const int x) { -% if (x < 2) -% return x; -% else -% return (fibonacci(x - 1)) + fibonacci(x - 2); -% } -% ') - -% > evalCpp('std::numeric_limits::max()') -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{>\ }\hlstd{}\hlkwd{cppFunction}\hlstd{}\hlopt{(}\hlstd{}\hlstr{\textquotesingle}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ }\hlstr{int\ fibonacci(const\ int\ x)\ \{}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ \ \ \ \ }\hlstr{if\ (x\ $<$\ 2)}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ }\hlstr{return\ x;}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ \ \ \ \ }\hlstr{else}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ }\hlstr{return\ (fibonacci(x\ {-}\ 1))\ +\ fibonacci(x\ {-}\ 2);}\hspace*{\fill}\\ -\hlstr{}\hlstd{\ \ \ \ }\hlstr{\}}\hspace*{\fill}\\ -\hlstr{\textquotesingle}\hlstd{}\hlopt{)}\hspace*{\fill}\\ -\hlstd{}\hspace*{\fill}\\ -\hlopt{>\ }\hlstd{}\hlkwd{evalCpp}\hlstd{}\hlopt{(}\hlstd{}\hlstr{\textquotesingle std::numeric\textunderscore limits$<$double$>$::max()\textquotesingle}\hlstd{}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -You can also specify a depends parameter to \texttt{cppFunction} or \texttt{evalCpp}: - -% \begin{verbatim} -% > cppFunction(depends = 'RcppArmadillo', code = '...') -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{>\ }\hlstd{}\hlkwd{cppFunction}\hlstd{}\hlopt{(}\hlstd{depends\ }\hlopt{=\ }\hlstd{}\hlstr{\textquotesingle RcppArmadillo\textquotesingle}\hlstd{}\hlopt{,\ }\hlstd{code\ }\hlopt{=\ }\hlstd{}\hlstr{\textquotesingle ...\textquotesingle}\hlstd{}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -\section{Package Development} - -One of the goals of \pkg{Rcpp} attributes is to simultaneously facilitate -ad-hoc and interactive work with \proglang{C++} while also making it very easy to -migrate that work into an \proglang{R} package. There are several benefits of -moving code from a standalone \proglang{C++} source file to a package: - -\begin{enumerate} -\item - Your code can be made available to users without \proglang{C++} development - tools (at least on Windows or Mac OS X where binary packages are common) -\item - Multiple source files and their dependencies are handled automatically - by the \proglang{R} package build system -\item - Packages provide additional infrastructure for testing, documentation - and consistency -\end{enumerate} - -\subsection{Package Creation} - -To create a package that is based on \pkg{Rcpp} you should follow the -guidelines in the `\textsl{Rcpp-package}' vignette. For a new package this -is most conveniently done using the \texttt{Rcpp.package.skeleton} function. - -To generate a new package with a simple hello, world function that uses -attributes you can do the following: - -% \begin{verbatim} -% > Rcpp.package.skeleton("NewPackage", attributes = TRUE) -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{$>$\ }\hlstd{Rcpp}\hlopt{.}\hlstd{package}\hlopt{.}\hlstd{}\hlkwd{skeleton}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"NewPackage"}\hlstd{}\hlopt{,\ }\hlstd{attributes\ }\hlopt{=\ }\hlstd{}\hlkwb{TRUE}\hlstd{}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -To generate a package based on \proglang{C++} files that you've been using -with \texttt{sourceCpp} you can use the \texttt{cpp\_files} parameter: - -% \begin{verbatim} -% > Rcpp.package.skeleton("NewPackage", example_code = FALSE, -% cpp_files = c("convolve.cpp")) -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{$>$\ }\hlstd{Rcpp}\hlopt{.}\hlstd{package}\hlopt{.}\hlstd{}\hlkwd{skeleton}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"NewPackage"}\hlstd{}\hlopt{,\ }\hlstd{example\textunderscore code\ }\hlopt{=\ }\hlstd{}\hlkwb{FALSE}\hlstd{}\hlopt{,}\hspace*{\fill}\\ -\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{cpp\textunderscore files\ }\hlopt{=\ }\hlstd{}\hlkwd{c}\hlstd{}\hlopt{(}\hlstd{}\hlstr{"convolve.cpp"}\hlstd{}\hlopt{))}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -\subsection{Specifying Dependencies} - -Once you've migrated \proglang{C++} code into a package, the dependencies for -source files are derived from the \texttt{Depends} and \texttt{LinkingTo} fields -in the package \texttt{DESCRIPTION} file rather than the \texttt{Rcpp::depends} -attribute. For every package you import C++ code from (including \pkg{Rcpp}) -you need to add these entries. - -For example, if your package depends on \pkg{Rcpp} and \pkg{RcppArmadillo} -you would have the following in your \texttt{DESCRIPTION} file: - -% \begin{verbatim} -% Depends: Rcpp (>= 0.10.0), RcppArmadillo (>= 0.3.4.4) -% LinkingTo: Rcpp, RcppArmadillo -% \end{verbatim} -\begin{kframe} -\noindent -\ttfamily -\hlstd{Depends:\ Rcpp\ ($>$=\ 0.10.0),\ RcppArmadillo\ ($>$=\ 0.3.4.4)\hspace*{\fill}\\ -LinkingTo:\ Rcpp,\ RcppArmadillo}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -\subsection{Exporting R Functions} - -Within interactive sessions you call the \texttt{sourceCpp} function -on individual files to export \proglang{C++} functions into the global -environment. However, for packages you call a single utility function to -export all \proglang{C++} functions within the package. - -The \texttt{compileAttributes} function scans the source files within a package -for export attributes and generates code as required. For example, executing -this from within the package working directory: - -% \begin{verbatim} -% > compileAttributes() -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlopt{>\ }\hlstd{}\hlkwd{compileAttributes}\hlstd{}\hlopt{()}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Results in the generation of the following two source files: - -\begin{itemize} -\item - \texttt{src/RcppExports.cpp} -- The \texttt{extern "C"} wrappers required - to call exported \proglang{C++} functions within the package. -\item - \texttt{R/RcppExports.R} -- The \texttt{.Call} wrappers required to call - the \texttt{extern "C"} functions defined in \texttt{RcppExports.cpp}. -\end{itemize} - -You should re-run \texttt{compileAttributes} whenever functions are added, -removed, or have their signatures changed. - -The \texttt{compileAttributes} function deals only with exporting -\proglang{C++} functions to \proglang{R}. If you want the functions to -additionally be publicly available from your package's namespace another -step may be required. Specifically, if your package \texttt{NAMESPACE} file -does not use a pattern to export functions then you should add an explicit -entry to \texttt{NAMESPACE} for each R function you want publicly available. - -\subsection{Roxygen Comments} - -The \pkg{roxygen2} package \citep{CRAN:roxygen2} provides a facility for -automatically generating \proglang{R} documentation files based on specially -formatted comments in \proglang{R} source code. - -If you include roxygen comments in your \proglang{C++} source file with a -\texttt{//\textquotesingle} prefix then \texttt{compileAttributes} will transpose them -into R roxygen comments within \texttt{R/RcppExports.R}. For example the -following code in a \proglang{C++} source file: - -% \begin{verbatim} -% //' The length of a string (in characters). -% //' -% //' @param str input character vector -% //' @return characters in each element of the vector -% // [[Rcpp::export]] -% NumericVector strLength(CharacterVector str) -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlslc{//\textquotesingle\ The\ length\ of\ a\ string\ (in\ characters).}\hspace*{\fill}\\ -\hlstd{}\hlslc{//\textquotesingle\ @param\ str\ input\ character\ vector}\hspace*{\fill}\\ -\hlstd{}\hlslc{//\textquotesingle\ @return\ characters\ in\ each\ element\ of\ the\ vector}\hspace*{\fill}\\ -\hlstd{}\hlslc{//\ {[}{[}Rcpp::export{]}{]}}\hspace*{\fill}\\ -\hlstd{NumericVector\ }\hlkwd{strLength}\hlstd{}\hlopt{(}\hlstd{CharacterVector\ str}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -Results in the following code in the generated \proglang{R} source file: - -% \begin{verbatim} -% #' The length of a string (in characters). -% #' -% #' @param str input character vector -% #' @return characters in each element of the vector -% strLength <- function(str) -% \end{verbatim} - -\begin{kframe} -\noindent -\ttfamily -\hlstd{}\hlslc{\#\textquotesingle\ The\ length\ of\ a\ string\ (in\ characters).}\hspace*{\fill}\\ -\hlstd{}\hlslc{\#\textquotesingle\ @param\ str\ input\ character\ vector}\hspace*{\fill}\\ -\hlstd{}\hlslc{\#\textquotesingle\ @return\ characters\ in\ each\ element\ of\ the\ vector}\hspace*{\fill}\\ -\hlstd{strLength\ }\hlopt{$<${-}\ }\hlstd{}\hlkwa{function}\hlstd{}\hlopt{(}\hlstd{str}\hlopt{)}\hlstd{}\hspace*{\fill} -\mbox{} -\normalfont -\normalsize -\end{kframe} - -\subsection{Providing a C++ Interface} - -The interface exposed from \proglang{R} packages is most typically a set of -\proglang{R} functions. However, the \proglang{R} package system also provides -a mechanism to allow the exporting of \proglang{C} and \proglang{C++} -interfaces using package header files. This is based on the -\texttt{R\_RegisterCCallable} and \texttt{R\_GetCCallable} functions described in -`\textsl{Writing R Extensions}' \citep{R:Extensions}. - -\proglang{C++} interfaces to a package are published within the -top level \texttt{include} directory of the package (which within the package -source directory is located at \texttt{inst/include}). The \proglang{R} build -system automatically adds the required \texttt{include} directories for all -packages specified in the \texttt{LinkingTo} field of the package -\texttt{DESCRIPTION} file. - -\subsubsection{Interfaces Attribute} - -The \texttt{Rcpp::interfaces} attribute can be used to automatically -generate a header-only interface to your \proglang{C++} functions -within the \texttt{include} directory of your package. - -The \texttt{Rcpp::interfaces} attribute is specified on a per-source [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4458 From noreply at r-forge.r-project.org Sat Aug 31 21:17:28 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:17:28 +0200 (CEST) Subject: [Rcpp-commits] r4459 - in pkg/Rcpp/inst/doc: Rcpp-FAQ Rcpp-attributes Rcpp-extending Rcpp-modules Rcpp-package Rcpp-quickref Rcpp-sugar notyet Message-ID: <20130831191728.D1482184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:17:28 +0200 (Sat, 31 Aug 2013) New Revision: 4459 Removed: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref-fake.Rnw pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar-fake.Rnw pkg/Rcpp/inst/doc/notyet/Rcpp-api.Rnw Log: removing old (now unused) fake Rnw files Deleted: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-FAQ} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-attributes} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-extending} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-modules} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-package} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,34 +0,0 @@ -\documentclass[8pt,twocolumn,a4paper]{article} -%\VignetteIndexEntry{Rcpp-quickref} - -\setlength{\hoffset}{-0.8in} -\setlength{\voffset}{-0.8in} - -\setlength{\marginparwidth}{0pt} -\setlength{\marginparsep}{0pt} -\setlength{\oddsidemargin}{0pt} -\setlength{\headheight}{0pt} -\setlength{\topmargin}{0pt} -\setlength{\headsep}{0pt} -\setlength{\footskip}{0pt} -\setlength{\textheight}{27cm} -\setlength{\textwidth}{20cm} - -\usepackage[colorlinks]{hyperref} - -<>= -options( width= 50) -library( "Rcpp" ) -rcpp.version <- packageDescription( "Rcpp" )$Version -@ -% closing $ needed here - -\author{Romain Fran\c{c}ois \and Dirk Eddelbuettel} -\title{Rcpp \Sexpr{rcpp.version}: Quick Reference Guide} - -\begin{document} -\maketitle -\thispagestyle{empty} - -\end{document} - Deleted: pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar-fake.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar-fake.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar-fake.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-sugar} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/notyet/Rcpp-api.Rnw =================================================================== --- pkg/Rcpp/inst/doc/notyet/Rcpp-api.Rnw 2013-08-31 19:11:15 UTC (rev 4458) +++ pkg/Rcpp/inst/doc/notyet/Rcpp-api.Rnw 2013-08-31 19:17:28 UTC (rev 4459) @@ -1,94 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-API} -\usepackage{vmargin} - -\setmargrb{0.75in}{0.75in}{0.75in}{0.75in} - -\usepackage[colorlinks]{hyperref} -\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois} -\title{Rcpp : API} -\begin{document} -\maketitle - - -\section{Rcpp classes} - -\section{vectors} - -\subsection[Rcpp::IntegerVector : integer vectors]{\texttt{Rcpp::IntegerVector} : integer vectors} - -The \texttt{Rcpp::IntegerVector} class manages integer vectors, -R objects of SEXP type \texttt{INTSXP}. - -\subsubsection{Creating integer vectors} - -The \texttt{IntegerVector} class offers several ways to -create integer vectors. - -\paragraph{Constructors} - -\begin{verbatim} -IntegerVector( SEXP x ); -\end{verbatim} - -This constructor creates a \texttt{IntegerVector} from an existing \texttt{SEXP}, -The object is coerced to an integer vector and an \texttt{not\_compatible} -exception is thrown if the coercion fails. - -\begin{verbatim} -IntegerVector( size_t& size ) ; -IntegerVector( size_t& size, const int& x ) ; -\end{verbatim} - -Creates an \texttt{IntegerVector} of the given size. The first -form initialiezs all values to 0 and the second form initializes all values -to the value of \texttt{x}. - -\begin{verbatim} -IntegerVector( const Dimension& dims ) ; -IntegerVector( const Dimension& dims, const int& x ) ; -\end{verbatim} - -Creates an \texttt{IntegerVector} of the requested dimensions. The first -form initialiezs all values to 0 and the second form initializes all values -to the value of \texttt{x}. - -\begin{verbatim} -template -IntegerVector( InputIterator first, InputIterator last) ; -\end{verbatim} - -Range based constructor. Creates an \texttt{IntegerVector} -containing the values of the range. - -\paragraph{create factory functions} - -\begin{verbatim} -template -static IntegerVector create( const T1& t1) ; - -template -static IntegerVector create( const T1& t1, const T2& t2) ; - -... - -\end{verbatim} - -In addition to constructors, \texttt{IntegerVector} defines a set -of templated factory functions \texttt{create}. \texttt{IntegerVector:::create} -can be seen as a function taking a variable number of arguments (currently up to 20) -and creating an \texttt{IntegerVector} from them. - -Valid types are \texttt{int} and instances of \texttt{Rcpp::traits::named\_object} -which are typically created by using the \texttt{Rcpp::Named} function -or the \texttt{\_} variable: - -\begin{verbatim} -IntegerVector x = IntegerVector::create( 1, 2, 3) ; -IntegerVector x = IntegerVector::create( Named( "x" ) = 2, Named( "y" ) = 3) ; -IntegerVector x = IntegerVector::create( _["x"] = 2, _["y"] = 3) ; -\end{verbatim} - - -\end{document} - From noreply at r-forge.r-project.org Sat Aug 31 21:20:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:20:57 +0200 (CEST) Subject: [Rcpp-commits] r4460 - in pkg/Rcpp/vignettes: . notyet Message-ID: <20130831192058.09B5B184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:20:57 +0200 (Sat, 31 Aug 2013) New Revision: 4460 Added: pkg/Rcpp/vignettes/jss.bst pkg/Rcpp/vignettes/notyet/ pkg/Rcpp/vignettes/notyet/Rcpp-api.Rnw Log: also moving bibtex style file and as-of-yet-unfinished API vignette Copied: pkg/Rcpp/vignettes/jss.bst (from rev 4448, pkg/Rcpp/inst/doc/jss.bst) =================================================================== --- pkg/Rcpp/vignettes/jss.bst (rev 0) +++ pkg/Rcpp/vignettes/jss.bst 2013-08-31 19:20:57 UTC (rev 4460) @@ -0,0 +1,1629 @@ +%% +%% This is file `jss.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% merlin.mbs (with options: `ay,nat,nm-rvx,keyxyr,dt-beg,yr-par,note-yr,tit-qq,atit-u,trnum-it,vol-bf,volp-com,num-xser,pre-edn,isbn,issn,edpar,pp,ed,xedn,xand,etal-it,revdata,eprint,url,url-blk,doi,nfss') +%% +%% ** BibTeX style file for JSS publications (http://www.jstatsoft.org/) +%% +%% Copyright 1994-2005 Patrick W Daly +%% License: GPL-2 + % =============================================================== + % IMPORTANT NOTICE: + % This bibliographic style (bst) file has been generated from one or + % more master bibliographic style (mbs) files, listed above, provided + % with kind permission of Patrick W Daly. + % + % This generated file can be redistributed and/or modified under the terms + % of the General Public License (Version 2). + % =============================================================== + % Name and version information of the main mbs file: + % \ProvidesFile{merlin.mbs}[2005/10/17 4.14 (PWD, AO, DPC)] + % For use with BibTeX version 0.99a or later + %------------------------------------------------------------------- + % This bibliography style file is intended for texts in ENGLISH + % This is an author-year citation style bibliography. As such, it is + % non-standard LaTeX, and requires a special package file to function properly. + % Such a package is natbib.sty by Patrick W. Daly + % The form of the \bibitem entries is + % \bibitem[Jones et al.(1990)]{key}... + % \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... + % The essential feature is that the label (the part in brackets) consists + % of the author names, as they should appear in the citation, with the year + % in parentheses following. There must be no space before the opening + % parenthesis! + % With natbib v5.3, a full list of authors may also follow the year. + % In natbib.sty, it is possible to define the type of enclosures that is + % really wanted (brackets or parentheses), but in either case, there must + % be parentheses in the label. + % The \cite command functions as follows: + % \citet{key} ==>> Jones et al. (1990) + % \citet*{key} ==>> Jones, Baker, and Smith (1990) + % \citep{key} ==>> (Jones et al., 1990) + % \citep*{key} ==>> (Jones, Baker, and Smith, 1990) + % \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2) + % \citep[e.g.][]{key} ==>> (e.g. Jones et al., 1990) + % \citep[e.g.][p. 32]{key} ==>> (e.g. Jones et al., p. 32) + % \citeauthor{key} ==>> Jones et al. + % \citeauthor*{key} ==>> Jones, Baker, and Smith + % \citeyear{key} ==>> 1990 + %--------------------------------------------------------------------- + +ENTRY + { address + archive + author + booktitle + chapter + collaboration + doi + edition + editor + eid + eprint + howpublished + institution + isbn + issn + journal + key + month + note + number + numpages + organization + pages + publisher + school + series + title + type + url + volume + year + } + {} + { label extra.label sort.label short.list } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} +STRINGS { s t} +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} +FUNCTION {add.blank} +{ " " * before.all 'output.state := +} + +FUNCTION {date.block} +{ + new.block +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} +FUNCTION {non.stop} +{ duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + +STRINGS {z} +FUNCTION {remove.dots} +{ 'z := + "" + { z empty$ not } + { z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = 'pop$ + { * } + if$ + } + while$ +} +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "\emph{" swap$ * "}" * } + if$ +} +FUNCTION {bolden} +{ duplicate$ empty$ + { pop$ "" } + { "\textbf{" swap$ * "}" * } + if$ +} +FUNCTION {tie.or.space.prefix} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + +FUNCTION {space.word} +{ " " swap$ * " " * } + % Here are the language-specific definitions for explicit words. + % Each function has a name bbl.xxx where xxx is the English word. + % The language selected here is ENGLISH +FUNCTION {bbl.and} +{ "and"} + +FUNCTION {bbl.etal} +{ "et~al." } + +FUNCTION {bbl.editors} +{ "eds." } + +FUNCTION {bbl.editor} +{ "ed." } + +FUNCTION {bbl.edby} +{ "edited by" } + +FUNCTION {bbl.edition} +{ "edition" } + +FUNCTION {bbl.volume} +{ "volume" } + +FUNCTION {bbl.of} +{ "of" } + +FUNCTION {bbl.number} +{ "number" } + +FUNCTION {bbl.nr} +{ "no." } + +FUNCTION {bbl.in} +{ "in" } + +FUNCTION {bbl.pages} +{ "pp." } + +FUNCTION {bbl.page} +{ "p." } + +FUNCTION {bbl.eidpp} +{ "pages" } + +FUNCTION {bbl.chapter} +{ "chapter" } + +FUNCTION {bbl.techrep} +{ "Technical Report" } + +FUNCTION {bbl.mthesis} +{ "Master's thesis" } + +FUNCTION {bbl.phdthesis} +{ "Ph.D. thesis" } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} +FUNCTION {bibinfo.check} +{ swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { duplicate$ empty$ + { + swap$ pop$ + } + { swap$ + pop$ + } + if$ + } + if$ +} +FUNCTION {bibinfo.warn} +{ swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { swap$ + pop$ + } + if$ + } + if$ +} +FUNCTION {format.eprint} +{ eprint duplicate$ empty$ + 'skip$ + { "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} +FUNCTION {format.url} +{ url empty$ + { "" } + { "\urlprefix\url{" url * "}" * } + if$ +} + +STRINGS { bibinfo} +INTEGERS { nameptr namesleft numnames } + +FUNCTION {format.names} +{ 'bibinfo := + duplicate$ empty$ 'skip$ { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr + "{vv~}{ll}{ jj}{ f{}}" + format.name$ + remove.dots + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + "," * + t "others" = + { + " " * bbl.etal emphasize * + } + { " " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } if$ +} +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ 'skip$ { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr + "{f{}~}{vv~}{ll}{ jj}" + format.name$ + remove.dots + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + "," * + t "others" = + { + + " " * bbl.etal emphasize * + } + { " " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } if$ +} +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author "author" format.names + duplicate$ empty$ 'skip$ + { collaboration "collaboration" bibinfo.check + duplicate$ empty$ 'skip$ + { " (" swap$ * ")" * } + if$ + * + } + if$ +} +FUNCTION {get.bbl.editor} +{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ } + +FUNCTION {format.editors} +{ editor "editor" format.names duplicate$ empty$ 'skip$ + { + " " * + get.bbl.editor + "(" swap$ * ")" * + * + } + if$ +} +FUNCTION {format.isbn} +{ isbn "isbn" bibinfo.check + duplicate$ empty$ 'skip$ + { + new.block + "ISBN " swap$ * + } + if$ +} + +FUNCTION {format.issn} +{ issn "issn" bibinfo.check + duplicate$ empty$ 'skip$ + { + new.block + "ISSN " swap$ * + } + if$ +} + +FUNCTION {format.doi} +{ doi "doi" bibinfo.check + duplicate$ empty$ 'skip$ + { + new.block + "\doi{" swap$ * "}" * + } + if$ +} +FUNCTION {format.note} +{ + note empty$ + { "" } + { note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + if$ +} + +FUNCTION {format.title} +{ title + "title" bibinfo.check + duplicate$ empty$ 'skip$ + { + "\enquote{" swap$ * + add.period$ "}" * + } + if$ +} +FUNCTION {format.full.names} +{'s := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal emphasize * + } + { + numnames #2 > + { "," * } + 'skip$ + if$ + bbl.and + space.word * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.key.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.key.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {editor.key.full} +{ editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full + { type$ "proceedings" = + 'editor.key.full + 'author.key.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[{" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {n.dashify} +{ + 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {word.in} +{ bbl.in capitalize + " " * } + +FUNCTION {format.date} +{ year "year" bibinfo.check duplicate$ empty$ + { + "empty year in " cite$ * "; set to ????" * warning$ + pop$ "????" + } + 'skip$ + if$ + extra.label * + before.all 'output.state := + " (" swap$ * ")" * +} +FUNCTION {format.btitle} +{ title "title" bibinfo.check + duplicate$ empty$ 'skip$ + { + emphasize + } + if$ +} +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ 'pop$ + { swap$ bbl.of space.word * swap$ + emphasize * } + if$ + "volume and number" number either.or.check + } + if$ +} +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + { series field.or.null } + { series empty$ + { number "number" bibinfo.check } + { output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + +FUNCTION {format.edition} +{ edition duplicate$ empty$ 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ change.case$ + "edition" bibinfo.check + " " * bbl.edition * + } + if$ +} +INTEGERS { multiresult } +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} +FUNCTION {format.pages} +{ pages duplicate$ empty$ 'skip$ + { duplicate$ multi.page.check + { + bbl.pages swap$ + n.dashify + } + { + bbl.page swap$ + } + if$ + tie.or.space.prefix + "pages" bibinfo.check + * * + } + if$ +} +FUNCTION {format.journal.pages} +{ pages duplicate$ empty$ 'pop$ + { swap$ duplicate$ empty$ + { pop$ pop$ format.pages } + { + ", " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} +FUNCTION {format.journal.eid} +{ eid "eid" bibinfo.check + duplicate$ empty$ 'pop$ + { swap$ duplicate$ empty$ 'skip$ + { + ", " * + } + if$ + swap$ * + numpages empty$ 'skip$ + { bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} +FUNCTION {format.vol.num.pages} +{ volume field.or.null + duplicate$ empty$ 'skip$ + { + "volume" bibinfo.check + } + if$ + bolden + number "number" bibinfo.check duplicate$ empty$ 'skip$ + { + swap$ duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "(" swap$ * ")" * + } + if$ * + eid empty$ + { format.journal.pages } + { format.journal.eid } + if$ +} + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { bbl.chapter } + { type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ + } + if$ +} + +FUNCTION {format.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} +FUNCTION {format.in.ed.booktitle} +{ format.booktitle duplicate$ empty$ 'skip$ + { + editor "editor" format.names.ed duplicate$ empty$ 'pop$ + { + " " * + get.bbl.editor + "(" swap$ * "), " * + * swap$ + * } + if$ + word.in swap$ * + } + if$ +} +FUNCTION {format.thesis.type} +{ type duplicate$ empty$ + 'pop$ + { swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} +FUNCTION {format.tr.number} +{ number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} +FUNCTION {format.article.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} +FUNCTION {format.book.crossref} +{ volume duplicate$ empty$ + { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of space.word * + } + if$ + " \cite{" * crossref * "}" * +} +FUNCTION {format.incoll.inproc.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} +FUNCTION {format.org.or.pub} +{ 't := + "" + address empty$ t empty$ and + 'skip$ + { + t empty$ + { address "address" bibinfo.check * + } + { t * + address empty$ + 'skip$ + { ", " * address "address" bibinfo.check * } + if$ + } + if$ + } + if$ +} +FUNCTION {format.publisher.address} +{ publisher "publisher" bibinfo.warn format.org.or.pub +} + +FUNCTION {format.organization.address} +{ organization "organization" bibinfo.check format.org.or.pub +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.title "title" output.check + new.block + crossref missing$ + { + journal + "journal" bibinfo.check + emphasize + "journal" output.check + format.vol.num.pages output + } + { format.article.crossref output.nonnull + format.pages output + } + if$ + format.issn output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check + editor format.key output + } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + format.date "year" output.check + date.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + new.block + format.number.series output + format.edition output + new.sentence + format.publisher.address output + } + { + new.block + format.book.crossref output.nonnull + } + if$ + format.isbn output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} +FUNCTION {booklet} +{ output.bibitem + format.authors output + author format.key output + format.date "year" output.check + date.block + format.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + format.isbn output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check + editor format.key output + } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + format.date "year" output.check + date.block + format.btitle "title" output.check + crossref missing$ + { + format.bvolume output + format.chapter.pages "chapter and pages" output.check + new.block + format.number.series output + format.edition output + new.sentence + format.publisher.address output + } + { + format.chapter.pages "chapter and pages" output.check + new.block + format.book.crossref output.nonnull + } + if$ + crossref missing$ + { format.isbn output } + 'skip$ + if$ + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.edition output + format.chapter.pages output + new.sentence + format.publisher.address output + format.isbn output + } + { format.incoll.inproc.crossref output.nonnull + format.chapter.pages output + } + if$ + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.pages output + new.sentence + publisher empty$ + { format.organization.address output } + { organization "organization" bibinfo.check output + format.publisher.address output + } + if$ + format.isbn output + format.issn output + } + { format.incoll.inproc.crossref output.nonnull + format.pages output + } + if$ + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} +FUNCTION {conference} { inproceedings } +FUNCTION {manual} +{ output.bibitem + format.authors output + author format.key output + format.date "year" output.check + date.block + format.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + format.edition output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.btitle + "title" output.check + new.block + bbl.mthesis format.thesis.type output.nonnull + school "school" bibinfo.warn output + address "address" bibinfo.check output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.authors output + author format.key output + format.date "year" output.check + date.block + format.title output + new.block + howpublished "howpublished" bibinfo.check output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.btitle + "title" output.check + new.block + bbl.phdthesis format.thesis.type output.nonnull + school "school" bibinfo.warn output + address "address" bibinfo.check output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {proceedings} +{ output.bibitem + format.editors output + editor format.key output + format.date "year" output.check + date.block + format.btitle "title" output.check + format.bvolume output + format.number.series output + new.sentence + publisher empty$ + { format.organization.address output } + { organization "organization" bibinfo.check output + format.publisher.address output + } + if$ + format.isbn output + format.issn output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.title + "title" output.check + new.block + format.tr.number emphasize output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + format.doi output + new.block + format.note output + format.eprint output + format.url output + fin.entry +} + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check + author format.key output + format.date "year" output.check + date.block + format.title "title" output.check + format.doi output + new.block + format.note "note" output.check + format.eprint output + format.url output + fin.entry +} + +FUNCTION {default.type} { misc } +READ +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} +INTEGERS { len } +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} +FUNCTION {format.lab.names} +{ 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ duplicate$ + #2 > + { pop$ + " " * bbl.etal emphasize * + } + { #2 < + 'skip$ + { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal emphasize * + } + { bbl.and space.word * s #2 "{vv~}{ll}" format.name$ + * } + if$ + } + if$ + } + if$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.label} +{ editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "proceedings" = + 'editor.key.label + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr + "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" + format.name$ 't := + nameptr #1 > + { + " " * + namesleft #1 = t "others" = and + { "zzzzz" * } + { t sortify * } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} +FUNCTION {editor.sort} +{ editor empty$ + { key empty$ + { "to sort, need editor or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ +} +FUNCTION {presort} +{ calc.label + label sortify + " " + * + type$ "book" = + type$ "inbook" = + or + 'author.editor.sort + { type$ "proceedings" = + 'editor.sort + 'author.sort + if$ + } + if$ + #1 entry.max$ substring$ + 'sort.label := + sort.label + * + " " + * + title field.or.null + sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} + +ITERATE {presort} +SORT +STRINGS { last.label next.extra } +INTEGERS { last.extra.num number.label } +FUNCTION {initialize.extra.label.stuff} +{ #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'last.extra.num := + #0 'number.label := +} +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label + duplicate$ empty$ + 'skip$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} +EXECUTE {initialize.extra.label.stuff} +ITERATE {forward.pass} +REVERSE {reverse.pass} +FUNCTION {bib.sort.order} +{ sort.label + " " + * + year field.or.null sortify + * + " " + * + title field.or.null + sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} +ITERATE {bib.sort.order} +SORT +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\newcommand{\enquote}[1]{``#1''}" + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{\texttt{#1}}" + write$ newline$ + "\providecommand{\urlprefix}{URL }" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax" + write$ newline$ + " \providecommand{\doi}[1]{doi:\discretionary{}{}{}#1}\else" + write$ newline$ + " \providecommand{\doi}{doi:\discretionary{}{}{}\begingroup \urlstyle{rm}\Url}\fi" + write$ newline$ + "\providecommand{\eprint}[2][]{\url{#2}}" + write$ newline$ +} +EXECUTE {begin.bib} +EXECUTE {init.state.consts} +ITERATE {call.type$} +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} +EXECUTE {end.bib} +%% End of customized bst file +%% +%% End of file `jss.bst'. Copied: pkg/Rcpp/vignettes/notyet/Rcpp-api.Rnw (from rev 4448, pkg/Rcpp/inst/doc/notyet/Rcpp-api.Rnw) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4460 From noreply at r-forge.r-project.org Sat Aug 31 21:26:10 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:26:10 +0200 (CEST) Subject: [Rcpp-commits] r4461 - pkg/Rcpp/inst/doc Message-ID: <20130831192610.A5545184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:26:10 +0200 (Sat, 31 Aug 2013) New Revision: 4461 Removed: pkg/Rcpp/inst/doc/Makefile Log: cleaning out inst/doc Deleted: pkg/Rcpp/inst/doc/Makefile =================================================================== --- pkg/Rcpp/inst/doc/Makefile 2013-08-31 19:20:57 UTC (rev 4460) +++ pkg/Rcpp/inst/doc/Makefile 2013-08-31 19:26:10 UTC (rev 4461) @@ -1,171 +0,0 @@ - -## There is an old bug in texidvi that makes it not swallow the ~ -## marker used to denote whitespace. This is actually due to fixing -## another bug whereby you could not run texidvi on directory names -## containing a tilde (as we happen to do for Debian builds of R -## alpha/beta/rc releases). The 'tilde' bug will go away as it -## reportedly has been squashed upstream but I am still bitten by it -## on Ubuntu so for now Dirk will insist on pdflatex and this helps. -whoami=$(shell whoami) - -all: - @echo The 'make all' target is now empty as eg R-Forge builds fall over - @echo So please use 'make pdfclean; make pdfall' to rebuild - -OLDpdfall: index.html Rcpp-unitTests.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-FAQ.pdf Rcpp-extending.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-quickref.pdf - -pdfall: index.html - ## Play some games with explicit targets to avoid parallel make builds - ## This is all just because R-Forge insists on re-making these, seemingly in parallel - make Rcpp-extending.pdf - make Rcpp-FAQ.pdf - make Rcpp-introduction.pdf - make Rcpp-modules.pdf - make Rcpp-package.pdf - make Rcpp-quickref.pdf - make Rcpp-sugar.pdf - make Rcpp-attributes.pdf - make Rcpp-unitTests.pdf - -pdfclean: - rm -f Rcpp-extending.pdf Rcpp-FAQ.pdf Rcpp-introduction.pdf Rcpp-modules.pdf Rcpp-package.pdf Rcpp-quickref.pdf Rcpp-sugar.pdf Rcpp-attributes.pdf Rcpp-unitTests.pdf - -#clean: -# rm -f index.html -# rm -f *.tex *.bbl *.blg *.aux *.out *.log - -setvars: -ifeq (${R_HOME},) -R_HOME= $(shell R RHOME) -endif -RPROG= $(R_HOME)/bin/R -RSCRIPT=$(R_HOME)/bin/Rscript - -index.html: rcpp.index.html - cp rcpp.index.html index.html - -Rcpp-unitTests.pdf: - rm -fr unitTests-results/* - $(RSCRIPT) --vanilla unitTests/Rcpp-unitTests.R - $(RPROG) CMD Sweave Rcpp-unitTests.Rnw - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-unitTests.tex', pdf = TRUE, clean = TRUE )" - rm -fr Rcpp-unitTests.tex - -Rcpp-api.pdf: Rcpp-api.Rnw - $(RPROG) CMD Sweave Rcpp-api.Rnw - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-api.tex', pdf = TRUE, clean = TRUE ) " - rm -fr Rcpp-api.tex - -Rcpp-introduction.pdf: Rcpp-introduction.Rnw - $(RPROG) CMD Sweave Rcpp-introduction.Rnw -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-introduction.tex - bibtex Rcpp-introduction - pdflatex Rcpp-introduction.tex - pdflatex Rcpp-introduction.tex -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-introduction.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-introduction.tex Rcpp-introduction.bbl Rcpp-introduction.blg Rcpp-introduction.aux Rcpp-introduction.out Rcpp-introduction.log - -Rcpp-modules.pdf: Rcpp-modules/Rcpp-modules.Rnw - cp -f Rcpp-modules/Rcpp-modules.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-modules.Rnw', driver = driver ); " - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-modules.tex', pdf = TRUE, clean = FALSE )" - bibtex Rcpp-modules -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-modules.tex - pdflatex Rcpp-modules.tex -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-modules.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-modules.tex Rcpp-modules.bbl Rcpp-modules.blg Rcpp-modules.aux Rcpp-modules.out Rcpp-modules.log - cp -f Rcpp-modules/Rcpp-modules-fake.Rnw Rcpp-modules.Rnw - -Rcpp-package.pdf : Rcpp-package/Rcpp-package.Rnw - cp -f Rcpp-package/Rcpp-package.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-package.Rnw', driver = driver ); " -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-package -else - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-package.tex', pdf = TRUE, clean = FALSE )" -endif - bibtex Rcpp-package -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-package - pdflatex Rcpp-package -else - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-package.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-package.tex Rcpp-package.bbl Rcpp-package.blg Rcpp-package.aux Rcpp-package.out Rcpp-package.log - cp -f Rcpp-package/Rcpp-package-fake.Rnw Rcpp-package.Rnw - -Rcpp-FAQ.pdf : Rcpp-FAQ/Rcpp-FAQ.Rnw - cp -f Rcpp-FAQ/Rcpp-FAQ.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-FAQ.Rnw', driver = driver ); " - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-FAQ.tex', pdf = TRUE, clean = FALSE )" - bibtex Rcpp-FAQ -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-FAQ - pdflatex Rcpp-FAQ -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-FAQ.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-FAQ.tex Rcpp-FAQ.bbl Rcpp-FAQ.blg Rcpp-FAQ.aux Rcpp-FAQ.out Rcpp-FAQ.log - cp -f Rcpp-FAQ/Rcpp-FAQ-fake.Rnw Rcpp-FAQ.Rnw - -Rcpp-extending.pdf : Rcpp-extending/Rcpp-extending.Rnw - cp -f Rcpp-extending/Rcpp-extending.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-extending.Rnw', driver = driver ); " - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-extending.tex', pdf = TRUE, clean = FALSE )" - bibtex Rcpp-extending -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-extending - pdflatex Rcpp-extending -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-extending.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-extending.tex Rcpp-extending.bbl Rcpp-extending.blg Rcpp-extending.aux Rcpp-extending.out Rcpp-extending.log - cp -f Rcpp-extending/Rcpp-extending-fake.Rnw Rcpp-extending.Rnw - -Rcpp-sugar.pdf : Rcpp-sugar/Rcpp-sugar.Rnw - cp -f Rcpp-sugar/Rcpp-sugar.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-sugar.Rnw', driver = driver ); " - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-sugar.tex', pdf = TRUE, clean = FALSE )" - bibtex Rcpp-sugar -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-sugar - pdflatex Rcpp-sugar -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-sugar.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-sugar.tex Rcpp-sugar.bbl Rcpp-sugar.blg Rcpp-sugar.aux Rcpp-sugar.out Rcpp-sugar.log Rcpp-sugar.Rnw - cp -f Rcpp-sugar/Rcpp-sugar-fake.Rnw Rcpp-sugar.Rnw - -Rcpp-attributes.pdf : Rcpp-attributes/Rcpp-attributes.Rnw - cp -f Rcpp-attributes/Rcpp-attributes.Rnw . - $(RSCRIPT) --vanilla -e "Sweave( 'Rcpp-attributes.Rnw' );" - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-attributes.tex', pdf = TRUE, clean = FALSE )" - bibtex Rcpp-attributes -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-attributes - pdflatex Rcpp-attributes -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-attributes.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-attributes.tex Rcpp-attributes.bbl Rcpp-attributes.blg Rcpp-attributes.aux Rcpp-attributes.out Rcpp-attributes.log Rcpp-attributes.Rnw - cp -f Rcpp-attributes/Rcpp-attributes-fake.Rnw Rcpp-attributes.Rnw - -Rcpp-quickref.pdf : Rcpp-quickref/Rcpp-quickref.Rnw - cp -f Rcpp-quickref/Rcpp-quickref.Rnw . - $(RSCRIPT) --vanilla -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-quickref.Rnw', driver = driver ); " - $(RSCRIPT) --vanilla -e "tools::texi2dvi( 'Rcpp-quickref.tex', pdf = TRUE, clean = FALSE )" -ifneq (,$(findstring edd,$(whoami))) - pdflatex Rcpp-quickref - pdflatex Rcpp-quickref -else - $(RSCRIPT) -e "tools::texi2dvi( 'Rcpp-quickref.tex', pdf = TRUE, clean = TRUE )" -endif - rm -fr Rcpp-quickref.tex Rcpp-quickref.bbl Rcpp-quickref.blg Rcpp-quickref.aux Rcpp-quickref.out Rcpp-quickref.log Rcpp-quickref.Rnw - cp -f Rcpp-quickref/Rcpp-quickref-fake.Rnw Rcpp-quickref.Rnw - From noreply at r-forge.r-project.org Sat Aug 31 21:26:56 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:26:56 +0200 (CEST) Subject: [Rcpp-commits] r4462 - pkg/Rcpp/inst/doc Message-ID: <20130831192656.0F9FF184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:26:55 +0200 (Sat, 31 Aug 2013) New Revision: 4462 Removed: pkg/Rcpp/inst/doc/Rcpp-FAQ.Rnw pkg/Rcpp/inst/doc/Rcpp-attributes.Rnw pkg/Rcpp/inst/doc/Rcpp-extending.Rnw pkg/Rcpp/inst/doc/Rcpp-modules.Rnw pkg/Rcpp/inst/doc/Rcpp-package.Rnw pkg/Rcpp/inst/doc/Rcpp-sugar.Rnw pkg/Rcpp/inst/doc/jss.bst Log: cleaning out inst/doc Deleted: pkg/Rcpp/inst/doc/Rcpp-FAQ.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-FAQ.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-FAQ.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-FAQ} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-attributes.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-attributes.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-attributes.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-attributes} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-extending.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-extending.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-extending.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-extending} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-modules.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-modules.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-modules.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-modules} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-package.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-package.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-package.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-package} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/Rcpp-sugar.Rnw =================================================================== --- pkg/Rcpp/inst/doc/Rcpp-sugar.Rnw 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/Rcpp-sugar.Rnw 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,4 +0,0 @@ -\documentclass[10pt]{article} -%\VignetteIndexEntry{Rcpp-sugar} -\begin{document} -\end{document} Deleted: pkg/Rcpp/inst/doc/jss.bst =================================================================== --- pkg/Rcpp/inst/doc/jss.bst 2013-08-31 19:26:10 UTC (rev 4461) +++ pkg/Rcpp/inst/doc/jss.bst 2013-08-31 19:26:55 UTC (rev 4462) @@ -1,1629 +0,0 @@ -%% -%% This is file `jss.bst', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% merlin.mbs (with options: `ay,nat,nm-rvx,keyxyr,dt-beg,yr-par,note-yr,tit-qq,atit-u,trnum-it,vol-bf,volp-com,num-xser,pre-edn,isbn,issn,edpar,pp,ed,xedn,xand,etal-it,revdata,eprint,url,url-blk,doi,nfss') -%% -%% ** BibTeX style file for JSS publications (http://www.jstatsoft.org/) -%% -%% Copyright 1994-2005 Patrick W Daly -%% License: GPL-2 - % =============================================================== - % IMPORTANT NOTICE: - % This bibliographic style (bst) file has been generated from one or - % more master bibliographic style (mbs) files, listed above, provided - % with kind permission of Patrick W Daly. - % - % This generated file can be redistributed and/or modified under the terms - % of the General Public License (Version 2). - % =============================================================== - % Name and version information of the main mbs file: - % \ProvidesFile{merlin.mbs}[2005/10/17 4.14 (PWD, AO, DPC)] - % For use with BibTeX version 0.99a or later - %------------------------------------------------------------------- - % This bibliography style file is intended for texts in ENGLISH - % This is an author-year citation style bibliography. As such, it is - % non-standard LaTeX, and requires a special package file to function properly. - % Such a package is natbib.sty by Patrick W. Daly - % The form of the \bibitem entries is - % \bibitem[Jones et al.(1990)]{key}... - % \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... - % The essential feature is that the label (the part in brackets) consists - % of the author names, as they should appear in the citation, with the year - % in parentheses following. There must be no space before the opening - % parenthesis! - % With natbib v5.3, a full list of authors may also follow the year. - % In natbib.sty, it is possible to define the type of enclosures that is - % really wanted (brackets or parentheses), but in either case, there must - % be parentheses in the label. - % The \cite command functions as follows: - % \citet{key} ==>> Jones et al. (1990) - % \citet*{key} ==>> Jones, Baker, and Smith (1990) - % \citep{key} ==>> (Jones et al., 1990) - % \citep*{key} ==>> (Jones, Baker, and Smith, 1990) - % \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2) - % \citep[e.g.][]{key} ==>> (e.g. Jones et al., 1990) - % \citep[e.g.][p. 32]{key} ==>> (e.g. Jones et al., p. 32) - % \citeauthor{key} ==>> Jones et al. - % \citeauthor*{key} ==>> Jones, Baker, and Smith - % \citeyear{key} ==>> 1990 - %--------------------------------------------------------------------- - -ENTRY - { address - archive - author - booktitle - chapter - collaboration - doi - edition - editor - eid - eprint - howpublished - institution - isbn - issn - journal - key - month - note - number - numpages - organization - pages - publisher - school - series - title - type - url - volume - year - } - {} - { label extra.label sort.label short.list } -INTEGERS { output.state before.all mid.sentence after.sentence after.block } -FUNCTION {init.state.consts} -{ #0 'before.all := - #1 'mid.sentence := - #2 'after.sentence := - #3 'after.block := -} -STRINGS { s t} -FUNCTION {output.nonnull} -{ 's := - output.state mid.sentence = - { ", " * write$ } - { output.state after.block = - { add.period$ write$ - newline$ - "\newblock " write$ - } - { output.state before.all = - 'write$ - { add.period$ " " * write$ } - if$ - } - if$ - mid.sentence 'output.state := - } - if$ - s -} -FUNCTION {output} -{ duplicate$ empty$ - 'pop$ - 'output.nonnull - if$ -} -FUNCTION {output.check} -{ 't := - duplicate$ empty$ - { pop$ "empty " t * " in " * cite$ * warning$ } - 'output.nonnull - if$ -} -FUNCTION {fin.entry} -{ add.period$ - write$ - newline$ -} - -FUNCTION {new.block} -{ output.state before.all = - 'skip$ - { after.block 'output.state := } - if$ -} -FUNCTION {new.sentence} -{ output.state after.block = - 'skip$ - { output.state before.all = - 'skip$ - { after.sentence 'output.state := } - if$ - } - if$ -} -FUNCTION {add.blank} -{ " " * before.all 'output.state := -} - -FUNCTION {date.block} -{ - new.block -} - -FUNCTION {not} -{ { #0 } - { #1 } - if$ -} -FUNCTION {and} -{ 'skip$ - { pop$ #0 } - if$ -} -FUNCTION {or} -{ { pop$ #1 } - 'skip$ - if$ -} -FUNCTION {non.stop} -{ duplicate$ - "}" * add.period$ - #-1 #1 substring$ "." = -} - -STRINGS {z} -FUNCTION {remove.dots} -{ 'z := - "" - { z empty$ not } - { z #1 #1 substring$ - z #2 global.max$ substring$ 'z := - duplicate$ "." = 'pop$ - { * } - if$ - } - while$ -} -FUNCTION {new.block.checkb} -{ empty$ - swap$ empty$ - and - 'skip$ - 'new.block - if$ -} -FUNCTION {field.or.null} -{ duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ -} -FUNCTION {emphasize} -{ duplicate$ empty$ - { pop$ "" } - { "\emph{" swap$ * "}" * } - if$ -} -FUNCTION {bolden} -{ duplicate$ empty$ - { pop$ "" } - { "\textbf{" swap$ * "}" * } - if$ -} -FUNCTION {tie.or.space.prefix} -{ duplicate$ text.length$ #3 < - { "~" } - { " " } - if$ - swap$ -} - -FUNCTION {capitalize} -{ "u" change.case$ "t" change.case$ } - -FUNCTION {space.word} -{ " " swap$ * " " * } - % Here are the language-specific definitions for explicit words. - % Each function has a name bbl.xxx where xxx is the English word. - % The language selected here is ENGLISH -FUNCTION {bbl.and} -{ "and"} - -FUNCTION {bbl.etal} -{ "et~al." } - -FUNCTION {bbl.editors} -{ "eds." } - -FUNCTION {bbl.editor} -{ "ed." } - -FUNCTION {bbl.edby} -{ "edited by" } - -FUNCTION {bbl.edition} -{ "edition" } - -FUNCTION {bbl.volume} -{ "volume" } - -FUNCTION {bbl.of} -{ "of" } - -FUNCTION {bbl.number} -{ "number" } - -FUNCTION {bbl.nr} -{ "no." } - -FUNCTION {bbl.in} -{ "in" } - -FUNCTION {bbl.pages} -{ "pp." } - -FUNCTION {bbl.page} -{ "p." } - -FUNCTION {bbl.eidpp} -{ "pages" } - -FUNCTION {bbl.chapter} -{ "chapter" } - -FUNCTION {bbl.techrep} -{ "Technical Report" } - -FUNCTION {bbl.mthesis} -{ "Master's thesis" } - -FUNCTION {bbl.phdthesis} -{ "Ph.D. thesis" } - -MACRO {jan} {"January"} - -MACRO {feb} {"February"} - -MACRO {mar} {"March"} - -MACRO {apr} {"April"} - -MACRO {may} {"May"} - -MACRO {jun} {"June"} - -MACRO {jul} {"July"} - -MACRO {aug} {"August"} - -MACRO {sep} {"September"} - -MACRO {oct} {"October"} - -MACRO {nov} {"November"} - -MACRO {dec} {"December"} - -MACRO {acmcs} {"ACM Computing Surveys"} - -MACRO {acta} {"Acta Informatica"} - -MACRO {cacm} {"Communications of the ACM"} - -MACRO {ibmjrd} {"IBM Journal of Research and Development"} - -MACRO {ibmsj} {"IBM Systems Journal"} - -MACRO {ieeese} {"IEEE Transactions on Software Engineering"} - -MACRO {ieeetc} {"IEEE Transactions on Computers"} - -MACRO {ieeetcad} - {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} - -MACRO {ipl} {"Information Processing Letters"} - -MACRO {jacm} {"Journal of the ACM"} - -MACRO {jcss} {"Journal of Computer and System Sciences"} - -MACRO {scp} {"Science of Computer Programming"} - -MACRO {sicomp} {"SIAM Journal on Computing"} - -MACRO {tocs} {"ACM Transactions on Computer Systems"} - -MACRO {tods} {"ACM Transactions on Database Systems"} - -MACRO {tog} {"ACM Transactions on Graphics"} - -MACRO {toms} {"ACM Transactions on Mathematical Software"} - -MACRO {toois} {"ACM Transactions on Office Information Systems"} - -MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} - -MACRO {tcs} {"Theoretical Computer Science"} -FUNCTION {bibinfo.check} -{ swap$ - duplicate$ missing$ - { - pop$ pop$ - "" - } - { duplicate$ empty$ - { - swap$ pop$ - } - { swap$ - pop$ - } - if$ - } - if$ -} -FUNCTION {bibinfo.warn} -{ swap$ - duplicate$ missing$ - { - swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ - "" - } - { duplicate$ empty$ - { - swap$ "empty " swap$ * " in " * cite$ * warning$ - } - { swap$ - pop$ - } - if$ - } - if$ -} -FUNCTION {format.eprint} -{ eprint duplicate$ empty$ - 'skip$ - { "\eprint" - archive empty$ - 'skip$ - { "[" * archive * "]" * } - if$ - "{" * swap$ * "}" * - } - if$ -} -FUNCTION {format.url} -{ url empty$ - { "" } - { "\urlprefix\url{" url * "}" * } - if$ -} - -STRINGS { bibinfo} -INTEGERS { nameptr namesleft numnames } - -FUNCTION {format.names} -{ 'bibinfo := - duplicate$ empty$ 'skip$ { - 's := - "" 't := - #1 'nameptr := - s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr - "{vv~}{ll}{ jj}{ f{}}" - format.name$ - remove.dots - bibinfo bibinfo.check - 't := - nameptr #1 > - { - namesleft #1 > - { ", " * t * } - { - s nameptr "{ll}" format.name$ duplicate$ "others" = - { 't := } - { pop$ } - if$ - "," * - t "others" = - { - " " * bbl.etal emphasize * - } - { " " * t * } - if$ - } - if$ - } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ - } if$ -} -FUNCTION {format.names.ed} -{ - 'bibinfo := - duplicate$ empty$ 'skip$ { - 's := - "" 't := - #1 'nameptr := - s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr - "{f{}~}{vv~}{ll}{ jj}" - format.name$ - remove.dots - bibinfo bibinfo.check - 't := - nameptr #1 > - { - namesleft #1 > - { ", " * t * } - { - s nameptr "{ll}" format.name$ duplicate$ "others" = - { 't := } - { pop$ } - if$ - "," * - t "others" = - { - - " " * bbl.etal emphasize * - } - { " " * t * } - if$ - } - if$ - } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ - } if$ -} -FUNCTION {format.key} -{ empty$ - { key field.or.null } - { "" } - if$ -} - -FUNCTION {format.authors} -{ author "author" format.names - duplicate$ empty$ 'skip$ - { collaboration "collaboration" bibinfo.check - duplicate$ empty$ 'skip$ - { " (" swap$ * ")" * } - if$ - * - } - if$ -} -FUNCTION {get.bbl.editor} -{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ } - -FUNCTION {format.editors} -{ editor "editor" format.names duplicate$ empty$ 'skip$ - { - " " * - get.bbl.editor - "(" swap$ * ")" * - * - } - if$ -} -FUNCTION {format.isbn} -{ isbn "isbn" bibinfo.check - duplicate$ empty$ 'skip$ - { - new.block - "ISBN " swap$ * - } - if$ -} - -FUNCTION {format.issn} -{ issn "issn" bibinfo.check - duplicate$ empty$ 'skip$ - { - new.block - "ISSN " swap$ * - } - if$ -} - -FUNCTION {format.doi} -{ doi "doi" bibinfo.check - duplicate$ empty$ 'skip$ - { - new.block - "\doi{" swap$ * "}" * - } - if$ -} -FUNCTION {format.note} -{ - note empty$ - { "" } - { note #1 #1 substring$ - duplicate$ "{" = - 'skip$ - { output.state mid.sentence = - { "l" } - { "u" } - if$ - change.case$ - } - if$ - note #2 global.max$ substring$ * "note" bibinfo.check - } - if$ -} - -FUNCTION {format.title} -{ title - "title" bibinfo.check - duplicate$ empty$ 'skip$ - { - "\enquote{" swap$ * - add.period$ "}" * - } - if$ -} -FUNCTION {format.full.names} -{'s := - "" 't := - #1 'nameptr := - s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr - "{vv~}{ll}" format.name$ - 't := - nameptr #1 > - { - namesleft #1 > - { ", " * t * } - { - s nameptr "{ll}" format.name$ duplicate$ "others" = - { 't := } - { pop$ } - if$ - t "others" = - { - " " * bbl.etal emphasize * - } - { - numnames #2 > - { "," * } - 'skip$ - if$ - bbl.and - space.word * t * - } - if$ - } - if$ - } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ -} - -FUNCTION {author.editor.key.full} -{ author empty$ - { editor empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.full.names } - if$ - } - { author format.full.names } - if$ -} - -FUNCTION {author.key.full} -{ author empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { author format.full.names } - if$ -} - -FUNCTION {editor.key.full} -{ editor empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.full.names } - if$ -} - -FUNCTION {make.full.names} -{ type$ "book" = - type$ "inbook" = - or - 'author.editor.key.full - { type$ "proceedings" = - 'editor.key.full - 'author.key.full - if$ - } - if$ -} - -FUNCTION {output.bibitem} -{ newline$ - "\bibitem[{" write$ - label write$ - ")" make.full.names duplicate$ short.list = - { pop$ } - { * } - if$ - "}]{" * write$ - cite$ write$ - "}" write$ - newline$ - "" - before.all 'output.state := -} - -FUNCTION {n.dashify} -{ - 't := - "" - { t empty$ not } - { t #1 #1 substring$ "-" = - { t #1 #2 substring$ "--" = not - { "--" * - t #2 global.max$ substring$ 't := - } - { { t #1 #1 substring$ "-" = } - { "-" * - t #2 global.max$ substring$ 't := - } - while$ - } - if$ - } - { t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ -} - -FUNCTION {word.in} -{ bbl.in capitalize - " " * } - -FUNCTION {format.date} -{ year "year" bibinfo.check duplicate$ empty$ - { - "empty year in " cite$ * "; set to ????" * warning$ - pop$ "????" - } - 'skip$ - if$ - extra.label * - before.all 'output.state := - " (" swap$ * ")" * -} -FUNCTION {format.btitle} -{ title "title" bibinfo.check - duplicate$ empty$ 'skip$ - { - emphasize - } - if$ -} -FUNCTION {either.or.check} -{ empty$ - 'pop$ - { "can't use both " swap$ * " fields in " * cite$ * warning$ } - if$ -} -FUNCTION {format.bvolume} -{ volume empty$ - { "" } - { bbl.volume volume tie.or.space.prefix - "volume" bibinfo.check * * - series "series" bibinfo.check - duplicate$ empty$ 'pop$ - { swap$ bbl.of space.word * swap$ - emphasize * } - if$ - "volume and number" number either.or.check - } - if$ -} -FUNCTION {format.number.series} -{ volume empty$ - { number empty$ - { series field.or.null } - { series empty$ - { number "number" bibinfo.check } - { output.state mid.sentence = - { bbl.number } - { bbl.number capitalize } - if$ - number tie.or.space.prefix "number" bibinfo.check * * - bbl.in space.word * - series "series" bibinfo.check * - } - if$ - } - if$ - } - { "" } - if$ -} - -FUNCTION {format.edition} -{ edition duplicate$ empty$ 'skip$ - { - output.state mid.sentence = - { "l" } - { "t" } - if$ change.case$ - "edition" bibinfo.check - " " * bbl.edition * - } - if$ -} -INTEGERS { multiresult } -FUNCTION {multi.page.check} -{ 't := - #0 'multiresult := - { multiresult not - t empty$ not - and - } - { t #1 #1 substring$ - duplicate$ "-" = - swap$ duplicate$ "," = - swap$ "+" = - or or - { #1 'multiresult := } - { t #2 global.max$ substring$ 't := } - if$ - } - while$ - multiresult -} -FUNCTION {format.pages} -{ pages duplicate$ empty$ 'skip$ - { duplicate$ multi.page.check - { - bbl.pages swap$ - n.dashify - } - { - bbl.page swap$ - } - if$ - tie.or.space.prefix - "pages" bibinfo.check - * * - } - if$ -} -FUNCTION {format.journal.pages} -{ pages duplicate$ empty$ 'pop$ - { swap$ duplicate$ empty$ - { pop$ pop$ format.pages } - { - ", " * - swap$ - n.dashify - "pages" bibinfo.check - * - } - if$ - } - if$ -} -FUNCTION {format.journal.eid} -{ eid "eid" bibinfo.check - duplicate$ empty$ 'pop$ - { swap$ duplicate$ empty$ 'skip$ - { - ", " * - } - if$ - swap$ * - numpages empty$ 'skip$ - { bbl.eidpp numpages tie.or.space.prefix - "numpages" bibinfo.check * * - " (" swap$ * ")" * * - } - if$ - } - if$ -} -FUNCTION {format.vol.num.pages} -{ volume field.or.null - duplicate$ empty$ 'skip$ - { - "volume" bibinfo.check - } - if$ - bolden - number "number" bibinfo.check duplicate$ empty$ 'skip$ - { - swap$ duplicate$ empty$ - { "there's a number but no volume in " cite$ * warning$ } - 'skip$ - if$ - swap$ - "(" swap$ * ")" * - } - if$ * - eid empty$ - { format.journal.pages } - { format.journal.eid } - if$ -} - -FUNCTION {format.chapter.pages} -{ chapter empty$ - 'format.pages - { type empty$ - { bbl.chapter } - { type "l" change.case$ - "type" bibinfo.check - } - if$ - chapter tie.or.space.prefix - "chapter" bibinfo.check - * * - pages empty$ - 'skip$ - { ", " * format.pages * } - if$ - } - if$ -} - -FUNCTION {format.booktitle} -{ - booktitle "booktitle" bibinfo.check - emphasize -} -FUNCTION {format.in.ed.booktitle} -{ format.booktitle duplicate$ empty$ 'skip$ - { - editor "editor" format.names.ed duplicate$ empty$ 'pop$ - { - " " * - get.bbl.editor - "(" swap$ * "), " * - * swap$ - * } - if$ - word.in swap$ * - } - if$ -} -FUNCTION {format.thesis.type} -{ type duplicate$ empty$ - 'pop$ - { swap$ pop$ - "t" change.case$ "type" bibinfo.check - } - if$ -} -FUNCTION {format.tr.number} -{ number "number" bibinfo.check - type duplicate$ empty$ - { pop$ bbl.techrep } - 'skip$ - if$ - "type" bibinfo.check - swap$ duplicate$ empty$ - { pop$ "t" change.case$ } - { tie.or.space.prefix * * } - if$ -} -FUNCTION {format.article.crossref} -{ - word.in - " \cite{" * crossref * "}" * -} -FUNCTION {format.book.crossref} -{ volume duplicate$ empty$ - { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - pop$ word.in - } - { bbl.volume - capitalize - swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of space.word * - } - if$ - " \cite{" * crossref * "}" * -} -FUNCTION {format.incoll.inproc.crossref} -{ - word.in - " \cite{" * crossref * "}" * -} -FUNCTION {format.org.or.pub} -{ 't := - "" - address empty$ t empty$ and - 'skip$ - { - t empty$ - { address "address" bibinfo.check * - } - { t * - address empty$ - 'skip$ - { ", " * address "address" bibinfo.check * } - if$ - } - if$ - } - if$ -} -FUNCTION {format.publisher.address} -{ publisher "publisher" bibinfo.warn format.org.or.pub -} - -FUNCTION {format.organization.address} -{ organization "organization" bibinfo.check format.org.or.pub -} - -FUNCTION {article} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.title "title" output.check - new.block - crossref missing$ - { - journal - "journal" bibinfo.check - emphasize - "journal" output.check - format.vol.num.pages output - } - { format.article.crossref output.nonnull - format.pages output - } - if$ - format.issn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} -FUNCTION {book} -{ output.bibitem - author empty$ - { format.editors "author and editor" output.check - editor format.key output - } - { format.authors output.nonnull - crossref missing$ - { "author and editor" editor either.or.check } - 'skip$ - if$ - } - if$ - format.date "year" output.check - date.block - format.btitle "title" output.check - crossref missing$ - { format.bvolume output - new.block - format.number.series output - format.edition output - new.sentence - format.publisher.address output - } - { - new.block - format.book.crossref output.nonnull - } - if$ - format.isbn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} -FUNCTION {booklet} -{ output.bibitem - format.authors output - author format.key output - format.date "year" output.check - date.block - format.title "title" output.check - new.block - howpublished "howpublished" bibinfo.check output - address "address" bibinfo.check output - format.isbn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {inbook} -{ output.bibitem - author empty$ - { format.editors "author and editor" output.check - editor format.key output - } - { format.authors output.nonnull - crossref missing$ - { "author and editor" editor either.or.check } - 'skip$ - if$ - } - if$ - format.date "year" output.check - date.block - format.btitle "title" output.check - crossref missing$ - { - format.bvolume output - format.chapter.pages "chapter and pages" output.check - new.block - format.number.series output - format.edition output - new.sentence - format.publisher.address output - } - { - format.chapter.pages "chapter and pages" output.check - new.block - format.book.crossref output.nonnull - } - if$ - crossref missing$ - { format.isbn output } - 'skip$ - if$ - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {incollection} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.title "title" output.check - new.block - crossref missing$ - { format.in.ed.booktitle "booktitle" output.check - format.bvolume output - format.number.series output - format.edition output - format.chapter.pages output - new.sentence - format.publisher.address output - format.isbn output - } - { format.incoll.inproc.crossref output.nonnull - format.chapter.pages output - } - if$ - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} -FUNCTION {inproceedings} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.title "title" output.check - new.block - crossref missing$ - { format.in.ed.booktitle "booktitle" output.check - format.bvolume output - format.number.series output - format.pages output - new.sentence - publisher empty$ - { format.organization.address output } - { organization "organization" bibinfo.check output - format.publisher.address output - } - if$ - format.isbn output - format.issn output - } - { format.incoll.inproc.crossref output.nonnull - format.pages output - } - if$ - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} -FUNCTION {conference} { inproceedings } -FUNCTION {manual} -{ output.bibitem - format.authors output - author format.key output - format.date "year" output.check - date.block - format.btitle "title" output.check - organization address new.block.checkb - organization "organization" bibinfo.check output - address "address" bibinfo.check output - format.edition output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {mastersthesis} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.btitle - "title" output.check - new.block - bbl.mthesis format.thesis.type output.nonnull - school "school" bibinfo.warn output - address "address" bibinfo.check output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {misc} -{ output.bibitem - format.authors output - author format.key output - format.date "year" output.check - date.block - format.title output - new.block - howpublished "howpublished" bibinfo.check output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} -FUNCTION {phdthesis} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.btitle - "title" output.check - new.block - bbl.phdthesis format.thesis.type output.nonnull - school "school" bibinfo.warn output - address "address" bibinfo.check output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {proceedings} -{ output.bibitem - format.editors output - editor format.key output - format.date "year" output.check - date.block - format.btitle "title" output.check - format.bvolume output - format.number.series output - new.sentence - publisher empty$ - { format.organization.address output } - { organization "organization" bibinfo.check output - format.publisher.address output - } - if$ - format.isbn output - format.issn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {techreport} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.title - "title" output.check - new.block - format.tr.number emphasize output.nonnull - institution "institution" bibinfo.warn output - address "address" bibinfo.check output - format.doi output - new.block - format.note output - format.eprint output - format.url output - fin.entry -} - -FUNCTION {unpublished} -{ output.bibitem - format.authors "author" output.check - author format.key output - format.date "year" output.check - date.block - format.title "title" output.check - format.doi output - new.block - format.note "note" output.check - format.eprint output - format.url output - fin.entry -} - -FUNCTION {default.type} { misc } -READ -FUNCTION {sortify} -{ purify$ - "l" change.case$ -} -INTEGERS { len } -FUNCTION {chop.word} -{ 's := - 'len := - s #1 len substring$ = - { s len #1 + global.max$ substring$ } - 's - if$ -} -FUNCTION {format.lab.names} -{ 's := - "" 't := - s #1 "{vv~}{ll}" format.name$ - s num.names$ duplicate$ - #2 > - { pop$ - " " * bbl.etal emphasize * - } - { #2 < - 'skip$ - { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = - { - " " * bbl.etal emphasize * - } - { bbl.and space.word * s #2 "{vv~}{ll}" format.name$ - * } - if$ - } - if$ - } - if$ -} - -FUNCTION {author.key.label} -{ author empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { author format.lab.names } - if$ -} - -FUNCTION {author.editor.key.label} -{ author empty$ - { editor empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.lab.names } - if$ - } - { author format.lab.names } - if$ -} - -FUNCTION {editor.key.label} -{ editor empty$ - { key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.lab.names } - if$ -} - -FUNCTION {calc.short.authors} -{ type$ "book" = - type$ "inbook" = - or - 'author.editor.key.label - { type$ "proceedings" = - 'editor.key.label - 'author.key.label - if$ - } - if$ - 'short.list := -} - -FUNCTION {calc.label} -{ calc.short.authors - short.list - "(" - * - year duplicate$ empty$ - short.list key field.or.null = or - { pop$ "" } - 'skip$ - if$ - * - 'label := -} - -FUNCTION {sort.format.names} -{ 's := - #1 'nameptr := - "" - s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr - "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" - format.name$ 't := - nameptr #1 > - { - " " * - namesleft #1 = t "others" = and - { "zzzzz" * } - { t sortify * } - if$ - } - { t sortify * } - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ -} - -FUNCTION {sort.format.title} -{ 't := - "A " #2 - "An " #3 - "The " #4 t chop.word - chop.word - chop.word - sortify - #1 global.max$ substring$ -} -FUNCTION {author.sort} -{ author empty$ - { key empty$ - { "to sort, need author or key in " cite$ * warning$ - "" - } - { key sortify } - if$ - } - { author sort.format.names } - if$ -} -FUNCTION {author.editor.sort} -{ author empty$ - { editor empty$ - { key empty$ - { "to sort, need author, editor, or key in " cite$ * warning$ - "" - } - { key sortify } - if$ - } - { editor sort.format.names } - if$ - } - { author sort.format.names } - if$ -} -FUNCTION {editor.sort} -{ editor empty$ - { key empty$ - { "to sort, need editor or key in " cite$ * warning$ - "" - } - { key sortify } - if$ - } - { editor sort.format.names } - if$ -} -FUNCTION {presort} -{ calc.label - label sortify - " " - * - type$ "book" = - type$ "inbook" = - or - 'author.editor.sort - { type$ "proceedings" = - 'editor.sort - 'author.sort - if$ - } - if$ - #1 entry.max$ substring$ - 'sort.label := - sort.label - * - " " - * - title field.or.null - sort.format.title - * - #1 entry.max$ substring$ - 'sort.key$ := -} - [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4462 From noreply at r-forge.r-project.org Sat Aug 31 21:28:42 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:28:42 +0200 (CEST) Subject: [Rcpp-commits] r4463 - pkg/Rcpp/inst/doc Message-ID: <20130831192842.D1AE7184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:28:42 +0200 (Sat, 31 Aug 2013) New Revision: 4463 Removed: pkg/Rcpp/inst/doc/Rcpp-FAQ/ pkg/Rcpp/inst/doc/Rcpp-attributes/ pkg/Rcpp/inst/doc/Rcpp-extending/ pkg/Rcpp/inst/doc/Rcpp-modules/ pkg/Rcpp/inst/doc/Rcpp-package/ pkg/Rcpp/inst/doc/Rcpp-quickref/ pkg/Rcpp/inst/doc/Rcpp-sugar/ Log: removing empty directories From noreply at r-forge.r-project.org Sat Aug 31 21:29:29 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:29:29 +0200 (CEST) Subject: [Rcpp-commits] r4464 - pkg/Rcpp/inst/doc Message-ID: <20130831192929.9DA01184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:29:29 +0200 (Sat, 31 Aug 2013) New Revision: 4464 Removed: pkg/Rcpp/inst/doc/notyet/ Log: deleting too From noreply at r-forge.r-project.org Sat Aug 31 21:31:51 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 21:31:51 +0200 (CEST) Subject: [Rcpp-commits] r4465 - pkg/Rcpp Message-ID: <20130831193151.14B5D184BDE@r-forge.r-project.org> Author: edd Date: 2013-08-31 21:31:50 +0200 (Sat, 31 Aug 2013) New Revision: 4465 Modified: pkg/Rcpp/cleanup Log: also clean bibtex files Modified: pkg/Rcpp/cleanup =================================================================== --- pkg/Rcpp/cleanup 2013-08-31 19:29:29 UTC (rev 4464) +++ pkg/Rcpp/cleanup 2013-08-31 19:31:50 UTC (rev 4465) @@ -1,5 +1,5 @@ -cd inst/doc && rm -f index.html *.tex *.bbl *.blg *.aux *.out *.log && cd - +#cd inst/doc && rm -f index.html *.tex *.bbl *.blg *.aux *.out *.log && cd - rm -f confdefs.h config.log config.status \ src/*.o src/*.so src/*.a src/*.d src/*.dll src/*.rc \ @@ -26,7 +26,7 @@ src/symbols.rds \ inst/unitTests/testRcppClass/src/symbols.rds \ vignettes/*.aux vignettes/*.log vignettes/*.out \ - vignettes/*.tex + vignettes/*.tex vignettes/*.bbl vignettes/*.blg rm -rf autom4te.cache inst/lib/ inst/doc/man/ inst/doc/html/ inst/doc/latex/ \ inst/doc/auto inst/doc/Rcpp-*/auto/ src-* vignettes/auto From noreply at r-forge.r-project.org Sat Aug 31 22:58:24 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 22:58:24 +0200 (CEST) Subject: [Rcpp-commits] r4466 - pkg/Rcpp/vignettes Message-ID: <20130831205824.4782B185F03@r-forge.r-project.org> Author: edd Date: 2013-08-31 22:58:23 +0200 (Sat, 31 Aug 2013) New Revision: 4466 Modified: pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw Log: disabled one R chunk as it requires RcppArmadillo (which would be another suggests for the Rcpp package as vignettes are tested by R CMD check) Modified: pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-08-31 19:31:50 UTC (rev 4465) +++ pkg/Rcpp/vignettes/Rcpp-FAQ.Rnw 2013-08-31 20:58:23 UTC (rev 4466) @@ -472,7 +472,9 @@ external_highlight( "myfile.cpp", type = "LATEX", doc = FALSE ) @ -<<>>= +%% Running this now makes the package depend on RcppArmadillo being installed +%% and would require at least a Suggests +<>= fx <- cxxfunction( signature(x_ = "numeric", Y_ = "matrix", z_ = "numeric" ), paste( readLines( "myfile.cpp" ), collapse = "\n" ), From noreply at r-forge.r-project.org Sat Aug 31 22:59:07 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 22:59:07 +0200 (CEST) Subject: [Rcpp-commits] r4467 - pkg/Rcpp/vignettes Message-ID: <20130831205907.E951B185F03@r-forge.r-project.org> Author: edd Date: 2013-08-31 22:59:07 +0200 (Sat, 31 Aug 2013) New Revision: 4467 Modified: pkg/Rcpp/vignettes/Rcpp-attributes.Rnw Log: comment out some by not all highlight definitions which are now also pulled in via the highlight driver Modified: pkg/Rcpp/vignettes/Rcpp-attributes.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-08-31 20:58:23 UTC (rev 4466) +++ pkg/Rcpp/vignettes/Rcpp-attributes.Rnw 2013-08-31 20:59:07 UTC (rev 4467) @@ -31,26 +31,26 @@ \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}} -%% highlights macros -%% Style definition file generated by highlight 2.7, http://www.andre-simon.de/ -% Highlighting theme definition: -\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlnum}[1]{\textcolor[rgb]{0,0,0}{#1}} +%% %% highlights macros +%% %% Style definition file generated by highlight 2.7, http://www.andre-simon.de/ +%% % Highlighting theme definition: +%% \newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}} +%% \newcommand{\hlnum}[1]{\textcolor[rgb]{0,0,0}{#1}} \newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlesc}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -%\newcommand{\hlstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -\newcommand{\hlstr}[1]{\textcolor[rgb]{0.90,0.15,0.15}{#1}} -%green: \newcommand{\hlstr}[1]{\textcolor[rgb]{0.13,0.67,0.13}{#1}} % 0.74 -> % 0.90; 0.55 -> 0.25 -\newcommand{\hldstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} -\newcommand{\hlslc}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} -\newcommand{\hlcom}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} -\newcommand{\hldir}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlsym}[1]{\textcolor[rgb]{0,0,0}{#1}} -\newcommand{\hlline}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}} -\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.61,0.13,0.93}{\bf{#1}}} -\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.13,0.54,0.13}{#1}} -\newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,1}{#1}} -\newcommand{\hlkwd}[1]{\textcolor[rgb]{0,0,0}{#1}} +%% \newcommand{\hlesc}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} +%% %\newcommand{\hlstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} +%% \newcommand{\hlstr}[1]{\textcolor[rgb]{0.90,0.15,0.15}{#1}} +%% %green: \newcommand{\hlstr}[1]{\textcolor[rgb]{0.13,0.67,0.13}{#1}} % 0.74 -> % 0.90; 0.55 -> 0.25 +%% \newcommand{\hldstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}} +%% \newcommand{\hlslc}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} +%% \newcommand{\hlcom}[1]{\textcolor[rgb]{0.67,0.13,0.13}{#1}} +%% \newcommand{\hldir}[1]{\textcolor[rgb]{0,0,0}{#1}} +%% \newcommand{\hlsym}[1]{\textcolor[rgb]{0,0,0}{#1}} +%% \newcommand{\hlline}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}} +%% \newcommand{\hlkwa}[1]{\textcolor[rgb]{0.61,0.13,0.93}{\bf{#1}}} +%% \newcommand{\hlkwb}[1]{\textcolor[rgb]{0.13,0.54,0.13}{#1}} +%% \newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,1}{#1}} +%% \newcommand{\hlkwd}[1]{\textcolor[rgb]{0,0,0}{#1}} \definecolor{bgcolor}{rgb}{1,1,1} \newcommand{\hlppc}[1]{\textcolor[rgb]{0,0.51,0}{#1}} @@ -84,7 +84,7 @@ functions as callable from \proglang{R} and automatically generating the code required to invoke them. Attributes are intended to facilitate both interactive use of \proglang{C++} within \proglang{R} sessions as well as to support \proglang{R} - package development. The implementation of attributes is based on previous + package development. The implementation of attributes is based on previous work in the \pkg{inline} package \citep{CRAN:inline}. } @@ -128,12 +128,12 @@ Attributes can also be used for package development via the \texttt{compileAttributes} function, which automatically generates -\texttt{extern "C"} and \texttt{.Call} wrappers for \proglang{C++} +\texttt{extern "C"} and \texttt{.Call} wrappers for \proglang{C++} functions within pacakges. \section{Using Attributes} -Attributes are annotations that are added to C++ source files to provide +Attributes are annotations that are added to C++ source files to provide additional information to the compiler. \pkg{Rcpp} supports attributes to indicate that C++ functions should be made available as R functions, as well as to optionally specify additional build dependencies for source files. @@ -219,7 +219,7 @@ We can now write \proglang{C++} functions using built-in \proglang{C++} types and \pkg{Rcpp} wrapper types and then source them just as we would an -\proglang{R} script. +\proglang{R} script. The \texttt{sourceCpp} function performs caching based on the last modified date of the source file so as long as the source file does not @@ -233,7 +233,7 @@ % \begin{verbatim} % DataFrame readData( -% CharacterVector file, +% CharacterVector file, % CharacterVector colNames = CharacterVector::create(), % std::string commentChar = "#", % bool header = true) @@ -265,7 +265,7 @@ \normalsize \end{kframe} -Note that C++ rules for default arguments still apply: they must occur +Note that C++ rules for default arguments still apply: they must occur consecutively at the end of the function signature and (unlike R) can't rely on the values of other arguments. @@ -275,18 +275,18 @@ \begin{itemize} \item String literals delimited by quotes (e.g. \texttt{"foo"}) -\item +\item Decimal numeric values (e.g. \texttt{10} or \texttt{4.5}) \item - Pre-defined constants including \texttt{true}, \texttt{false}, + Pre-defined constants including \texttt{true}, \texttt{false}, \texttt{R\_NilValue}, \texttt{NA\_STRING}, \texttt{NA\_INTEGER}, \texttt{NA\_REAL}, and \texttt{NA\_LOGICAL}. \item - Selected vector types (\texttt{CharacterVector}, \texttt{IntegerVector}, + Selected vector types (\texttt{CharacterVector}, \texttt{IntegerVector}, and \texttt{NumericVector}) instantiated using the \texttt{::create} static member function. -\item - \texttt{Matrix} types instantiated using the \texttt{rows}, +\item + \texttt{Matrix} types instantiated using the \texttt{rows}, \texttt{cols} constructor. \end{itemize} @@ -344,15 +344,15 @@ a common source file that can be executed using single call to \texttt{sourceCpp}. To embed chunks of \proglang{R} code within a \proglang{C++} -source file you include the \proglang{R} code within a block comment that +source file you include the \proglang{R} code within a block comment that has the prefix of \texttt{/*** R}. For example: % \begin{verbatim} % /*** R -% +% % # Call the fibonacci function defined in C++ % fibonacci(10) -% +% % */ % \end{verbatim} \begin{kframe} @@ -378,7 +378,7 @@ \subsection{Modifying Function Names} You can change the name of an exported function as it appears to \proglang{R} by -adding a name parameter to \texttt{Rcpp::export}. For example: +adding a name parameter to \texttt{Rcpp::export}. For example: % \begin{verbatim} % // [[Rcpp::export(".convolveCpp")]] @@ -395,7 +395,7 @@ \end{kframe} Note that in this case since the specified name is prefaced by a \code{.} the exported R -function will be hidden. +function will be hidden. \subsection{Function Requirements} @@ -407,24 +407,24 @@ Be defined in the global namespace (i.e. not within a C++ namespace declaration) \item Have a return type that is either void or compatible with \texttt{Rcpp::wrap} - and parameter types that are compatible with \texttt{Rcpp::as} (see sections + and parameter types that are compatible with \texttt{Rcpp::as} (see sections 3.1 and 3.2 of the `\textsl{Rcpp-introduction}' vignette for more details). \item Use fully qualified type names for the return value and all parameters. - Rcpp types may however appear without a namespace qualifier (i.e. + Rcpp types may however appear without a namespace qualifier (i.e. \texttt{DataFrame} is okay as a type name but \texttt{std::string} must be - specified fully). + specified fully). \end{itemize} \subsection{Random Number Generation} \proglang{R} functions implemented in \proglang{C} or \proglang{C++} need -to be careful to surround use of internal random number geneneration routines -(e.g. \texttt{unif\_rand}) with calls to \texttt{GetRNGstate} and -\texttt{PutRNGstate}. +to be careful to surround use of internal random number geneneration routines +(e.g. \texttt{unif\_rand}) with calls to \texttt{GetRNGstate} and +\texttt{PutRNGstate}. -Within \pkg{Rcpp}, this is typically done using the \texttt{RNGScope} class. -However, this is not necessary for \proglang{C++} functions exported using +Within \pkg{Rcpp}, this is typically done using the \texttt{RNGScope} class. +However, this is not necessary for \proglang{C++} functions exported using attributes because an \texttt{RNGScope} is established for them automatically. Note that \pkg{Rcpp} implements \texttt{RNGScope} using a counter, so it's still safe to execute code that may establish it's own \texttt{RNGScope} (such @@ -517,7 +517,7 @@ Note that while the \texttt{Rcpp::depends} attribute establishes dependencies for \texttt{sourceCpp}, it's important to note that if you include the same -source file in an \proglang{R} package these dependencies must still be +source file in an \proglang{R} package these dependencies must still be listed in the \texttt{Depends} and \texttt{LinkingTo} fields of the package \texttt{DESCRIPTION} file. @@ -527,10 +527,10 @@ Maintaining C++ code in it's own source file provides several benefits including the ability to use \proglang{C++} aware text-editing tools and straightforward mapping of compilation errors to lines in the source file. However, it's also -possible to do inline declaration and execution of C++ code. +possible to do inline declaration and execution of C++ code. There are several ways to accomplish this, including passing a code -string to \texttt{sourceCpp} or using the shorter-form \texttt{cppFunction} +string to \texttt{sourceCpp} or using the shorter-form \texttt{cppFunction} or \texttt{evalCpp} functions. For example: % \begin{verbatim} @@ -600,11 +600,11 @@ \subsection{Package Creation} -To create a package that is based on \pkg{Rcpp} you should follow the +To create a package that is based on \pkg{Rcpp} you should follow the guidelines in the `\textsl{Rcpp-package}' vignette. For a new package this is most conveniently done using the \texttt{Rcpp.package.skeleton} function. -To generate a new package with a simple hello, world function that uses +To generate a new package with a simple hello, world function that uses attributes you can do the following: % \begin{verbatim} @@ -641,7 +641,7 @@ Once you've migrated \proglang{C++} code into a package, the dependencies for source files are derived from the \texttt{Depends} and \texttt{LinkingTo} fields in the package \texttt{DESCRIPTION} file rather than the \texttt{Rcpp::depends} -attribute. For every package you import C++ code from (including \pkg{Rcpp}) +attribute. For every package you import C++ code from (including \pkg{Rcpp}) you need to add these entries. For example, if your package depends on \pkg{Rcpp} and \pkg{RcppArmadillo} @@ -664,7 +664,7 @@ \subsection{Exporting R Functions} Within interactive sessions you call the \texttt{sourceCpp} function -on individual files to export \proglang{C++} functions into the global +on individual files to export \proglang{C++} functions into the global environment. However, for packages you call a single utility function to export all \proglang{C++} functions within the package. @@ -696,13 +696,13 @@ the \texttt{extern "C"} functions defined in \texttt{RcppExports.cpp}. \end{itemize} -You should re-run \texttt{compileAttributes} whenever functions are added, +You should re-run \texttt{compileAttributes} whenever functions are added, removed, or have their signatures changed. The \texttt{compileAttributes} function deals only with exporting -\proglang{C++} functions to \proglang{R}. If you want the functions to -additionally be publicly available from your package's namespace another -step may be required. Specifically, if your package \texttt{NAMESPACE} file +\proglang{C++} functions to \proglang{R}. If you want the functions to +additionally be publicly available from your package's namespace another +step may be required. Specifically, if your package \texttt{NAMESPACE} file does not use a pattern to export functions then you should add an explicit entry to \texttt{NAMESPACE} for each R function you want publicly available. @@ -767,10 +767,10 @@ \proglang{R} functions. However, the \proglang{R} package system also provides a mechanism to allow the exporting of \proglang{C} and \proglang{C++} interfaces using package header files. This is based on the -\texttt{R\_RegisterCCallable} and \texttt{R\_GetCCallable} functions described in +\texttt{R\_RegisterCCallable} and \texttt{R\_GetCCallable} functions described in `\textsl{Writing R Extensions}' \citep{R:Extensions}. -\proglang{C++} interfaces to a package are published within the +\proglang{C++} interfaces to a package are published within the top level \texttt{include} directory of the package (which within the package source directory is located at \texttt{inst/include}). The \proglang{R} build system automatically adds the required \texttt{include} directories for all @@ -779,12 +779,12 @@ \subsubsection{Interfaces Attribute} -The \texttt{Rcpp::interfaces} attribute can be used to automatically +The \texttt{Rcpp::interfaces} attribute can be used to automatically generate a header-only interface to your \proglang{C++} functions within the \texttt{include} directory of your package. The \texttt{Rcpp::interfaces} attribute is specified on a per-source -file basis, and indicates which interfaces (\proglang{R}, \proglang{C++}, +file basis, and indicates which interfaces (\proglang{R}, \proglang{C++}, or both) should be provided for exported functions within the file. For example, the following specifies that both R and \proglang{C++} interfaces @@ -809,7 +809,7 @@ \subsubsection{Generated Code} If you request a \texttt{cpp} interface for a source file then -\texttt{compileAttributes} generates the following header files +\texttt{compileAttributes} generates the following header files (substituting \emph{Package} with the name of the package code is being generated for): @@ -827,14 +827,14 @@ \normalsize \end{kframe} -The \texttt{Package\_RcppExports.h} file has inline definitions for all +The \texttt{Package\_RcppExports.h} file has inline definitions for all exported \proglang{C++} functions that enable calling them using the -\texttt{R\_GetCCallable} mechanism. +\texttt{R\_GetCCallable} mechanism. The \texttt{Package.h} file does nothing other than include the -\texttt{Package\_RcppExports.h} header. This is done so +\texttt{Package\_RcppExports.h} header. This is done so that package authors can replace the \texttt{Package.h} header with -a custom one and still be able to include the automatically generated exports +a custom one and still be able to include the automatically generated exports (details on doing this are provided in the next section). The exported functions are defined within a \proglang{C++} namespace that matches @@ -869,23 +869,23 @@ \subsubsection{Including Additional Code} You might wish to use the \texttt{Rcpp::interfaces} attribute to generate -a part of your package's \proglang{C++} interface but also provide -additional custom \proglang{C++} code. In this case you -should replace the generated \texttt{Package.h} file with one of your own. +a part of your package's \proglang{C++} interface but also provide +additional custom \proglang{C++} code. In this case you +should replace the generated \texttt{Package.h} file with one of your own. Note that the way \pkg{Rcpp} distinguishes user verses generated files is by checking for the presence a special token in the file (if it's present then it's known to be generated and thus safe to overwrite). You'll see this token at the top -of the generated \texttt{Package.h} file, be sure to remove it if you want +of the generated \texttt{Package.h} file, be sure to remove it if you want to provide a custom header. -Once you've established a custom package header file, you need only include the -\texttt{Package\_RcppExports.h} file within your header to make available +Once you've established a custom package header file, you need only include the +\texttt{Package\_RcppExports.h} file within your header to make available the automatically generated code alongside your own. -If you need to include code from your custom header files within the +If you need to include code from your custom header files within the compilation of your package source files, you will also need to add the -following entry to \texttt{Makevars} and \texttt{Makevars.win} (both are +following entry to \texttt{Makevars} and \texttt{Makevars.win} (both are in the \texttt{src} directory of your package): % \begin{verbatim} From noreply at r-forge.r-project.org Sat Aug 31 23:13:14 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 23:13:14 +0200 (CEST) Subject: [Rcpp-commits] r4468 - in pkg/Rcpp/vignettes: . notyet Message-ID: <20130831211314.5068F185C4B@r-forge.r-project.org> Author: edd Date: 2013-08-31 23:13:14 +0200 (Sat, 31 Aug 2013) New Revision: 4468 Added: pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw Removed: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw Log: hide currently broken unittests Deleted: pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw =================================================================== --- pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-08-31 20:59:07 UTC (rev 4467) +++ pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw 2013-08-31 21:13:14 UTC (rev 4468) @@ -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} Copied: pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw (from rev 4453, pkg/Rcpp/vignettes/Rcpp-unitTests.Rnw) =================================================================== --- pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw (rev 0) +++ pkg/Rcpp/vignettes/notyet/Rcpp-unitTests.Rnw 2013-08-31 21:13:14 UTC (rev 4468) @@ -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} From noreply at r-forge.r-project.org Sat Aug 31 23:27:50 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 31 Aug 2013 23:27:50 +0200 (CEST) Subject: [Rcpp-commits] r4469 - in pkg/Rcpp: . inst Message-ID: <20130831212750.450BC185C4B@r-forge.r-project.org> Author: edd Date: 2013-08-31 23:27:49 +0200 (Sat, 31 Aug 2013) New Revision: 4469 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/inst/NEWS.Rd Log: document vignette work Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-08-31 21:13:14 UTC (rev 4468) +++ pkg/Rcpp/ChangeLog 2013-08-31 21:27:49 UTC (rev 4469) @@ -1,27 +1,35 @@ +2013-08-31 Dirk Eddelbuettel + + * inst/doc/*: Moved all vignettes to vignettes/* + * vignettes/*: Minor updates to some vignettes + 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 compare it - to r_type_primitive_tag - * include/Rcpp/traits/r_type_traits.h : new tag r_type_pair_tag to handle - wrapping map where KEY can be converted to String and VALUE - can wrap itself + * 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 + compare it to r_type_primitive_tag + * include/Rcpp/traits/r_type_traits.h : new tag r_type_pair_tag to + handle wrapping map where KEY can be converted to String + and VALUE can wrap itself * include/Rcpp/internal/wrap.h : handling map and vector where T is a class handled by modules - * include/Rcpp/api/meat/wrap.h : implementations to handle map - * unitTests/cpp/wrap.cpp : more tests for map with KEY not a string - * unitTests/runit.wrap.R : more tests for map with KEY not a string - - * include/Rcpp/internal/export.h : added export_range__dispatch for the - r_type_generic_tag tag. Meaning we can now use as< vector > where - T is not a primitive + * include/Rcpp/api/meat/wrap.h : implementations to handle map + * unitTests/cpp/wrap.cpp : more tests for map with KEY + not a string + * unitTests/runit.wrap.R : more tests for map with KEY + not a string + + * include/Rcpp/internal/export.h : added export_range__dispatch for + the r_type_generic_tag tag. Meaning we can now use as< vector > + where T is not a primitive * include/Rcpp/api/meat/export.h : implementation in meat because it needs as - + 2013-08-01 Romain Francois - * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. + * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. * unitTests/runit.wstring.R: re-enable the wstring test suite. - + 2013-07-31 Dirk Eddelbuettel * DESCRIPTION: Bump development version to 0.10.4.3 Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-08-31 21:13:14 UTC (rev 4468) +++ pkg/Rcpp/DESCRIPTION 2013-08-31 21:27:49 UTC (rev 4469) @@ -51,9 +51,9 @@ see 'citation("Rcpp")' for details. Depends: R (>= 2.15.1) Imports: methods -Suggests: RUnit, inline, rbenchmark +Suggests: RUnit, inline, rbenchmark, highlight +VignetteBuilder: highlight URL: http://www.rcpp.org, http://dirk.eddelbuettel.com/code/rcpp.html, http://blog.r-enthusiasts.com/tag/rcpp/ License: GPL (>= 2) BugReports: http://r-forge.r-project.org/tracker/?atid=637&group_id=155&func=browse -MailingList: Please send questions and comments regarding Rcpp to rcpp-devel at lists.r-forge.r-project.org - +MailingList: Please send questions and comments regarding Rcpp to rcpp-devel at lists.r-forge.r-project.or Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-08-31 21:13:14 UTC (rev 4468) +++ pkg/Rcpp/inst/NEWS.Rd 2013-08-31 21:27:49 UTC (rev 4469) @@ -4,7 +4,6 @@ \section{Changes in Rcpp version 0.10.5 (future)}{ \itemize{ - \item Changes in Rcpp API: \itemize{ \item Add \code{#defined(__sun)} to lists of operating systems to @@ -24,10 +23,10 @@ \code{String} and \code{VALUE} is either a primitive type (int, double) or a type that wraps. Examples : \itemize{ - \item \code{std::map} : we can make a String from an int, - and double is primitive - \item \code{boost::unordered_map >}: we can make - a String from a double and \code{std::vector} can wrap itself + \item \code{std::map} : we can make a String from an int, + and double is primitive + \item \code{boost::unordered_map >}: we can make + a String from a double and \code{std::vector} can wrap itself } Other examples of this are included at the end of the \code{wrap} unit test file (\code{runit.wrap.R} and \code{wrap.cpp}). @@ -36,34 +35,37 @@ \code{vector}, ... An example is included in the \code{wrap} unit test file } - \item Changes in Attributes: \itemize{ - \item Objects exported by a module (i.e. by a \code{RCPP_MODULE} call - in a file that is processed by \code{sourceCpp}) are now directly - available in the environment. We used to make the module object - available, which was less useful. - \item A plugin for 'openmp' has been added to support use of OpenMP. - \item \code{Rcpp::export} now takes advantage of the more flexible - \code{as<>}, handling constness and referenceness of the input types. - 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 Module.cpp file has an example. + \item Objects exported by a module (i.e. by a \code{RCPP_MODULE} call + in a file that is processed by \code{sourceCpp}) are now directly + available in the environment. We used to make the module object + available, which was less useful. + \item A plugin for \code{openmp} has been added to support use of OpenMP. + \item \code{Rcpp::export} now takes advantage of the more flexible + \code{as<>}, handling constness and referenceness of the input types. + 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 Changes in Modules: \itemize{ \item We can now expose functions and methods that take \code{T&} or \code{const T&} as arguments. In these situations objects are no longer copied as they used to be. } - \item Changes in sugar: \itemize{ - \item \code{is_na} supports classes \code{DatetimeVector} and - \code{DateVector} + \item \code{is_na} supports classes \code{DatetimeVector} and + \code{DateVector} } - + \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 + \item The unitTest vignette has been disabled as no longer builds + when called from \code{R CMD check}; + } \item Deprecation of \code{RCPP_FUNCTION_*}: \itemize{ \item The macros from the \code{preprocessor_generated.h} file