From noreply at r-forge.r-project.org Tue Apr 2 16:19:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 2 Apr 2013 16:19:55 +0200 (CEST) Subject: [Rcpp-commits] r4299 - scripts Message-ID: <20130402141955.F1CE1181103@r-forge.r-project.org> Author: romain Date: 2013-04-02 16:19:55 +0200 (Tue, 02 Apr 2013) New Revision: 4299 Modified: scripts/DataFrame.R Log: changed script to generate DataFrame::create Modified: scripts/DataFrame.R =================================================================== --- scripts/DataFrame.R 2013-03-31 15:53:18 UTC (rev 4298) +++ scripts/DataFrame.R 2013-04-02 14:19:55 UTC (rev 4299) @@ -8,11 +8,7 @@ sprintf(' template <%s> static DataFrame create( %s ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( %s ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( %s ) ) ; } ', paste( sprintf( "typename T%d", 1:i ), collapse = ", "), paste( sprintf( "const T%d& t%d", 1:i, 1:i ), collapse = ", "), @@ -25,7 +21,7 @@ // // DataFrame_generated.h: Rcpp R/C++ interface class library -- data frames // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -52,5 +48,5 @@ ' , paste( sapply( 1:20, DataFrame_generator ), collapse = "\n\n" ) ) -writeLines( content, "Rcpp/inst/include/Rcpp/DataFrame_generated.h" ) +writeLines( content, "Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h" ) From noreply at r-forge.r-project.org Tue Apr 2 16:24:48 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 2 Apr 2013 16:24:48 +0200 (CEST) Subject: [Rcpp-commits] r4300 - in pkg/Rcpp: . inst inst/include/Rcpp inst/include/Rcpp/api/meat inst/include/Rcpp/generated inst/include/Rcpp/traits src Message-ID: <20130402142448.779AD181103@r-forge.r-project.org> Author: romain Date: 2013-04-02 16:24:48 +0200 (Tue, 02 Apr 2013) New Revision: 4300 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/DottedPair.h pkg/Rcpp/inst/include/Rcpp/Named.h pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h pkg/Rcpp/inst/include/Rcpp/grow.h pkg/Rcpp/inst/include/Rcpp/traits/named_object.h pkg/Rcpp/src/api.cpp Log: fix DataFrame::create Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/ChangeLog 2013-04-02 14:24:48 UTC (rev 4300) @@ -1,3 +1,10 @@ +2013-04-02 Romain Francois + + * include/Rcpp/generated/DataFrame_generated.h : DateFrame::create + uses List::create and then feeds to the DataFrame constructor, which + seems to work better than the previous approach of calling back to the + data.frame function in R + 2013-03-31 Dirk Eddelbuettel * debian/control (Build-Depends): Modified for Debian-only rebuilds @@ -10,15 +17,6 @@ complex types with Poor Man's Versions (TM) of Rf_EncodeReal and Rf_EncodeComplex which the Powers That Be disallow from being used -2013-03-29 Romain Francois - - * include/Rcpp/traits/named_object.h: only keep named_object - * include/Rcpp/Named.h: Named generates named_object - * include/Rcpp/api/meat/DottedPair.h: adapt to changes above - * include/Rcpp/DottedPair.h: idem - * src/api.cpp: define DottedPair::Proxy::operator=( - named_object ) - 2013-03-27 Romain Francois * include/Rcpp/vector/MatrixRow.h : removed unintended printed Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-02 14:24:48 UTC (rev 4300) @@ -2,6 +2,19 @@ \title{News for Package 'Rcpp'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} + \section{Changes in Rcpp version 0.10.4 (future)}{ + \itemize{ + \item Changes in R code: + \item Changes in Rcpp attributes: + \item Changes in Rcpp API: + \itemize{ + \item The \code{DataFrame::create} set of functions has been reworked + to just use \code{List::create} and feed to the \code{DataFrame} + constructor + } + } +} + \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{ \itemize{ \item Changes in R code: Modified: pkg/Rcpp/inst/include/Rcpp/DottedPair.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/DottedPair.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/DottedPair.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -110,7 +110,8 @@ template Proxy& operator=(const T& rhs) ; - Proxy& operator=(const traits::named_object& rhs) ; + template + Proxy& operator=(const traits::named_object& rhs) ; template operator T() const ; Modified: pkg/Rcpp/inst/include/Rcpp/Named.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/Named.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/Named.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -30,8 +30,8 @@ Argument( const std::string& name_) : name(name_){} template - inline traits::named_object operator=( const T& t){ - return traits::named_object( name, wrap(t) ) ; + inline traits::named_object operator=( const T& t){ + return traits::named_object( name, t ) ; } std::string name ; @@ -41,8 +41,8 @@ return Argument( name ); } template -inline traits::named_object Named( const std::string& name, const T& o){ - return traits::named_object( name, wrap(o) ); +inline traits::named_object Named( const std::string& name, const T& o){ + return traits::named_object( name, o ); } namespace internal{ Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -38,6 +38,11 @@ } template + DottedPair::Proxy& DottedPair::Proxy::operator=(const traits::named_object& rhs){ + return set( rhs.object, rhs.name.c_str() ) ; + } + + template void DottedPair::push_back( const T& object){ if( isNULL() ){ setSEXP( grow( object, m_sexp ) ) ; Modified: pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -2,7 +2,7 @@ // // DataFrame_generated.h: Rcpp R/C++ interface class library -- data frames // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -26,201 +26,121 @@ template static DataFrame create( const T1& t1 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20 ) { - try{ - return DataFrame(internal::try_catch(::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) ))); - } catch( eval_error& __ex__){ - throw not_compatible("error calling the data.frame function") ; - } + return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) ) ; } #endif Modified: pkg/Rcpp/inst/include/Rcpp/grow.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/grow.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/grow.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -41,7 +41,7 @@ inline SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){ SEXP y = PROTECT( wrap( head.object) ) ; SEXP x = PROTECT( Rf_cons( y , tail) ) ; - SEXP headNameSym = ::Rf_install( head.name.c_str() ); // cannot be gc()ed once in symbol table + SEXP headNameSym = ::Rf_install( head.name.c_str() ); SET_TAG( x, headNameSym ); UNPROTECT(2); return x; Modified: pkg/Rcpp/inst/include/Rcpp/traits/named_object.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/named_object.h 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/inst/include/Rcpp/traits/named_object.h 2013-04-02 14:24:48 UTC (rev 4300) @@ -31,15 +31,13 @@ template struct needs_protection : false_type{} ; template <> struct needs_protection : true_type{} ; -template class named_object ; -// { -// public: -// named_object( const std::string& name_, const T& o_) : -// name(name_), object(o_){} -// const std::string& name ; -// const T& object ; -// -// } ; +template class named_object { + public: + named_object( const std::string& name_, const T& o_) : + name(name_), object(o_){} + const std::string& name ; + const T& object ; +} ; template <> class named_object { public: named_object( const std::string& name_, const SEXP& o_): Modified: pkg/Rcpp/src/api.cpp =================================================================== --- pkg/Rcpp/src/api.cpp 2013-04-02 14:19:55 UTC (rev 4299) +++ pkg/Rcpp/src/api.cpp 2013-04-02 14:24:48 UTC (rev 4300) @@ -454,10 +454,6 @@ node = x ; } - DottedPair::Proxy& DottedPair::Proxy::operator=(const traits::named_object& rhs){ - return set( rhs.object, rhs.name.c_str() ) ; - } - DottedPair::Proxy& DottedPair::Proxy::operator=(const Proxy& rhs){ return set(rhs) ; } From noreply at r-forge.r-project.org Tue Apr 2 20:24:01 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 2 Apr 2013 20:24:01 +0200 (CEST) Subject: [Rcpp-commits] r4301 - in pkg/Rcpp: . inst/include/Rcpp inst/include/Rcpp/generated src Message-ID: <20130402182401.0B298184F62@r-forge.r-project.org> Author: romain Date: 2013-04-02 20:24:00 +0200 (Tue, 02 Apr 2013) New Revision: 4301 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/DataFrame.h pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h pkg/Rcpp/src/api.cpp Log: deal with stringsAsFactors Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-02 14:24:48 UTC (rev 4300) +++ pkg/Rcpp/ChangeLog 2013-04-02 18:24:00 UTC (rev 4301) @@ -4,7 +4,11 @@ uses List::create and then feeds to the DataFrame constructor, which seems to work better than the previous approach of calling back to the data.frame function in R + * include/Rcpp/DataFrame.h : private function from_list, to help + the new implementation of DataFrame::create + * src/api.cpp : impl of DataFrame::from_list + 2013-03-31 Dirk Eddelbuettel * debian/control (Build-Depends): Modified for Debian-only rebuilds Modified: pkg/Rcpp/inst/include/Rcpp/DataFrame.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/DataFrame.h 2013-04-02 14:24:48 UTC (rev 4300) +++ pkg/Rcpp/inst/include/Rcpp/DataFrame.h 2013-04-02 18:24:00 UTC (rev 4301) @@ -2,7 +2,7 @@ // // DataFrame.h: Rcpp R/C++ interface class library -- data frames // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -48,6 +48,7 @@ private: void set_sexp(SEXP x) ; + static DataFrame from_list( Rcpp::List ) ; } ; Modified: pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h 2013-04-02 14:24:48 UTC (rev 4300) +++ pkg/Rcpp/inst/include/Rcpp/generated/DataFrame_generated.h 2013-04-02 18:24:00 UTC (rev 4301) @@ -26,121 +26,121 @@ template static DataFrame create( const T1& t1 ) { - return DataFrame( List::create( t1 ) ) ; + return DataFrame::from_list( List::create( t1 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2 ) { - return DataFrame( List::create( t1, t2 ) ) ; + return DataFrame::from_list( List::create( t1, t2 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3 ) { - return DataFrame( List::create( t1, t2, t3 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4 ) { - return DataFrame( List::create( t1, t2, t3, t4 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) ) ; } template static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20 ) { - return DataFrame( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) ) ; + return DataFrame::from_list( List::create( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) ) ; } #endif Modified: pkg/Rcpp/src/api.cpp =================================================================== --- pkg/Rcpp/src/api.cpp 2013-04-02 14:24:48 UTC (rev 4300) +++ pkg/Rcpp/src/api.cpp 2013-04-02 18:24:00 UTC (rev 4301) @@ -1208,6 +1208,38 @@ } int DataFrame::nrows() const { return Rf_length( VECTOR_ELT(m_sexp, 0) ); } + DataFrame DataFrame::from_list( Rcpp::List obj ){ + bool use_default_strings_as_factors = true ; + bool strings_as_factors = true ; + int strings_as_factors_index = -1 ; + int n = obj.size() ; + CharacterVector names = obj.attr( "names" ) ; + if( !names.isNULL() ){ + for( int i=0; i(obj[i]) ) strings_as_factors = false ; + break ; + } + } + } + if( use_default_strings_as_factors ) + return DataFrame(obj) ; + SEXP as_df_symb = Rf_install("as.data.frame"); + SEXP strings_as_factors_symb = Rf_install("stringsAsFactors"); + + obj.erase(strings_as_factors_index) ; + names.erase(strings_as_factors_index) ; + obj.attr( "names") = names ; + SEXP call = PROTECT( Rf_lang3(as_df_symb, obj, wrap( strings_as_factors ) ) ) ; + SET_TAG( CDDR(call), strings_as_factors_symb ) ; + SEXP res = PROTECT( Evaluator::run( call ) ) ; + DataFrame out( res ) ; + UNPROTECT(2) ; + return out ; + } + // }}} } // namespace Rcpp From noreply at r-forge.r-project.org Wed Apr 3 05:08:06 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 3 Apr 2013 05:08:06 +0200 (CEST) Subject: [Rcpp-commits] r4302 - in pkg/Rcpp: . inst inst/include/Rcpp inst/unitTests inst/unitTests/cpp src Message-ID: <20130403030806.67B15184EC5@r-forge.r-project.org> Author: edd Date: 2013-04-03 05:08:06 +0200 (Wed, 03 Apr 2013) New Revision: 4302 Added: pkg/Rcpp/inst/unitTests/cpp/dates.cpp Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/Date.h pkg/Rcpp/inst/unitTests/runit.Date.R pkg/Rcpp/src/Date.cpp Log: correct operator-() for Date and Datetime update unit tests accordingly rewritten unit test to use Rcpp attributes Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-02 18:24:00 UTC (rev 4301) +++ pkg/Rcpp/ChangeLog 2013-04-03 03:08:06 UTC (rev 4302) @@ -1,14 +1,25 @@ +2013-04-02 Dirk Eddelbuettel + + * src/Date.cpp (Rcpp): Corrected operator-() for Date and Datetime + objects to do what is more inline with C++ standard + + * inst/include/Rcpp/Date.h: operator-() for Dates now returns a + double as the date itself is fractional double since epoch + + * inst/unitTests/cpp/dates.cpp: New file with C++ portion of tests + factored out from R unit test file + * inst/unitTests/runit.Date.R: Rewritten for use with new C++ tests + 2013-04-02 Romain Francois * include/Rcpp/generated/DataFrame_generated.h : DateFrame::create - uses List::create and then feeds to the DataFrame constructor, which - seems to work better than the previous approach of calling back to the + uses List::create and then feeds to the DataFrame constructor, which + seems to work better than the previous approach of calling back to the data.frame function in R - * include/Rcpp/DataFrame.h : private function from_list, to help + * include/Rcpp/DataFrame.h : private function from_list, to help the new implementation of DataFrame::create * src/api.cpp : impl of DataFrame::from_list - - + 2013-03-31 Dirk Eddelbuettel * debian/control (Build-Depends): Modified for Debian-only rebuilds Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-02 18:24:00 UTC (rev 4301) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-03 03:08:06 UTC (rev 4302) @@ -8,11 +8,12 @@ \item Changes in Rcpp attributes: \item Changes in Rcpp API: \itemize{ - \item The \code{DataFrame::create} set of functions has been reworked - to just use \code{List::create} and feed to the \code{DataFrame} - constructor + \item The \code{DataFrame::create} set of functions has been reworked + to just use \code{List::create} and feed to the \code{DataFrame} + constructor + \item The \code{operator-()} semantics for \code{Date} and + \code{Datetime} are now more inline with standard C++ behaviour. } - } } \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{ Modified: pkg/Rcpp/inst/include/Rcpp/Date.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/Date.h 2013-04-02 18:24:00 UTC (rev 4301) +++ pkg/Rcpp/inst/include/Rcpp/Date.h 2013-04-03 03:08:06 UTC (rev 4302) @@ -2,7 +2,7 @@ // // Date.h: Rcpp R/C++ interface class library -- dates // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -55,14 +55,14 @@ Date & operator=(const Date &newdate); // copy assignment operator // Minimal set of date operations. - friend Date operator+(const Date &date, int offset); - friend int operator-(const Date& date1, const Date& date2); - friend bool operator<(const Date &date1, const Date& date2); - friend bool operator>(const Date &date1, const Date& date2); - friend bool operator==(const Date &date1, const Date& date2); - friend bool operator>=(const Date &date1, const Date& date2); - friend bool operator<=(const Date &date1, const Date& date2); - friend bool operator!=(const Date &date1, const Date& date2); + friend Date operator+(const Date &date, int offset); + friend double operator-(const Date& date1, const Date& date2); + friend bool operator<(const Date &date1, const Date& date2); + friend bool operator>(const Date &date1, const Date& date2); + friend bool operator==(const Date &date1, const Date& date2); + friend bool operator>=(const Date &date1, const Date& date2); + friend bool operator<=(const Date &date1, const Date& date2); + friend bool operator!=(const Date &date1, const Date& date2); private: double m_d; // (fractional) day number, relative to epoch of Jan 1, 1970 Added: pkg/Rcpp/inst/unitTests/cpp/dates.cpp =================================================================== --- pkg/Rcpp/inst/unitTests/cpp/dates.cpp (rev 0) +++ pkg/Rcpp/inst/unitTests/cpp/dates.cpp 2013-04-03 03:08:06 UTC (rev 4302) @@ -0,0 +1,160 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- +// +// dates.cpp: Rcpp R/C++ interface class library -- Date + Datetime tests +// +// Copyright (C) 2010 - 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 . + +#include +using namespace Rcpp; + +// [[Rcpp::export]] +Date ctor_sexp(SEXP d) { + Date dt = Date(d); + return dt; +} + +// [[Rcpp::export]] +SEXP ctor_mdy(int ignoreme) { + Date dt = Date(12,31,2005); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP ctor_ymd(int ignoreme) { + Date dt = Date(2005,12,31); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP ctor_int(int d) { + Date dt = Date(d); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP ctor_string(std::string x) { + Date dt(x); + return wrap(dt); +} + +// [[Rcpp::export]] +List operators(int ignoreme) { + Date d1 = Date(2005,12,31); + Date d2 = d1 + 1; + return List::create(Named("diff") = d1 - d2, + Named("bigger") = d2 > d1, + Named("smaller") = d2 < d1, + Named("equal") = d2 == d1, + Named("ge") = d2 >= d1, + Named("le") = d2 <= d1, + Named("ne") = d2 != d1); +} + +// [[Rcpp::export]] +List components(int ignoreme) { + Date d = Date(2005,12,31); + return List::create(Named("day") = d.getDay(), + Named("month") = d.getMonth(), + Named("year") = d.getYear(), + Named("weekday") = d.getWeekday(), + Named("yearday") = d.getYearday()); +} + +// [[Rcpp::export]] +SEXP vector_Date(int ignoreme) { + std::vector v(2) ; + v[0] = Date(2005,12,31) ; + v[1] = Date(12,31,2005) ; + return wrap( v ); +} + +// [[Rcpp::export]] +SEXP Datevector_wrap(int ignoreme) { + DateVector v(2) ; + v[0] = Date(2005,12,31) ; + v[1] = Date(12,31,2005) ; + return wrap( v ); +} + +// [[Rcpp::export]] +SEXP Datevector_sexp(int ignoreme) { + DateVector v(2) ; + v[0] = Date(2005,12,31) ; + v[1] = Date(12,31,2005) ; + return wrap( v ); +} + +// [[Rcpp::export]] +List Date_get_functions(Date x) { + Date d = Date(x); + return List::create(Named("year") = d.getYear(), + Named("month") = d.getMonth(), + Named("day") = d.getDay(), + Named("wday") = d.getWeekday(), + Named("yday") = d.getYearday()); +} + +// [[Rcpp::export]] +List Datetime_get_functions(Datetime x) { + Datetime dt = Datetime(x); + return List::create(Named("year") = dt.getYear(), + Named("month") = dt.getMonth(), + Named("day") = dt.getDay(), + Named("wday") = dt.getWeekday(), + Named("hour") = dt.getHours(), + Named("minute") = dt.getMinutes(), + Named("second") = dt.getSeconds(), + Named("microsec") = dt.getMicroSeconds()); +} + +// [[Rcpp::export]] +List Datetime_operators(int ignoreme) { + Datetime d1 = Datetime(946774923.123456); + Datetime d2 = d1 + 60*60; + return List::create(Named("diff") = d1 - d2, + Named("bigger") = d2 > d1, + Named("smaller") = d2 < d1, + Named("equal") = d2 == d1, + Named("ge") = d2 >= d1, + Named("le") = d2 <= d1, + Named("ne") = d2 != d1); +} + +// [[Rcpp::export]] +SEXP Datetime_wrap(int ignoreme) { + Datetime dt = Datetime(981162123.123456); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP Datetime_from_string(std::string x) { + Datetime dt(x); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP Datetime_ctor_sexp(Datetime d) { + Datetime dt = Datetime(d); + return wrap(dt); +} + +// [[Rcpp::export]] +SEXP DatetimeVector_ctor(DatetimeVector d) { + DatetimeVector dt = DatetimeVector(d); + return wrap(dt); +} Modified: pkg/Rcpp/inst/unitTests/runit.Date.R =================================================================== --- pkg/Rcpp/inst/unitTests/runit.Date.R 2013-04-02 18:24:00 UTC (rev 4301) +++ pkg/Rcpp/inst/unitTests/runit.Date.R 2013-04-03 03:08:06 UTC (rev 4302) @@ -1,7 +1,7 @@ #!/usr/bin/r -t # -*- mode: R; tab-width: 4; -*- # -# Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +# Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois # # This file is part of Rcpp. # @@ -22,143 +22,13 @@ if (.runThisTest) { -definitions <- function() { - list( "ctor_sexp"=list( - signature(d="Date"), - 'Date dt = Date(d); - return wrap(dt);') - - ,"ctor_mdy"=list( - signature(), - 'Date dt = Date(12,31,2005); - return wrap(dt);') - - ,"ctor_ymd"=list( - signature(), - 'Date dt = Date(2005,12,31); - return wrap(dt);') - - ,"ctor_int"=list( - signature(d="numeric"), - 'Date dt = Date(Rcpp::as(d)); - return wrap(dt);') - - ,"ctor_string"=list( - signature(x="date"), - 'std::string dtstr = Rcpp::as(x); - Date dt(dtstr); - return wrap(dt);') - - ,"operators"=list( - signature(), - 'Date d1 = Date(2005,12,31); - Date d2 = d1 + 1; - return List::create(Named("diff") = d2 - d1, - Named("bigger") = d2 > d1, - Named("smaller") = d2 < d1, - Named("equal") = d2 == d1, - Named("ge") = d2 >= d1, - Named("le") = d2 <= d1, - Named("ne") = d2 != d1);') - - ,"components"=list( - signature(), - 'Date d = Date(2005,12,31); - return List::create(Named("day") = d.getDay(), - Named("month") = d.getMonth(), - Named("year") = d.getYear(), - Named("weekday") = d.getWeekday(), - Named("yearday") = d.getYearday());') - - ,"vector_Date"=list( - signature(), - 'std::vector v(2) ; - v[0] = Date(2005,12,31) ; - v[1] = Date(12,31,2005) ; - return wrap( v );') - - ,"Datevector_wrap"=list( - signature(), - 'DateVector v(2) ; - v[0] = Date(2005,12,31) ; - v[1] = Date(12,31,2005) ; - return wrap( v );') - - ,"Datevector_sexp"=list( - signature(), - 'DateVector v(2) ; - v[0] = Date(2005,12,31) ; - v[1] = Date(12,31,2005) ; - return wrap( v );') - - ,"Date_get_functions"=list( - signature(x="Date"), - 'Date d = Date(x); - return List::create(Named("year") = d.getYear(), - Named("month") = d.getMonth(), - Named("day") = d.getDay(), - Named("wday") = d.getWeekday(), - Named("yday") = d.getYearday());') - - ,"Datetime_get_functions"=list( - signature(x="Datetime"), - 'Datetime dt = Datetime(x); - return List::create(Named("year") = dt.getYear(), - Named("month") = dt.getMonth(), - Named("day") = dt.getDay(), - Named("wday") = dt.getWeekday(), - Named("hour") = dt.getHours(), - Named("minute") = dt.getMinutes(), - Named("second") = dt.getSeconds(), - Named("microsec") = dt.getMicroSeconds());') - - ,"Datetime_operators"=list( - signature(), - 'Datetime d1 = Datetime(946774923.123456); - Datetime d2 = d1 + 60*60; - return List::create(Named("diff") = d2 - d1, - Named("bigger") = d2 > d1, - Named("smaller") = d2 < d1, - Named("equal") = d2 == d1, - Named("ge") = d2 >= d1, - Named("le") = d2 <= d1, - Named("ne") = d2 != d1);') - - ,"Datetime_wrap"=list( - signature(), - 'Datetime dt = Datetime(981162123.123456); - return wrap(dt);') - - ,"Datetime_from_string"=list( - signature(x="datetime"), - 'std::string dtstr = Rcpp::as(x); - Datetime dt(dtstr); - return wrap(dt);') - - ,"Datetime_ctor_sexp"=list( - signature(d="Datetime"), - 'Datetime dt = Datetime(d); - return wrap(dt);') - - ,"DatetimeVector_ctor"=list( - signature(d="DatetimeVector"), - 'DatetimeVector dt = DatetimeVector(d); - return wrap(dt);') - - ) +.setUp <- function(){ + if (!exists("pathRcppTests")) pathRcppTests <- getwd() + sourceCpp(file.path(pathRcppTests, "cpp/dates.cpp")) } -.setUp <- function() { - tests <- ".Rcpp.Date" - if( ! exists(tests, globalenv() )) { - fun <- Rcpp:::compile_unit_tests(definitions() ) - assign( tests, fun , globalenv() ) - } -} - - test.Date.ctor.sexp <- function() { - fun <- .Rcpp.Date$ctor_sexp + fun <- ctor_sexp d <- as.Date("2005-12-31"); checkEquals(fun(d), d, msg = "Date.ctor.sexp.1") d <- as.Date("1970-01-01"); checkEquals(fun(d), d, msg = "Date.ctor.sexp.2") d <- as.Date("1969-12-31"); checkEquals(fun(d), d, msg = "Date.ctor.sexp.3") @@ -167,14 +37,14 @@ } test.Date.ctor.notFinite <- function() { - fun <- .Rcpp.Date$ctor_sexp + fun <- ctor_sexp checkEquals(fun(NA), as.Date(NA, origin="1970-01-01"), msg = "Date.ctor.na") checkEquals(fun(NaN), as.Date(NaN, origin="1970-01-01"), msg = "Date.ctor.nan") checkEquals(fun(Inf), as.Date(Inf, origin="1970-01-01"), msg = "Date.ctor.inf") } test.Date.ctor.diffs <- function() { - fun <- .Rcpp.Date$ctor_sexp + fun <- ctor_sexp now <- Sys.Date() checkEquals(as.numeric(difftime(fun(now+0.025), fun(now), units="days")), 0.025, msg = "Date.ctor.diff.0025") checkEquals(as.numeric(difftime(fun(now+0.250), fun(now), units="days")), 0.250, msg = "Date.ctor.diff.0250") @@ -182,17 +52,17 @@ } test.Date.ctor.mdy <- function() { - fun <- .Rcpp.Date$ctor_mdy - checkEquals(fun(), as.Date("2005-12-31"), msg = "Date.ctor.mdy") + fun <- ctor_mdy + checkEquals(fun(1), as.Date("2005-12-31"), msg = "Date.ctor.mdy") } test.Date.ctor.ymd <- function() { - fun <- .Rcpp.Date$ctor_ymd - checkEquals(fun(), as.Date("2005-12-31"), msg = "Date.ctor.ymd") + fun <- ctor_ymd + checkEquals(fun(1), as.Date("2005-12-31"), msg = "Date.ctor.ymd") } test.Date.ctor.int <- function() { - fun <- .Rcpp.Date$ctor_int + fun <- ctor_int d <- as.Date("2005-12-31") checkEquals(fun(as.numeric(d)), d, msg = "Date.ctor.int") checkEquals(fun(-1), as.Date("1970-01-01")-1, msg = "Date.ctor.int") @@ -200,7 +70,7 @@ } test.Date.ctor.string <- function() { - fun <- .Rcpp.Date$ctor_string + fun <- ctor_string dtstr <- "1991-02-03" dtfun <- fun(dtstr) dtstr <- as.Date(strptime(dtstr, "%Y-%m-%d")) @@ -210,36 +80,36 @@ } test.Date.operators <- function() { - fun <- .Rcpp.Date$operators - checkEquals(fun(), + fun <- operators + checkEquals(fun(1), list(diff=-1, bigger=TRUE, smaller=FALSE, equal=FALSE, ge=TRUE, le=FALSE, ne=TRUE), msg = "Date.operators") } test.Date.components <- function() { - fun <- .Rcpp.Date$components - checkEquals(fun(), + fun <- components + checkEquals(fun(1), list(day=31, month=12, year=2005, weekday=7, yearday=365), msg = "Date.components") } test.vector.Date <- function(){ - fun <- .Rcpp.Date$vector_Date - checkEquals(fun(), rep(as.Date("2005-12-31"),2), msg = "Date.vector.wrap") + fun <- vector_Date + checkEquals(fun(1), rep(as.Date("2005-12-31"),2), msg = "Date.vector.wrap") } test.DateVector.wrap <- function(){ - fun <- .Rcpp.Date$Datevector_wrap - checkEquals(fun(), rep(as.Date("2005-12-31"),2), msg = "DateVector.wrap") + fun <- Datevector_wrap + checkEquals(fun(1), rep(as.Date("2005-12-31"),2), msg = "DateVector.wrap") } test.DateVector.operator.SEXP <- function(){ - fun <- .Rcpp.Date$Datevector_sexp - checkEquals(fun(), rep(as.Date("2005-12-31"),2), msg = "DateVector.SEXP") + fun <- Datevector_sexp + checkEquals(fun(1), rep(as.Date("2005-12-31"),2), msg = "DateVector.SEXP") } test.Date.getFunctions <- function(){ - fun <- .Rcpp.Date$Date_get_functions + fun <- Date_get_functions checkEquals(fun(as.Date("2010-12-04")), list(year=2010, month=12, day=4, wday=7, yday=338), msg = "Date.get.functions.1") checkEquals(fun(as.Date("2010-01-01")), @@ -249,27 +119,27 @@ } test.Datetime.get.functions <- function() { - fun <- .Rcpp.Date$Datetime_get_functions + fun <- Datetime_get_functions checkEquals(fun(as.numeric(as.POSIXct("2001-02-03 01:02:03.123456", tz="UTC"))), list(year=2001, month=2, day=3, wday=7, hour=1, minute=2, second=3, microsec=123456), msg = "Datetime.get.functions") } test.Datetime.operators <- function() { - fun <- .Rcpp.Date$Datetime_operators - checkEquals(fun(), + fun <- Datetime_operators + checkEquals(fun(1), list(diff=-60*60, bigger=TRUE, smaller=FALSE, equal=FALSE, ge=TRUE, le=FALSE, ne=TRUE), msg = "Datetime.operators") } test.Datetime.wrap <- function() { - fun <- .Rcpp.Date$Datetime_wrap - checkEquals(as.numeric(fun()), as.numeric(as.POSIXct("2001-02-03 01:02:03.123456", tz="UTC")), + fun <- Datetime_wrap + checkEquals(as.numeric(fun(1)), as.numeric(as.POSIXct("2001-02-03 01:02:03.123456", tz="UTC")), msg = "Datetime.wrap") } test.Datetime.fromString <- function() { - fun <- .Rcpp.Date$Datetime_from_string + fun <- Datetime_from_string dtstr <- "1991-02-03 04:05:06.789" dtfun <- fun(dtstr) dtstr <- as.POSIXct(strptime(dtstr, "%Y-%m-%d %H:%M:%OS")) @@ -285,7 +155,7 @@ #} test.Datetime.ctor.notFinite <- function() { - fun <- .Rcpp.Date$Datetime_ctor_sexp + fun <- Datetime_ctor_sexp posixtNA <- as.POSIXct(NA, origin="1970-01-01") checkEquals(fun(NA), posixtNA, msg = "Datetime.ctor.na") checkEquals(fun(NaN), posixtNA, msg = "Datetime.ctor.nan") @@ -293,7 +163,7 @@ } test.Datetime.ctor.diffs <- function() { - fun <- .Rcpp.Date$Datetime_ctor_sexp + fun <- Datetime_ctor_sexp now <- Sys.time() ## first one is Ripley's fault as he decreed that difftime of POSIXct should stop at milliseconds checkEquals(round(as.numeric(difftime(fun(now+0.025), fun(now), units="sec")), digits=4), 0.025, msg = "Datetime.ctor.diff.0025") @@ -302,7 +172,7 @@ } test.DatetimeVector.ctor <- function() { - fun <- .Rcpp.Date$DatetimeVector_ctor + fun <- DatetimeVector_ctor now <- Sys.time() checkEquals(fun(now + (0:4)*60), now+(0:4)*60, msg = "Datetime.ctor.sequence") vec <- c(now, NA, NaN, Inf, now+2.345) Modified: pkg/Rcpp/src/Date.cpp =================================================================== --- pkg/Rcpp/src/Date.cpp 2013-04-02 18:24:00 UTC (rev 4301) +++ pkg/Rcpp/src/Date.cpp 2013-04-03 03:08:06 UTC (rev 4302) @@ -3,7 +3,7 @@ // // Date.cpp: Rcpp R/C++ interface class library -- Date type // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // The mktime00() as well as the gmtime_() replacement function are // Copyright (C) 2000 - 2010 The R Development Core Team. @@ -167,7 +167,14 @@ return newdate; } - int operator-(const Date& d1, const Date& d2) { return d2.m_d - d1.m_d; } + // int operator-(const Date& d1, const Date& d2) { return d2.m_d - d1.m_d; } + double operator-(const Date& d1, const Date& d2) { + //Rprintf( "d1 = %lf\n", d1.m_d ) ; + //Rprintf( "d2 = %lf\n", d2.m_d ) ; + double diff = d1.m_d - d2.m_d; + //Rprintf( "diff = %lf\n", diff ); + return diff ; + } bool operator<(const Date &d1, const Date& d2) { return d1.m_d < d2.m_d; } bool operator>(const Date &d1, const Date& d2) { return d1.m_d > d2.m_d; } bool operator==(const Date &d1, const Date& d2) { return d1.m_d == d2.m_d; } @@ -267,7 +274,7 @@ return newdt; } - double operator-(const Datetime& d1, const Datetime& d2) { return d2.m_dt - d1.m_dt; } + double operator-(const Datetime& d1, const Datetime& d2) { return d1.m_dt - d2.m_dt; } bool operator<(const Datetime &d1, const Datetime& d2) { return d1.m_dt < d2.m_dt; } bool operator>(const Datetime &d1, const Datetime& d2) { return d1.m_dt > d2.m_dt; } bool operator==(const Datetime &d1, const Datetime& d2) { return d1.m_dt == d2.m_dt; } From noreply at r-forge.r-project.org Wed Apr 3 17:39:37 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 3 Apr 2013 17:39:37 +0200 (CEST) Subject: [Rcpp-commits] r4303 - in pkg/Rcpp: . src Message-ID: <20130403153937.A2FE0184951@r-forge.r-project.org> Author: edd Date: 2013-04-03 17:39:37 +0200 (Wed, 03 Apr 2013) New Revision: 4303 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/src/Date.cpp Log: minor cleanup Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-03 03:08:06 UTC (rev 4302) +++ pkg/Rcpp/ChangeLog 2013-04-03 15:39:37 UTC (rev 4303) @@ -1,7 +1,7 @@ 2013-04-02 Dirk Eddelbuettel - * src/Date.cpp (Rcpp): Corrected operator-() for Date and Datetime - objects to do what is more inline with C++ standard + * src/Date.cpp: Corrected operator-() for Date and Datetime objects + to behave more inline with C++ standard * inst/include/Rcpp/Date.h: operator-() for Dates now returns a double as the date itself is fractional double since epoch Modified: pkg/Rcpp/src/Date.cpp =================================================================== --- pkg/Rcpp/src/Date.cpp 2013-04-03 03:08:06 UTC (rev 4302) +++ pkg/Rcpp/src/Date.cpp 2013-04-03 15:39:37 UTC (rev 4303) @@ -167,14 +167,7 @@ return newdate; } - // int operator-(const Date& d1, const Date& d2) { return d2.m_d - d1.m_d; } - double operator-(const Date& d1, const Date& d2) { - //Rprintf( "d1 = %lf\n", d1.m_d ) ; - //Rprintf( "d2 = %lf\n", d2.m_d ) ; - double diff = d1.m_d - d2.m_d; - //Rprintf( "diff = %lf\n", diff ); - return diff ; - } + double operator-(const Date& d1, const Date& d2) { return d1.m_d - d2.m_d; } bool operator<(const Date &d1, const Date& d2) { return d1.m_d < d2.m_d; } bool operator>(const Date &d1, const Date& d2) { return d1.m_d > d2.m_d; } bool operator==(const Date &d1, const Date& d2) { return d1.m_d == d2.m_d; } From noreply at r-forge.r-project.org Fri Apr 5 14:07:25 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 5 Apr 2013 14:07:25 +0200 (CEST) Subject: [Rcpp-commits] r4304 - pkg/Rcpp Message-ID: <20130405120726.04DE31848FD@r-forge.r-project.org> Author: jjallaire Date: 2013-04-05 14:07:25 +0200 (Fri, 05 Apr 2013) New Revision: 4304 Modified: pkg/Rcpp/TODO Log: update todo Modified: pkg/Rcpp/TODO =================================================================== --- pkg/Rcpp/TODO 2013-04-03 15:39:37 UTC (rev 4303) +++ pkg/Rcpp/TODO 2013-04-05 12:07:25 UTC (rev 4304) @@ -125,6 +125,12 @@ o Additional high-level mechanism for specifying additional build configuration (perhaps cxxflags and libs attributes) + o Verify whether sourceCpp still needs to check for spaces in the path + of source file names on Windows + + o Consider adding -Wall and -Wpedantic for sourceCpp builds + + Testing o all r* functions : rnorm, etc ... From noreply at r-forge.r-project.org Sat Apr 6 02:55:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 6 Apr 2013 02:55:08 +0200 (CEST) Subject: [Rcpp-commits] r4305 - in pkg/RcppArmadillo: . debian debian/source Message-ID: <20130406005508.6657818487C@r-forge.r-project.org> Author: edd Date: 2013-04-06 02:55:08 +0200 (Sat, 06 Apr 2013) New Revision: 4305 Added: pkg/RcppArmadillo/debian/ pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/debian/compat pkg/RcppArmadillo/debian/control pkg/RcppArmadillo/debian/copyright pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides pkg/RcppArmadillo/debian/rules pkg/RcppArmadillo/debian/source/ pkg/RcppArmadillo/debian/source/format pkg/RcppArmadillo/debian/watch Modified: pkg/RcppArmadillo/ChangeLog Log: RcppArmadillo will be Debian package too (as eg Amelia needs it) Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-04-05 12:07:25 UTC (rev 4304) +++ pkg/RcppArmadillo/ChangeLog 2013-04-06 00:55:08 UTC (rev 4305) @@ -1,3 +1,7 @@ +2013-04-05 Dirk Eddelbuettel + + * debian/: Package will be added to Debian as well + 2013-03-29 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/sample.h: Applied another Added: pkg/RcppArmadillo/debian/changelog =================================================================== --- pkg/RcppArmadillo/debian/changelog (rev 0) +++ pkg/RcppArmadillo/debian/changelog 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,7 @@ +r-cran-rcpparmadillo (0.3.800.1-1) unstable; urgency=low + + * Initial Debian release (Closes: #704746) + + -- Dirk Eddelbuettel Fri, 05 Apr 2013 19:47:00 -0500 + + Added: pkg/RcppArmadillo/debian/compat =================================================================== --- pkg/RcppArmadillo/debian/compat (rev 0) +++ pkg/RcppArmadillo/debian/compat 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1 @@ +7 Added: pkg/RcppArmadillo/debian/control =================================================================== --- pkg/RcppArmadillo/debian/control (rev 0) +++ pkg/RcppArmadillo/debian/control 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,37 @@ +Source: r-cran-rcpparmadillo +Section: gnu-r +Priority: optional +Maintainer: Dirk Eddelbuettel +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.0), r-cran-rcpp, cdbs +Standards-Version: 3.9.4 +Homepage: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html + +Package: r-cran-rcpparmadillo +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, ${R:Depends}, littler +Description: GNU R package for Armadillo C++ linear algebra library + Armadillo is a templated C++ linear algebra library (by Conrad Sanderson) + that aims towards a good balance between speed and ease of use. Integer, + floating point and complex numbers are supported, as well as a subset of + trigonometric and statistics functions. Various matrix decompositions are + provided through optional integration with LAPACK and ATLAS libraries. + . + A delayed evaluation approach is employed (during compile time) to combine + several operations into one, and to reduce (or eliminate) the need for + temporaries. This is accomplished through recursive templates and template + meta-programming. + . + This library is useful if C++ has been decided as the language of choice + (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.800.1). Thus users do not need to + install Armadillo itself in order to use RcppArmadillo. + . + This Armadillo integration provides a nice illustration of the + capabilities of the Rcpp package for seamless R and C++ integration. + . + Armadillo is licensed under the MPL 2.0, while RcppArmadillo (the Rcpp + bindings/bridge to Armadillo) is licensed under the GNU GPL version 2 + or later, as is the rest of Rcpp. + Added: pkg/RcppArmadillo/debian/copyright =================================================================== --- pkg/RcppArmadillo/debian/copyright (rev 0) +++ pkg/RcppArmadillo/debian/copyright 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,79 @@ +This is the Debian GNU/Linux r-cran-rcpparmadillo package of +RcppArmadillo, an package connect the Armadillo C++ library to R +(using the Rcpp package). RcppArmadillo was written by Romain +Francois, Dirk Eddelbuettel and Doug Bates; Armadillo was written by +Conrad Sanderson. + +This package was created by Dirk Eddelbuettel . +The sources were downloaded from the main CRAN site + http://cran.r-project.org/src/contrib/ +and are also available from all CRAN mirrors as e.g. + http://cran.us.r-project.org/src/contrib/ +as well the R-Forge SVN host at + http://r-forge.r-project.org/projects/rcpp/ +via + svn://svn.r-forge.r-project.org/svnroot/rcpp + + +The package was renamed from its upstream name 'RcppArmadillo' to +'r-cran-rcpparmadillo' to fit the pattern of CRAN (and non-CRAN) packages for +R. + +For RcppArmadillo: + +Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates + +License: GPL-2 + +For Armadillo: + +Copyright (C) 2008 - 2013 Conrad Sanderson +Copyright (C) 2008 - 2013 NICTA (www.nicta.com.au) + +License: MPL + + +On a Debian GNU/Linux system, the GPL license (version 2) is included +in the file /usr/share/common-licenses/GPL-2. +The MPL license (version 2) is available at http://www.mozilla.org/MPL/2.0/ + +For reference, the upstream DESCRIPTION file is included below: + + Package: RcppArmadillo + Type: Package + Title: Rcpp integration for Armadillo templated linear algebra library + Version: 0.3.800.1 + Date: $Date: 2013-03-13 09:27:01 -0500 (Wed, 13 Mar 2013) $ + Author: Romain Francois, Dirk Eddelbuettel and Doug Bates + Maintainer: Dirk Eddelbuettel + Description: R and Armadillo integration using Rcpp + Armadillo is a templated C++ linear algebra library (by Conrad Sanderson) + that aims towards a good balance between speed and ease of use. Integer, + floating point and complex numbers are supported, as well as a subset of + trigonometric and statistics functions. Various matrix decompositions are + provided through optional integration with LAPACK and ATLAS libraries. + . + A delayed evaluation approach is employed (during compile time) to combine + several operations into one, and to reduce (or eliminate) the need for + temporaries. This is accomplished through recursive templates and template + meta-programming. + . + This library is useful if C++ has been decided as the language of choice + (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.800.1). Thus users do not need to + install Armadillo itself in order to use RcppArmadillo. + . + This Armadillo integration provides a nice illustration of the + capabilities of the Rcpp package for seamless R and C++ integration. + . + Armadillo is licensed under the MPL 2.0, while RcppArmadillo (the Rcpp + bindings/bridge to Armadillo) is licensed under the GNU GPL version 2 + or later, as is the rest of Rcpp. + License: GPL (>= 2) + LazyLoad: yes + Depends: R (>= 2.14.0), Rcpp (>= 0.10.2) + LinkingTo: Rcpp + Suggests: inline, 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 Added: pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides =================================================================== --- pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides (rev 0) +++ pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,79 @@ +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RObject.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.XPTr.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.environments.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.evaluator.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.exceptions.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RObject.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.XPTr.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.environments.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.evaluator.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.exceptions.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/ConvolveBenchmarks/convolve2.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/ConvolveBenchmarks/exampleRCode.r +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.CharacterVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.ComplexVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.ExpressionVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Function.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.GenericVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.IntegerVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Language.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.NumericVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Pairlist.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RawVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.S4.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Symbol.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.as.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.wrap.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/discovery/cxx0x.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppDate.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppDatetime.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppMatrix.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppMatrixView.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppParams.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppResultSet.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppVector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppVectorView.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.clone.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.traits.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-uses-bin-env usr/lib/R/site-library/Rcpp/discovery/cxx0x.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Column.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Matrix.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Row.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.macros.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Argument.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppFrame.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Vector.create.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.DataFrame.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Dimension.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Formula.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.client.package.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Module.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.complex.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Date.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Datetime.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.sugar.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: executable-not-elf-or-script ./usr/lib/R/site-library/Rcpp/examples/SugarPerformance/sugarBenchmarks.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.RcppMisc.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Vector.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.misc.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.stats.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/ConvolveBenchmarks/buildAndRun.sh +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/ConvolveBenchmarks/overhead.r +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/functionCallback/buildAndRun.sh +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.Module.client.package.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.modref.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.support.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/Misc/ifelseLooped.r +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/OpenMP/OpenMPandInline.r +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.int64.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.rcout.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.sugarOps.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/examples/Misc/newFib.r +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.rmath.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.String.R +r-cran-rcpparmadillo: malformed-override r-cran-rcpp: script-not-executable usr/lib/R/site-library/Rcpp/unitTests/runit.wstring.R +r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/examples/fastLm.r +r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/examples/varSimulation.r +r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.RcppArmadillo.R +r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.fastLm.R +r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.sample.R Added: pkg/RcppArmadillo/debian/rules =================================================================== --- pkg/RcppArmadillo/debian/rules (rev 0) +++ pkg/RcppArmadillo/debian/rules 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,6 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# debian/rules file for the Debian/GNU Linux rcpparmadillo package +# Copyright 2003-2013 by Dirk Eddelbuettel + +include /usr/share/R/debian/r-cran.mk Property changes on: pkg/RcppArmadillo/debian/rules ___________________________________________________________________ Added: svn:executable + * Added: pkg/RcppArmadillo/debian/source/format =================================================================== --- pkg/RcppArmadillo/debian/source/format (rev 0) +++ pkg/RcppArmadillo/debian/source/format 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1 @@ +1.0 Added: pkg/RcppArmadillo/debian/watch =================================================================== --- pkg/RcppArmadillo/debian/watch (rev 0) +++ pkg/RcppArmadillo/debian/watch 2013-04-06 00:55:08 UTC (rev 4305) @@ -0,0 +1,2 @@ +version=3 +http://cran.r-project.org/src/contrib/RcppArmadillo_([-\d\.]*)\.tar.gz From noreply at r-forge.r-project.org Sat Apr 6 03:35:18 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 6 Apr 2013 03:35:18 +0200 (CEST) Subject: [Rcpp-commits] r4306 - pkg/RcppArmadillo/debian Message-ID: <20130406013518.48E72184AB3@r-forge.r-project.org> Author: edd Date: 2013-04-06 03:35:13 +0200 (Sat, 06 Apr 2013) New Revision: 4306 Modified: pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides Log: usual -rpath override for lintian Modified: pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides =================================================================== --- pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides 2013-04-06 00:55:08 UTC (rev 4305) +++ pkg/RcppArmadillo/debian/r-cran-rcpparmadillo.lintian-overrides 2013-04-06 01:35:13 UTC (rev 4306) @@ -77,3 +77,4 @@ r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.RcppArmadillo.R r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.fastLm.R r-cran-rcpparmadillo: script-not-executable usr/lib/R/site-library/RcppArmadillo/unitTests/runit.sample.R +r-cran-rcpparmadillo: binary-or-shlib-defines-rpath usr/lib/R/site-library/RcppArmadillo/libs/RcppArmadillo.so /usr/lib/R/site-library/Rcpp/lib From noreply at r-forge.r-project.org Wed Apr 10 11:29:10 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 10 Apr 2013 11:29:10 +0200 (CEST) Subject: [Rcpp-commits] r4307 - pkg/Rcpp Message-ID: <20130410092910.A56CB1848C9@r-forge.r-project.org> Author: romain Date: 2013-04-10 11:29:10 +0200 (Wed, 10 Apr 2013) New Revision: 4307 Modified: pkg/Rcpp/DESCRIPTION Log: update links Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-04-06 01:35:13 UTC (rev 4306) +++ pkg/Rcpp/DESCRIPTION 2013-04-10 09:29:10 UTC (rev 4307) @@ -48,7 +48,7 @@ Depends: R (>= 2.15.1) Imports: methods Suggests: RUnit, inline, rbenchmark -URL: http://dirk.eddelbuettel.com/code/rcpp.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/Rcpp +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 From noreply at r-forge.r-project.org Sun Apr 14 09:50:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 14 Apr 2013 09:50:55 +0200 (CEST) Subject: [Rcpp-commits] r4308 - in pkg/Rcpp: . inst/include/Rcpp/traits Message-ID: <20130414075055.B083C1851B3@r-forge.r-project.org> Author: romain Date: 2013-04-14 09:50:55 +0200 (Sun, 14 Apr 2013) New Revision: 4308 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/include/Rcpp/traits/is_na.h Log: fix is_na for the complex case Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-10 09:29:10 UTC (rev 4307) +++ pkg/Rcpp/ChangeLog 2013-04-14 07:50:55 UTC (rev 4308) @@ -1,3 +1,8 @@ +2013-04-14 Romain Francois + + * include/Rcpp/traits/is_na.h: complex version did not work. + added default for VECSXP and EXPRSXP versions + 2013-04-02 Dirk Eddelbuettel * src/Date.cpp: Corrected operator-() for Date and Datetime objects Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_na.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/traits/is_na.h 2013-04-10 09:29:10 UTC (rev 4307) +++ pkg/Rcpp/inst/include/Rcpp/traits/is_na.h 2013-04-14 07:50:55 UTC (rev 4308) @@ -2,7 +2,7 @@ // // is_na.h: Rcpp R/C++ interface class library -- vector operators // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -25,9 +25,11 @@ namespace Rcpp{ namespace traits{ - // no definition on purpose + // default to always false, applies to VECSXP, EXPRSXP and RAWSXP template - bool is_na( typename storage_type::type ) ; + bool is_na( typename storage_type::type ){ + return false ; + } template <> inline bool is_na( int x ){ @@ -41,13 +43,10 @@ template <> inline bool is_na( Rcomplex x ){ - return x.r == NA_REAL || x.i == NA_REAL; + return R_IsNA(x.r) || R_IsNA(x.i) ; } template <> - inline bool is_na( Rbyte ){ return false; } - - template <> inline bool is_na( SEXP x ){ return x == NA_STRING ; } template <> From noreply at r-forge.r-project.org Tue Apr 16 11:52:35 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 16 Apr 2013 11:52:35 +0200 (CEST) Subject: [Rcpp-commits] r4309 - in pkg/Rcpp: . inst inst/include/Rcpp/sugar/functions Message-ID: <20130416095235.9FC0B185173@r-forge.r-project.org> Author: romain Date: 2013-04-16 11:52:35 +0200 (Tue, 16 Apr 2013) New Revision: 4309 Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/na_omit.h Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h Log: added na_omit Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-14 07:50:55 UTC (rev 4308) +++ pkg/Rcpp/ChangeLog 2013-04-16 09:52:35 UTC (rev 4309) @@ -1,3 +1,8 @@ +2013-04-16 Romain Francois + + * include/Rcpp/sugar/functions/na_omit.h : new function na_omit to remove + missing values from a vector. + 2013-04-14 Romain Francois * include/Rcpp/traits/is_na.h: complex version did not work. Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-14 07:50:55 UTC (rev 4308) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-16 09:52:35 UTC (rev 4309) @@ -14,6 +14,11 @@ \item The \code{operator-()} semantics for \code{Date} and \code{Datetime} are now more inline with standard C++ behaviour. } + \item Changes in sugar: + \itemize{ + \item New function \code{na_omit} based on the stack overflow thread + http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values + } } \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{ Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h 2013-04-14 07:50:55 UTC (rev 4308) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/functions.h 2013-04-16 09:52:35 UTC (rev 4309) @@ -2,7 +2,7 @@ // // functions.h: Rcpp R/C++ interface class library -- sugar functions // -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include Added: pkg/Rcpp/inst/include/Rcpp/sugar/functions/na_omit.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/sugar/functions/na_omit.h (rev 0) +++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/na_omit.h 2013-04-16 09:52:35 UTC (rev 4309) @@ -0,0 +1,79 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// +// na_omit.h: Rcpp R/C++ interface class library -- na_omit +// +// 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__sugar__na_omit_h +#define Rcpp__sugar__na_omit_h + +namespace Rcpp{ +namespace sugar{ + + template + Vector na_omit_impl(const T& x, Rcpp::traits::false_type ) { + int n = x.size() ; + int n_out = n - sum( is_na(x) ) ; + + Vector out(n_out) ; + for( int i=0, j=0; i::is_na( x[i] ) ) continue ; + out[j++] = x[i]; + } + return out ; + } + + template + Vector na_omit_impl(const T& x, Rcpp::traits::true_type ) { + int n = x.size() ; + int n_out = n - sum( is_na(x) ) ; + + Vector out(n_out) ; + bool has_name = x.attr("names") != R_NilValue ; + if( has_name ){ + CharacterVector names = x.attr("names") ; + CharacterVector onames( n_out ) ; + + for( int i=0, j=0; i::is_na( x[i] ) ) continue ; + onames[j] = names[i] ; + out[j++] = x[i]; + } + out.attr("names") = onames ; + } else { + for( int i=0, j=0; i::is_na( x[i] ) ) continue ; + out[j++] = x[i]; + } + } + return out ; + } + +} // sugar + +template +inline Vector na_omit( const VectorBase& t){ + return sugar::na_omit_impl( + t.get_ref(), + typename Rcpp::traits::same_type >::type() + ) ; +} + +} // Rcpp +#endif + From noreply at r-forge.r-project.org Tue Apr 16 20:38:27 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 16 Apr 2013 20:38:27 +0200 (CEST) Subject: [Rcpp-commits] r4310 - in pkg/Rcpp: . inst inst/include/Rcpp/api/meat src Message-ID: <20130416183827.3C85D185179@r-forge.r-project.org> Author: romain Date: 2013-04-16 20:38:26 +0200 (Tue, 16 Apr 2013) New Revision: 4310 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h pkg/Rcpp/src/ pkg/Rcpp/src/attributes.cpp Log: portabilty fix from Martyn Plummer Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-16 09:52:35 UTC (rev 4309) +++ pkg/Rcpp/ChangeLog 2013-04-16 18:38:26 UTC (rev 4310) @@ -2,7 +2,9 @@ * include/Rcpp/sugar/functions/na_omit.h : new function na_omit to remove missing values from a vector. - + * src/attributes.cpp : portability fix (from Martyn Plummer) + * include/Rcpp/api/meat/Vector.h : portability fix (from Martyn Plummer) + 2013-04-14 Romain Francois * include/Rcpp/traits/is_na.h: complex version did not work. Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-16 09:52:35 UTC (rev 4309) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-16 18:38:26 UTC (rev 4310) @@ -19,6 +19,10 @@ \item New function \code{na_omit} based on the stack overflow thread http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values } + \item Portability + \itemize{ + \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult. + } } \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{ Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h =================================================================== --- pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h 2013-04-16 09:52:35 UTC (rev 4309) +++ pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h 2013-04-16 18:38:26 UTC (rev 4310) @@ -151,11 +151,11 @@ import_sugar_expression( other, typename traits::same_type::type() ) ; } - template <> + template template - Vector::Vector( const sugar::SingleLogicalResult& obj ) : RObject(const_cast&>( obj ).get_sexp() ) { + Vector::Vector( const sugar::SingleLogicalResult& obj ) : RObject( r_cast( const_cast&>(obj).get_sexp() ) ) { update_vector() ; - RCPP_DEBUG_2( "Vector<%d>( const sugar::SingleLogicalResult& ) [T = %s]", LGLSXP, DEMANGLE(T) ) + RCPP_DEBUG_2( "Vector<%d>( const sugar::SingleLogicalResult& ) [T = %s]", RTYPE, DEMANGLE(T) ) } Property changes on: pkg/Rcpp/src ___________________________________________________________________ Added: svn:ignore + symbols.rds Modified: pkg/Rcpp/src/attributes.cpp =================================================================== --- pkg/Rcpp/src/attributes.cpp 2013-04-16 09:52:35 UTC (rev 4309) +++ pkg/Rcpp/src/attributes.cpp 2013-04-16 18:38:26 UTC (rev 4310) @@ -2,7 +2,7 @@ // // attributes.cpp: Rcpp R/C++ interface class library -- Rcpp attributes // -// Copyright (C) 2012 JJ Allaire, Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2013 JJ Allaire, Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -1033,7 +1033,7 @@ // extract the type std::string typeText; while (++it != preambleText.rend()) - typeText.insert(0, 1, *it); + typeText.insert(0U, 1U, *it); type = parseType(typeText); // break (since we now have the name and the type) @@ -1042,7 +1042,7 @@ else continue; } else { - name.insert(0, 1, ch); + name.insert(0U, 1U, ch); } } From noreply at r-forge.r-project.org Sat Apr 20 03:15:30 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 20 Apr 2013 03:15:30 +0200 (CEST) Subject: [Rcpp-commits] r4311 - in pkg/RcppArmadillo: . debian inst inst/doc/unitTests inst/include inst/include/armadillo_bits Message-ID: <20130420011530.7D4D51800CB@r-forge.r-project.org> Author: edd Date: 2013-04-20 03:15:28 +0200 (Sat, 20 Apr 2013) New Revision: 4311 Added: pkg/RcppArmadillo/inst/include/armadillo_bits/fft_engine.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_fft_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/op_fft_meat.hpp Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/debian/control pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/doc/unitTests/RcppArmadillo-unitTests.R pkg/RcppArmadillo/inst/include/armadillo pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/spglue_times_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp Log: RcppArmadillo release 0.3.810.0 containing Armadillo 3.810.0 Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/ChangeLog 2013-04-20 01:15:28 UTC (rev 4311) @@ -1,3 +1,10 @@ +2013-04-19 Dirk Eddelbuettel + + * DESCRIPTION: Release 0.3.810.0 + * inst/NEWS: Release 0.3.810.0 + * inst/include/*: Upgraded to new release 3.810.0 of Armadillo + * debian/*: Similarly updated for new release to Debian + 2013-04-05 Dirk Eddelbuettel * debian/: Package will be added to Debian as well Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/DESCRIPTION 2013-04-20 01:15:28 UTC (rev 4311) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.800.1 +Version: 0.3.810.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.800.1). Thus users do not need to + Armadillo library (currently version 3.810.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-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/debian/changelog 2013-04-20 01:15:28 UTC (rev 4311) @@ -1,3 +1,9 @@ +r-cran-rcpparmadillo (0.3.810.0-1) unstable; urgency=low + + * New upstream release + + -- Dirk Eddelbuettel Fri, 19 Apr 2013 19:56:04 -0500 + r-cran-rcpparmadillo (0.3.800.1-1) unstable; urgency=low * Initial Debian release (Closes: #704746) Modified: pkg/RcppArmadillo/debian/control =================================================================== --- pkg/RcppArmadillo/debian/control 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/debian/control 2013-04-20 01:15:28 UTC (rev 4311) @@ -25,7 +25,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.800.1). Thus users do not need to + Armadillo library (currently version 3.810.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/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-04-20 01:15:28 UTC (rev 4311) @@ -2,6 +2,21 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppArmadillo version 0.3.810.0 (2013-04-19)}{ + \itemize{ + \item Upgraded to Armadillo release Version 3.810.0 (Newell Highway) + \itemize{ + \item added fast Fourier transform: \code{fft()} + \item added handling of \code{.imbue()} and \code{.transform()} by + submatrices and subcubes + \item added batch insertion constructors for sparse matrices + \item minor fix for multiplication of complex sparse matrices + } + \item Updated sample() function and test again contributed by + Christian Gunning + } +} + \section{Changes in RcppArmadillo version 0.3.800.1 (2013-03-12)}{ \itemize{ \item Upgraded to Armadillo release Version 3.800.1 (Miami Beach) Modified: pkg/RcppArmadillo/inst/doc/unitTests/RcppArmadillo-unitTests.R =================================================================== --- pkg/RcppArmadillo/inst/doc/unitTests/RcppArmadillo-unitTests.R 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/doc/unitTests/RcppArmadillo-unitTests.R 2013-04-20 01:15:28 UTC (rev 4311) @@ -1,20 +1,22 @@ pkg <- "RcppArmadillo" # load this package -require( pkg, character.only = TRUE ) +require(pkg, character.only = TRUE) #load RUnit -runit <- "RUnit" ; require( runit, character.only = TRUE ) -if( file.exists( "unitTests-results" ) ){ unlink("unitTests-results", recursive = TRUE ) } -dir.create( "unitTests-results" ) +runit <- "RUnit" +require(runit, character.only = TRUE) +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) printHTMLProtocol(tests, fileName= sprintf( "unitTests-results/%s-unitTests.html" , pkg ) ) printTextProtocol(tests, fileName= sprintf( "unitTests-results/%s-unitTests.txt" , pkg ) ) -if( file.exists( "/tmp" ) ){ - file.copy( sprintf( "unitTests-results/%s-unitTests.txt" , pkg ) , "/tmp", overwrite = TRUE ) - file.copy( sprintf( "unitTests-results/%s-unitTests.html", pkg ) , "/tmp", overwrite = TRUE ) +if (file.exists( "/tmp")) { + file.copy(sprintf("unitTests-results/%s-unitTests.txt" , pkg), "/tmp", overwrite = TRUE) + file.copy(sprintf("unitTests-results/%s-unitTests.html", pkg), "/tmp", overwrite = TRUE) } Modified: pkg/RcppArmadillo/inst/include/armadillo =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo 2013-04-20 01:15:28 UTC (rev 4311) @@ -225,6 +225,7 @@ #include "armadillo_bits/op_hist_bones.hpp" #include "armadillo_bits/op_unique_bones.hpp" #include "armadillo_bits/op_toeplitz_bones.hpp" + #include "armadillo_bits/op_fft_bones.hpp" #include "armadillo_bits/glue_times_bones.hpp" #include "armadillo_bits/glue_mixed_bones.hpp" @@ -408,6 +409,7 @@ #include "armadillo_bits/fn_hist.hpp" #include "armadillo_bits/fn_histc.hpp" #include "armadillo_bits/fn_unique.hpp" + #include "armadillo_bits/fn_fft.hpp" #include "armadillo_bits/fn_speye.hpp" #include "armadillo_bits/fn_spones.hpp" @@ -418,8 +420,9 @@ // misc stuff #include "armadillo_bits/hdf5_misc.hpp" - - + #include "armadillo_bits/fft_engine.hpp" + + // // class meat @@ -499,6 +502,7 @@ #include "armadillo_bits/op_hist_meat.hpp" #include "armadillo_bits/op_unique_meat.hpp" #include "armadillo_bits/op_toeplitz_meat.hpp" + #include "armadillo_bits/op_fft_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_mixed_meat.hpp" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -184,7 +184,10 @@ template arma_inline subview_elem1 elem(const Base& a); template arma_inline const subview_elem1 elem(const Base& a) const; + template arma_inline subview_elem1 operator()(const Base& a); + template arma_inline const subview_elem1 operator()(const Base& a) const; + template arma_inline subview_elem2 elem(const Base& ri, const Base& ci); template arma_inline const subview_elem2 elem(const Base& ri, const Base& ci) const; @@ -194,6 +197,7 @@ template arma_inline subview_elem2 operator()(const Base& ri, const Base& ci); template arma_inline const subview_elem2 operator()(const Base& ri, const Base& ci) const; + template arma_inline subview_elem2 rows(const Base& ri); template arma_inline const subview_elem2 rows(const Base& ri) const; Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -2727,6 +2727,32 @@ template +template +arma_inline +subview_elem1 +Mat::operator()(const Base& a) + { + arma_extra_debug_sigprint(); + + return subview_elem1(*this, a); + } + + + +template +template +arma_inline +const subview_elem1 +Mat::operator()(const Base& a) const + { + arma_extra_debug_sigprint(); + + return subview_elem1(*this, a); + } + + + +template template arma_inline subview_elem2 Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -64,8 +64,21 @@ inline SpMat(const std::string& text); inline const SpMat& operator=(const std::string& text); inline SpMat(const SpMat& x); + + /** + * Construct a sparse matrix and insert a large number of points at once. + * locations.row[0] should be row indices, locations.row[1] should be column + * indices, and values should be the corresponding values. If sorted is true, + * then it is assumed that the locations and values are already sorted in + * column-major ordering. + * + * The size is automatically determined to be the minimum size to fit all + * points in the locations list. + */ + template inline SpMat(const Base& locations, const Base& values, const bool sort_locations = true); + //! Same as the other batch insertion constructor, but with manual size specification. + template inline SpMat(const Base& locations, const Base& values, const uword n_rows, const uword n_cols, const bool sort_locations = true); - inline const SpMat& operator=(const eT val); //! Sets size to 1x1. inline const SpMat& operator*=(const eT val); inline const SpMat& operator/=(const eT val); Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -164,6 +164,250 @@ +//! Insert a large number of values at once. +//! locations.row[0] should be row indices, locations.row[1] should be column indices, +//! and values should be the corresponding values. +//! If sort_locations is false, then it is assumed that the locations and values +//! are already sorted in column-major ordering. +template +template +inline +SpMat::SpMat(const Base& locations_expr, const Base& vals_expr, const bool sort_locations) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , n_nonzero(0) + , vec_state(0) + , values(NULL) + , row_indices(NULL) + , col_ptrs(NULL) + { + arma_extra_debug_sigprint_this(this); + + const unwrap locs_tmp( locations_expr.get_ref() ); + const Mat& locs = locs_tmp.M; + + const unwrap vals_tmp( vals_expr.get_ref() ); + const Mat& vals = vals_tmp.M; + + arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object is not a vector" ); + + arma_debug_check((locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of locations is different than number of values"); + + // If there are no elements in the list, max() will fail. + if (locs.n_cols == 0) + { + init(0, 0); + return; + } + + arma_debug_check((locs.n_rows != 2), "SpMat::SpMat(): locations matrix must have two rows"); + + // Automatically determine size (and check if it's sorted). + uvec bounds = arma::max(locs, 1); + init(bounds[0] + 1, bounds[1] + 1); + + // Resize to correct number of elements. + mem_resize(vals.n_elem); + + // Reset column pointers to zero. + arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); + + bool actually_sorted = true; + if(sort_locations == true) + { + // sort_index() uses std::sort() which may use quicksort... so we better + // make sure it's not already sorted before taking an O(N^2) sort penalty. + for (uword i = 1; i < locs.n_cols; ++i) + { + if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) + { + actually_sorted = false; + break; + } + } + + if(actually_sorted == false) + { + // This may not be the fastest possible implementation but it maximizes code reuse. + Col abslocs(locs.n_cols); + + for (uword i = 0; i < locs.n_cols; ++i) + { + abslocs[i] = locs.at(1, i) * n_rows + locs.at(0, i); + } + + // Now we will sort with sort_index(). + uvec sorted_indices = sort_index(abslocs); // Ascending sort. + + // Now we add the elements in this sorted order. + for (uword i = 0; i < sorted_indices.n_elem; ++i) + { + arma_debug_check((locs.at(0, sorted_indices[i]) >= n_rows), "SpMat::SpMat(): invalid row index"); + arma_debug_check((locs.at(1, sorted_indices[i]) >= n_cols), "SpMat::SpMat(): invalid column index"); + + access::rw(values[i]) = vals[sorted_indices[i]]; + access::rw(row_indices[i]) = locs.at(0, sorted_indices[i]); + + access::rw(col_ptrs[locs.at(1, sorted_indices[i]) + 1])++; + } + } + } + + if( (sort_locations == false) || (actually_sorted == true) ) + { + // Now set the values and row indices correctly. + // Increment the column pointers in each column (so they are column "counts"). + for (uword i = 0; i < vals.n_elem; ++i) + { + arma_debug_check((locs.at(0, i) >= n_rows), "SpMat::SpMat(): invalid row index"); + arma_debug_check((locs.at(1, i) >= n_cols), "SpMat::SpMat(): invalid column index"); + + // Check ordering in debug mode. + if(i > 0) + { + arma_debug_check + ( + ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), + "SpMat::SpMat(): out of order points; either pass sort_locations = true, or sort points in column-major ordering" + ); + arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in list"); + } + + access::rw(values[i]) = vals[i]; + access::rw(row_indices[i]) = locs.at(0, i); + + access::rw(col_ptrs[locs.at(1, i) + 1])++; + } + } + + // Now fix the column pointers. + for (uword i = 0; i <= n_cols; ++i) + { + access::rw(col_ptrs[i + 1]) += col_ptrs[i]; + } + } + + + +//! Insert a large number of values at once. +//! locations.row[0] should be row indices, locations.row[1] should be column indices, +//! and values should be the corresponding values. +//! If sort_locations is false, then it is assumed that the locations and values +//! are already sorted in column-major ordering. +//! In this constructor the size is explicitly given. +template +template +inline +SpMat::SpMat(const Base& locations_expr, const Base& vals_expr, const uword in_n_rows, const uword in_n_cols, const bool sort_locations) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , n_nonzero(0) + , vec_state(0) + , values(NULL) + , row_indices(NULL) + , col_ptrs(NULL) + { + arma_extra_debug_sigprint_this(this); + + init(in_n_rows, in_n_cols); + + const unwrap locs_tmp( locations_expr.get_ref() ); + const Mat& locs = locs_tmp.M; + + const unwrap vals_tmp( vals_expr.get_ref() ); + const Mat& vals = vals_tmp.M; + + arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object is not a vector" ); + + arma_debug_check((locs.n_rows != 2), "SpMat::SpMat(): locations matrix must have two rows"); + + arma_debug_check((locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of locations is different than number of values"); + + // Resize to correct number of elements. + mem_resize(vals.n_elem); + + // Reset column pointers to zero. + arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); + + bool actually_sorted = true; + if(sort_locations == true) + { + // sort_index() uses std::sort() which may use quicksort... so we better + // make sure it's not already sorted before taking an O(N^2) sort penalty. + for (uword i = 1; i < locs.n_cols; ++i) + { + if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) + { + actually_sorted = false; + break; + } + } + + if(actually_sorted == false) + { + // This may not be the fastest possible implementation but it maximizes code reuse. + Col abslocs(locs.n_cols); + + for (uword i = 0; i < locs.n_cols; ++i) + { + abslocs[i] = locs.at(1, i) * n_rows + locs.at(0, i); + } + + // Now we will sort with sort_index(). + uvec sorted_indices = sort_index(abslocs); // Ascending sort. + + // Now we add the elements in this sorted order. + for (uword i = 0; i < sorted_indices.n_elem; ++i) + { + arma_debug_check((locs.at(0, sorted_indices[i]) >= n_rows), "SpMat::SpMat(): invalid row index"); + arma_debug_check((locs.at(1, sorted_indices[i]) >= n_cols), "SpMat::SpMat(): invalid column index"); + + access::rw(values[i]) = vals[sorted_indices[i]]; + access::rw(row_indices[i]) = locs.at(0, sorted_indices[i]); + + access::rw(col_ptrs[locs.at(1, sorted_indices[i]) + 1])++; + } + } + } + + if( (sort_locations == false) || (actually_sorted == true) ) + { + // Now set the values and row indices correctly. + // Increment the column pointers in each column (so they are column "counts"). + for (uword i = 0; i < vals.n_elem; ++i) + { + arma_debug_check((locs.at(0, i) >= n_rows), "SpMat::SpMat(): invalid row index"); + arma_debug_check((locs.at(1, i) >= n_cols), "SpMat::SpMat(): invalid column index"); + + // Check ordering in debug mode. + if(i > 0) + { + arma_debug_check + ( + ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), + "SpMat::SpMat(): out of order points; either pass sort_locations = true or sort points in column-major ordering" + ); + arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in list"); + } + + access::rw(values[i]) = vals[i]; + access::rw(row_indices[i]) = locs.at(0, i); + + access::rw(col_ptrs[locs.at(1, i) + 1])++; + } + } + + // Now fix the column pointers. + for (uword i = 0; i <= n_cols; ++i) + { + access::rw(col_ptrs[i + 1]) += col_ptrs[i]; + } + } + + + /** * Simple operators with plain values. These operate on every value in the * matrix, so a sparse matrix += 1 will turn all those zeroes into ones. Be Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -12,9 +12,9 @@ #define ARMA_VERSION_MAJOR 3 -#define ARMA_VERSION_MINOR 800 -#define ARMA_VERSION_PATCH 1 -#define ARMA_VERSION_NAME "Miami Beach" +#define ARMA_VERSION_MINOR 810 +#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_NAME "Newell Highway" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2013-04-16 18:38:26 UTC (rev 4310) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -17,7 +17,7 @@ #if !defined(ARMA_USE_BLAS) // #define ARMA_USE_BLAS //// Uncomment the above line if you have BLAS or a high-speed replacement for BLAS, -//// such as GotoBLAS, Intel's MKL, AMD's ACML, or the Accelerate framework. +//// such as OpenBLAS, GotoBLAS, Intel's MKL, AMD's ACML, or the Accelerate framework. //// BLAS is used for matrix multiplication. //// Without BLAS, matrix multiplication will still work, but might be slower. #endif Added: pkg/RcppArmadillo/inst/include/armadillo_bits/fft_engine.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/fft_engine.hpp (rev 0) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/fft_engine.hpp 2013-04-20 01:15:28 UTC (rev 4311) @@ -0,0 +1,409 @@ +// This Source Code Form is a compilation of: +// (1) source code written by Conrad Sanderson, and +// (2) a modified form of source code referred to as "kissfft.hh". +// +// This compilation is Copyright (C) 2013 Conrad Sanderson +// and is subject to the terms of the Mozilla Public License, v. 2.0. +// +// The source code that is distinct and separate from "kissfft.hh" +// is Copyright (C) 2013 Conrad Sanderson and 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/. +// +// The original "kissfft.hh" source code is licensed under a 3-clause BSD license, +// as follows: +// +// Copyright (c) 2003-2010 Mark Borgerding +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the author nor the names of any contributors may be used to endorse or promote +// products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS +// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +template struct store {}; + +template +struct store + { + static const uword N = fixed_N; + + arma_aligned cx_type coeffs_array[fixed_N]; + + inline store() {} + inline store(uword) {} + + arma_inline cx_type* coeffs_ptr() { return &coeffs_array[0]; } + arma_inline const cx_type* coeffs_ptr() const { return &coeffs_array[0]; } + }; + + + +template +struct store + { + const uword N; + + podarray coeffs_array; + + inline store() : N(0) {} + inline store(uword in_N) : N(in_N) { coeffs_array.set_size(N); } + + arma_inline cx_type* coeffs_ptr() { return coeffs_array.memptr(); } + arma_inline const cx_type* coeffs_ptr() const { return coeffs_array.memptr(); } + }; + + + +template +class fft_engine : public store 0)> + { + public: + + typedef typename get_pod_type::result T; + + using store 0)>::N; + using store 0)>::coeffs_ptr; + + podarray residue; + podarray radix; + + podarray tmp_array; + + + template + inline + uword + calc_radix() + { + uword i = 0; + + for(uword n = N, r=4; n >= 2; ++i) + { + while( (n % r) > 0 ) + { + switch(r) + { + case 2: r = 3; break; + case 4: r = 2; break; + default: r += 2; break; + } + + if(r*r > n) { r = n; } + } + + n /= r; + + if(fill) + { + residue[i] = n; + radix[i] = r; + } + } + + return i; + } + + + + inline + fft_engine(const uword in_N) + : store< cx_type, fixed_N, (fixed_N > 0) >(in_N) + { + arma_extra_debug_sigprint(); + + const uword len = calc_radix(); + + residue.set_size(len); + radix.set_size(len); + + calc_radix(); + + + // calculate the constant coefficients + + cx_type* coeffs = coeffs_ptr(); + + const T k = T( (inverse) ? +2 : -2 ) * std::acos( T(-1) ) / T(N); + + for(uword i=0; i < N; ++i) { coeffs[i] = std::exp( cx_type(T(0), i*k) ); } + } + + + + arma_hot + inline + void + butterfly_2(cx_type* Y, const uword stride, const uword m) + { + arma_extra_debug_sigprint(); + + const cx_type* coeffs = coeffs_ptr(); + + for(uword i=0; i < m; ++i) + { + const cx_type t = Y[i+m] * coeffs[i*stride]; + + Y[i+m] = Y[i] - t; + Y[i ] += t; + } + } + + + + arma_hot + inline + void + butterfly_3(cx_type* Y, const uword stride, const uword m) + { + arma_extra_debug_sigprint(); + + arma_aligned cx_type tmp[5]; + + cx_type* coeffs1 = coeffs_ptr(); + cx_type* coeffs2 = coeffs1; + + const T coeff_sm_imag = coeffs1[stride*m].imag(); + + const uword n = m*2; + + // TODO: rearrange the indices within tmp[] into a more sane order + + for(uword i = m; i > 0; --i) + { + tmp[1] = Y[m] * (*coeffs1); + tmp[2] = Y[n] * (*coeffs2); + + tmp[0] = tmp[1] - tmp[2]; + tmp[0] *= coeff_sm_imag; + + tmp[3] = tmp[1] + tmp[2]; + + Y[m] = cx_type( (Y[0].real() - (0.5*tmp[3].real())), (Y[0].imag() - (0.5*tmp[3].imag())) ); + + Y[0] += tmp[3]; + + + Y[n] = cx_type( (Y[m].real() + tmp[0].imag()), (Y[m].imag() - tmp[0].real()) ); + + Y[m] += cx_type( -tmp[0].imag(), tmp[0].real() ); + + Y++; + + coeffs1 += stride; + coeffs2 += stride*2; + } + } + + + + arma_hot + inline + void + butterfly_4(cx_type* Y, const uword stride, const uword m) + { + arma_extra_debug_sigprint(); + + arma_aligned cx_type tmp[7]; + + const cx_type* coeffs = coeffs_ptr(); + + const uword m2 = m*2; + const uword m3 = m*3; + + // TODO: rearrange the indices within tmp[] into a more sane order + + for(uword i=0; i < m; ++i) + { + tmp[0] = Y[i + m ] * coeffs[i*stride ]; + tmp[2] = Y[i + m3] * coeffs[i*stride*3]; + tmp[3] = tmp[0] + tmp[2]; + + //tmp[4] = tmp[0] - tmp[2]; + //tmp[4] = (inverse) ? cx_type( -(tmp[4].imag()), tmp[4].real() ) : cx_type( tmp[4].imag(), -tmp[4].real() ); + + tmp[4] = (inverse) + ? cx_type( (tmp[2].imag() - tmp[0].imag()), (tmp[0].real() - tmp[2].real()) ) + : cx_type( (tmp[0].imag() - tmp[2].imag()), (tmp[2].real() - tmp[0].real()) ); + + tmp[1] = Y[i + m2] * coeffs[i*stride*2]; + tmp[5] = Y[i] - tmp[1]; + + + Y[i ] += tmp[1]; + Y[i + m2] = Y[i] - tmp[3]; + Y[i ] += tmp[3]; + Y[i + m ] = tmp[5] + tmp[4]; + Y[i + m3] = tmp[5] - tmp[4]; + } + } + + + + inline + arma_hot + void + butterfly_5(cx_type* Y, const uword stride, const uword m) + { + arma_extra_debug_sigprint(); + + arma_aligned cx_type tmp[13]; + + const cx_type* coeffs = coeffs_ptr(); + + const T a_real = coeffs[stride*1*m].real(); + const T a_imag = coeffs[stride*1*m].imag(); + + const T b_real = coeffs[stride*2*m].real(); + const T b_imag = coeffs[stride*2*m].imag(); + + cx_type* Y0 = Y; + cx_type* Y1 = Y + 1*m; + cx_type* Y2 = Y + 2*m; + cx_type* Y3 = Y + 3*m; + cx_type* Y4 = Y + 4*m; + + for(uword i=0; i < m; ++i) + { + tmp[0] = (*Y0); + + tmp[1] = (*Y1) * coeffs[stride*1*i]; + tmp[2] = (*Y2) * coeffs[stride*2*i]; + tmp[3] = (*Y3) * coeffs[stride*3*i]; + tmp[4] = (*Y4) * coeffs[stride*4*i]; + + tmp[7] = tmp[1] + tmp[4]; + tmp[8] = tmp[2] + tmp[3]; + tmp[9] = tmp[2] - tmp[3]; + tmp[10] = tmp[1] - tmp[4]; + + (*Y0) += tmp[7]; + (*Y0) += tmp[8]; + + tmp[5] = tmp[0] + cx_type( ( (tmp[7].real() * a_real) + (tmp[8].real() * b_real) ), ( (tmp[7].imag() * a_real) + (tmp[8].imag() * b_real) ) ); + + tmp[6] = cx_type( ( (tmp[10].imag() * a_imag) + (tmp[9].imag() * b_imag) ), ( -(tmp[10].real() * a_imag) - (tmp[9].real() * b_imag) ) ); + + (*Y1) = tmp[5] - tmp[6]; + (*Y4) = tmp[5] + tmp[6]; + + tmp[11] = tmp[0] + cx_type( ( (tmp[7].real() * b_real) + (tmp[8].real() * a_real) ), ( (tmp[7].imag() * b_real) + (tmp[8].imag() * a_real) ) ); + + tmp[12] = cx_type( ( -(tmp[10].imag() * b_imag) + (tmp[9].imag() * a_imag) ), ( (tmp[10].real() * b_imag) - (tmp[9].real() * a_imag) ) ); + + (*Y2) = tmp[11] + tmp[12]; + (*Y3) = tmp[11] - tmp[12]; + + Y0++; + Y1++; + Y2++; + Y3++; + Y4++; + } + } + + + + arma_hot + inline + void + butterfly_N(cx_type* Y, const uword stride, const uword m, const uword r) + { + arma_extra_debug_sigprint(); + + const cx_type* coeffs = coeffs_ptr(); + + tmp_array.set_min_size(r); + cx_type* tmp = tmp_array.memptr(); + + for(uword u=0; u < m; ++u) + { + uword k = u; + + for(uword v=0; v < r; ++v) + { + tmp[v] = Y[k]; + k += m; + } + + k = u; + + for(uword v=0; v < r; ++v) + { + Y[k] = tmp[0]; + + uword j = 0; + + for(uword w=1; w < r; ++w) + { + j += stride * k; + + if(j >= N) { j -= N; } + + Y[k] += tmp[w] * coeffs[j]; + } + + k += m; + } + } + } + + + + inline + void + run(cx_type* Y, const cx_type* X, const uword stage = 0, const uword stride = 1) + { + arma_extra_debug_sigprint(); + + const uword m = residue[stage]; + const uword r = radix[stage]; + + const cx_type *Y_end = Y + r*m; + + if(m == 1) + { + for(cx_type* Yi = Y; Yi != Y_end; Yi++, X += stride) { (*Yi) = (*X); } + } + else + { + const uword next_stage = stage + 1; + const uword next_stride = stride * r; + + for(cx_type* Yi = Y; Yi != Y_end; Yi += m, X += stride) { run(Yi, X, next_stage, next_stride); } + } + + switch(r) + { + case 2: butterfly_2(Y, stride, m ); break; + case 3: butterfly_3(Y, stride, m ); break; + case 4: butterfly_4(Y, stride, m ); break; + case 5: butterfly_5(Y, stride, m ); break; + default: butterfly_N(Y, stride, m, r); break; + } + } + + + }; Added: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp (rev 0) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rcpp -r 4311 From noreply at r-forge.r-project.org Sun Apr 28 03:58:50 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 28 Apr 2013 03:58:50 +0200 (CEST) Subject: [Rcpp-commits] r4312 - in pkg/Rcpp: . inst src Message-ID: <20130428015851.26EE7183ECB@r-forge.r-project.org> Author: edd Date: 2013-04-28 03:58:44 +0200 (Sun, 28 Apr 2013) New Revision: 4312 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/src/Makevars Log: in src/Makevars, improved use as well as a new possible overrride of /usr/bin/install_name_tool on OS X, once again contributed by Simon Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-20 01:15:28 UTC (rev 4311) +++ pkg/Rcpp/ChangeLog 2013-04-28 01:58:44 UTC (rev 4312) @@ -1,13 +1,18 @@ +2013-04-27 Dirk Eddelbuettel + + * src/Makevars: Improved use as well as a new possible overrride of + /usr/bin/install_name_tool on OS X, once again contributed by Simon + 2013-04-16 Romain Francois * include/Rcpp/sugar/functions/na_omit.h : new function na_omit to remove - missing values from a vector. + missing values from a vector. * src/attributes.cpp : portability fix (from Martyn Plummer) * include/Rcpp/api/meat/Vector.h : portability fix (from Martyn Plummer) - + 2013-04-14 Romain Francois - * include/Rcpp/traits/is_na.h: complex version did not work. + * include/Rcpp/traits/is_na.h: complex version did not work. added default for VECSXP and EXPRSXP versions 2013-04-02 Dirk Eddelbuettel Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-20 01:15:28 UTC (rev 4311) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-28 01:58:44 UTC (rev 4312) @@ -14,14 +14,16 @@ \item The \code{operator-()} semantics for \code{Date} and \code{Datetime} are now more inline with standard C++ behaviour. } - \item Changes in sugar: + \item Changes in Rcpp sugar: \itemize{ - \item New function \code{na_omit} based on the stack overflow thread + \item New function \code{na_omit} based on the StackOverflow thread http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values } - \item Portability + \item Changes in Rcpp build tools: \itemize{ \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult. + \item The \code{src/Makevars} file can now optionally ovveride the + path for \code{/usr/bin/install_name_tool} which is used on OS X. } } Modified: pkg/Rcpp/src/Makevars =================================================================== --- pkg/Rcpp/src/Makevars 2013-04-20 01:15:28 UTC (rev 4311) +++ pkg/Rcpp/src/Makevars 2013-04-28 01:58:44 UTC (rev 4312) @@ -3,8 +3,8 @@ # Makevars for Rcpp # # Copyright (C) 2008 - 2009 Dirk Eddelbuettel -# Copyright (C) 2008 Simon Urbanek -# Copyright (C) 2009 - 2011 Dirk Eddelbuettel and Romain Francois +# Copyright (C) 2008, 2013 Simon Urbanek +# Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois ## $(SHLIB) is the usual default target that is built automatically from all source ## files in this directory. userLibrary is an additional target for the second library @@ -31,7 +31,7 @@ $(USERLIB): $(OBJECTS) $(SHLIB_CXXLD) -o $(USERLIB) $(OBJECTS) $(SHLIB_CXXLDFLAGS) $(ALL_LIBS) - @if test -e "/usr/bin/install_name_tool"; then /usr/bin/install_name_tool -id $(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB) $(USERLIB); fi + @: $${INSTALL_NAME_TOOL=/usr/bin/install_name_tool}; if test -e "$$INSTALL_NAME_TOOL"; then "$$INSTALL_NAME_TOOL" -id '$(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB)' '$(USERLIB)'; fi $(USERLIBST): $(OBJECTS) $(AR) qc $(USERLIBST) $(OBJECTS) From noreply at r-forge.r-project.org Sun Apr 28 15:23:13 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 28 Apr 2013 15:23:13 +0200 (CEST) Subject: [Rcpp-commits] r4313 - in pkg/Rcpp: . inst src Message-ID: <20130428132313.D8036185023@r-forge.r-project.org> Author: edd Date: 2013-04-28 15:23:13 +0200 (Sun, 28 Apr 2013) New Revision: 4313 Modified: pkg/Rcpp/ChangeLog pkg/Rcpp/DESCRIPTION pkg/Rcpp/inst/NEWS.Rd pkg/Rcpp/src/api.cpp Log: In api.cpp, use default snprintf formatting Added missing curly brace to NEWS.Rd Increment minor release number Modified: pkg/Rcpp/ChangeLog =================================================================== --- pkg/Rcpp/ChangeLog 2013-04-28 01:58:44 UTC (rev 4312) +++ pkg/Rcpp/ChangeLog 2013-04-28 13:23:13 UTC (rev 4313) @@ -1,3 +1,8 @@ +2013-04-28 Dirk Eddelbuettel + + * src/api.cpp (Rcpp): No longer use Rd_format(Real|Complex) which is + a very verboten R internal; formatting to string is now very bare bones + 2013-04-27 Dirk Eddelbuettel * src/Makevars: Improved use as well as a new possible overrride of Modified: pkg/Rcpp/DESCRIPTION =================================================================== --- pkg/Rcpp/DESCRIPTION 2013-04-28 01:58:44 UTC (rev 4312) +++ pkg/Rcpp/DESCRIPTION 2013-04-28 13:23:13 UTC (rev 4313) @@ -1,6 +1,6 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.10.3.1 +Version: 0.10.3.2 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois, with contributions by Douglas Bates, John Chambers and JJ Allaire Modified: pkg/Rcpp/inst/NEWS.Rd =================================================================== --- pkg/Rcpp/inst/NEWS.Rd 2013-04-28 01:58:44 UTC (rev 4312) +++ pkg/Rcpp/inst/NEWS.Rd 2013-04-28 13:23:13 UTC (rev 4313) @@ -16,15 +16,16 @@ } \item Changes in Rcpp sugar: \itemize{ - \item New function \code{na_omit} based on the StackOverflow thread - http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values + \item New function \code{na_omit} based on the StackOverflow thread + http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values } \item Changes in Rcpp build tools: \itemize{ - \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult. - \item The \code{src/Makevars} file can now optionally ovveride the - path for \code{/usr/bin/install_name_tool} which is used on OS X. + \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult. + \item The \code{src/Makevars} file can now optionally ovveride the + path for \code{/usr/bin/install_name_tool} which is used on OS X. } + } } \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{ Modified: pkg/Rcpp/src/api.cpp =================================================================== --- pkg/Rcpp/src/api.cpp 2013-04-28 01:58:44 UTC (rev 4312) +++ pkg/Rcpp/src/api.cpp 2013-04-28 13:23:13 UTC (rev 4313) @@ -1753,7 +1753,7 @@ } template <> const char* coerce_to_string(double x){ - int w,d,e ; + //int w,d,e ; // cf src/main/format.c in R's sources: // The return values are // w : the required field width @@ -1762,23 +1762,25 @@ // // nsmall specifies the minimum number of decimal digits in fixed format: // it is 0 except when called from do_format. - Rf_formatReal( &x, 1, &w, &d, &e, 0 ) ; + //Rf_formatReal( &x, 1, &w, &d, &e, 0 ) ; // we are no longer allowed to use this: // char* tmp = const_cast( Rf_EncodeReal(x, w, d, e, '.') ); // so approximate it poorly as static char tmp[128]; - snprintf(tmp, 127, "%*.*f", w, d, x); + //snprintf(tmp, 127, "%*.*f", w, d, x); + snprintf(tmp, 127, "%f", x); // FIXME: barebones defaults return dropTrailing0(tmp, '.'); } template <> const char* coerce_to_string(Rcomplex x){ - int wr, dr, er, wi, di, ei; - Rf_formatComplex(&x, 1, &wr, &dr, &er, &wi, &di, &ei, 0); + //int wr, dr, er, wi, di, ei; + //Rf_formatComplex(&x, 1, &wr, &dr, &er, &wi, &di, &ei, 0); // we are no longer allowed to use this: // Rf_EncodeComplex(x, wr, dr, er, wi, di, ei, '.' ); // so approximate it poorly as static char tmp[128]; - snprintf(tmp, 127, "%*.*f+%*.*fi", wr, dr, x.r, wi, di, x.i); + //snprintf(tmp, 127, "%*.*f+%*.*fi", wr, dr, x.r, wi, di, x.i); + snprintf(tmp, 127, "%*.*f+%*.*fi", x.r, x.i); // FIXEM: barebones default formatting return tmp; } From noreply at r-forge.r-project.org Tue Apr 30 14:11:22 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 30 Apr 2013 14:11:22 +0200 (CEST) Subject: [Rcpp-commits] r4314 - in pkg/RcppArmadillo: . debian inst inst/include/armadillo_bits Message-ID: <20130430121122.688F3184F46@r-forge.r-project.org> Author: edd Date: 2013-04-30 14:11:22 +0200 (Tue, 30 Apr 2013) New Revision: 4314 Modified: pkg/RcppArmadillo/ChangeLog pkg/RcppArmadillo/DESCRIPTION pkg/RcppArmadillo/debian/changelog pkg/RcppArmadillo/inst/NEWS.Rd pkg/RcppArmadillo/inst/include/armadillo_bits/SpCol_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp Log: RcppArmadillo 0.3.810.2 with Armadillo 3.810.2 Modified: pkg/RcppArmadillo/ChangeLog =================================================================== --- pkg/RcppArmadillo/ChangeLog 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/ChangeLog 2013-04-30 12:11:22 UTC (rev 4314) @@ -1,3 +1,10 @@ +2013-04-30 Dirk Eddelbuettel + + * DESCRIPTION: Release 0.3.810.2 + * inst/NEWS: Release 0.3.810.2 + * inst/include/*: Upgraded to new release 3.810.2 of Armadillo + * debian/*: Similarly updated for new release to Debian + 2013-04-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.810.0 Modified: pkg/RcppArmadillo/DESCRIPTION =================================================================== --- pkg/RcppArmadillo/DESCRIPTION 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/DESCRIPTION 2013-04-30 12:11:22 UTC (rev 4314) @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: Rcpp integration for Armadillo templated linear algebra library -Version: 0.3.810.0 +Version: 0.3.810.2 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.810.0). Thus users do not need to + Armadillo library (currently version 3.810.2). 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-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/debian/changelog 2013-04-30 12:11:22 UTC (rev 4314) @@ -1,3 +1,9 @@ +r-cran-rcpparmadillo (0.3.810.2-1) unstable; urgency=low + + * New upstream release + + -- Dirk Eddelbuettel Tue, 30 Apr 2013 07:07:01 -0500 + r-cran-rcpparmadillo (0.3.810.0-1) unstable; urgency=low * New upstream release Modified: pkg/RcppArmadillo/inst/NEWS.Rd =================================================================== --- pkg/RcppArmadillo/inst/NEWS.Rd 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/inst/NEWS.Rd 2013-04-30 12:11:22 UTC (rev 4314) @@ -2,6 +2,15 @@ \title{News for Package 'RcppArmadillo'} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in RcppArmadillo version 0.3.810.2 (2013-04-30)}{ + \itemize{ + \item Upgraded to Armadillo release Version 3.810.2 + \itemize{ + \item minor fix for initialisation of sparse matrices + } + } +} + \section{Changes in RcppArmadillo version 0.3.810.0 (2013-04-19)}{ \itemize{ \item Upgraded to Armadillo release Version 3.810.0 (Newell Highway) Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpCol_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpCol_meat.hpp 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpCol_meat.hpp 2013-04-30 12:11:22 UTC (rev 4314) @@ -23,7 +23,7 @@ -//! construct a column vector with the specified number of n_elem +//! construct a column vector with the specified number of elements template inline SpCol::SpCol(const uword in_n_elem) @@ -346,7 +346,7 @@ { arma_extra_debug_sigprint(); - arma_debug_check( row_num >= SpMat::n_rows, "Col::shed_row(): out of bounds"); + arma_debug_check( row_num >= SpMat::n_rows, "SpCol::shed_row(): out of bounds"); shed_rows(row_num, row_num); } @@ -364,7 +364,7 @@ arma_debug_check ( (in_row1 > in_row2) || (in_row2 >= SpMat::n_rows), - "Col::shed_rows(): indices out of bounds or incorrectly used" + "SpCol::shed_rows(): indices out of bounds or incorrectly used" ); const uword diff = (in_row2 - in_row1 + 1); @@ -532,6 +532,7 @@ } + #ifdef ARMA_EXTRA_SPCOL_MEAT #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPCOL_MEAT) #endif Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp 2013-04-30 12:11:22 UTC (rev 4314) @@ -1,7 +1,7 @@ -// Copyright (C) 2011-2012 Ryan Curtin +// Copyright (C) 2011-2013 Ryan Curtin +// Copyright (C) 2012-2013 Conrad Sanderson // Copyright (C) 2011 Matthew Amidon -// Copyright (C) 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 // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -65,18 +65,7 @@ inline const SpMat& operator=(const std::string& text); inline SpMat(const SpMat& x); - /** - * Construct a sparse matrix and insert a large number of points at once. - * locations.row[0] should be row indices, locations.row[1] should be column - * indices, and values should be the corresponding values. If sorted is true, - * then it is assumed that the locations and values are already sorted in - * column-major ordering. - * - * The size is automatically determined to be the minimum size to fit all - * points in the locations list. - */ template inline SpMat(const Base& locations, const Base& values, const bool sort_locations = true); - //! Same as the other batch insertion constructor, but with manual size specification. template inline SpMat(const Base& locations, const Base& values, const uword n_rows, const uword n_cols, const bool sort_locations = true); inline const SpMat& operator=(const eT val); //! Sets size to 1x1. Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp 2013-04-30 12:11:22 UTC (rev 4314) @@ -1,7 +1,7 @@ -// Copyright (C) 2011-2012 Ryan Curtin +// Copyright (C) 2011-2013 Ryan Curtin +// Copyright (C) 2012-2013 Conrad Sanderson // Copyright (C) 2011 Matthew Amidon -// Copyright (C) 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 // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -3873,7 +3873,7 @@ ( ( ( (in_rows > ARMA_MAX_UHWORD) || (in_cols > ARMA_MAX_UHWORD) ) - ? ( (float(in_rows) * float(in_cols)) > float(ARMA_MAX_UHWORD) ) + ? ( (float(in_rows) * float(in_cols)) > float(ARMA_MAX_UWORD) ) : false ), "SpMat::init(): requested size is too large" Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp =================================================================== --- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-04-28 13:23:13 UTC (rev 4313) +++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2013-04-30 12:11:22 UTC (rev 4314) @@ -13,7 +13,7 @@ #define ARMA_VERSION_MAJOR 3 #define ARMA_VERSION_MINOR 810 -#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_PATCH 2 #define ARMA_VERSION_NAME "Newell Highway"