Skip to content

Commit 5ff210b

Browse files
Merge branch 'master' of https://github.com/Rcpp11/Rcpp11
2 parents 285327c + e2a71ea commit 5ff210b

17 files changed

Lines changed: 277 additions & 18 deletions

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ before_install:
77
- ./travis-tool.sh github_package hadley/testthat
88
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
99
- sudo apt-get -qq update
10-
- sudo apt-get -qq install g++-4.8
10+
- sudo apt-get -qq install g++-4.9
1111
- mkdir ~/.R
12-
- echo -e "CC=gcc-4.8 -std=gnu99\nCXX=g++-4.8 -std=c++11\nnCXX1X=g++-4.8\nCXXFLAGS=-g -O3\nCXX1XFLAGS=-g -O3\nCFLAGS=-g -O3\n" > ~/.R/Makevars
12+
- echo -e "CC=gcc-4.9 -std=gnu99\nCXX=g++-4.9 -std=c++11\nnCXX1X=g++-4.9\nCXXFLAGS=-g -O3\nCXX1XFLAGS=-g -O3\nCFLAGS=-g -O3\n" > ~/.R/Makevars
1313

1414
script:
1515
- R CMD INSTALL .

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Package: Rcpp11
22
Title: R and C++11
3-
Version: 3.1.1.0.999
4-
Date: 2014-07-22
3+
Version: 3.1.2.0.1
4+
Date: 2014-11-10
55
Authors@R: c(
66
person("Romain", "Francois", role = c("aut", "cre"), email = "romain@r-enthusiasts.com"),
77
person("Kevin", "Ushey", role = "aut", email = "kevinushey@gmail.com"),
88
person("John", "Chambers", role = "ctb", email = "jmc@r-project.org")
99
)
1010
Description: Rcpp11 includes a header only C++11 library that facilitates
1111
integration between R and modern C++.
12-
Depends: R (>= 3.1.1)
12+
Depends: R (>= 3.1.2)
1313
License: MIT + file LICENSE
1414
SystemRequirements: C++11
1515

NEWS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
# Rcpp11 3.2.0
2+
3+
* `rownames` setter and getter for `DataFrame` (#210)
4+
5+
* Added `operator+=`, `-=`, `*=` and `/=` where the rhs is a sugar expression.
6+
7+
* Added template class `Strict` to implement more rigid (no automatic coercion)
8+
arguments in attribute generated functions.
9+
10+
* Added `operator+=` etc ... for `Vector` x `primitive` case.
11+
12+
* Added `operator+=` etc ... for `Matrix` x `primitive` case.
13+
114
# Rcpp11 3.1.2
215

316
* New `wrap` implementation for `std::tuple<Args...>` (#195)
417

18+
* `colnames` and `rownames` setters for matrices (#210).
19+
20+
* Most sugar functions are now processing the expression in parallel.
21+
22+
* Forbidden symbols from the C/R API are no longer directly used, so packages can
23+
use Rcpp11 without getting the NOTE as before.
24+
525
# Rcpp11 3.1.1
626

727
* sugar `sum` now supports complex sugar vector expressions

inst/include/Rcpp.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ namespace Rcpp{
117117

118118
template <int RTYPE, typename Storage = PreserveStorage> class Vector ;
119119
template <int RTYPE, typename Storage = PreserveStorage> class Matrix ;
120-
120+
template <int RTYPE, typename Storage = PreserveStorage> class SquareMatrix ;
121+
121122
typedef Vector<STRSXP> CharacterVector ;
122123
typedef Vector<VECSXP> List ;
123124
typedef Vector<EXPRSXP> ExpressionVector ;
@@ -183,8 +184,7 @@ namespace Rcpp{
183184
#include <Rcpp/proxy/proxy.h>
184185
#include <Rcpp/Symbol.h>
185186

186-
#include <Rcpp/storage/PreserveStorage.h>
187-
#include <Rcpp/storage/NoProtectStorage.h>
187+
#include <Rcpp/storage/storage.h>
188188

189189
#include <Rcpp/Node.h>
190190
#include <Rcpp/grow.h>
@@ -234,6 +234,9 @@ namespace Rcpp{
234234

235235
#include <Rcpp/Timer.h>
236236

237+
#include <Rcpp/vector/dimnames.h>
238+
#include <Rcpp/Strict.h>
239+
237240
namespace Rcpp11 = Rcpp ;
238241

239242
#endif

inst/include/Rcpp/Array.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ namespace Rcpp{
5151
return *this ;
5252
}
5353

54+
inline int get_dim(int i) const {
55+
return index.get_dim(i) ;
56+
}
57+
5458
private:
5559
Index<N> index ;
5660
Vec data ;

inst/include/Rcpp/Index.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ namespace Rcpp{
4242
return dimensions[i] ;
4343
}
4444

45-
inline typename std::array<size_t,N>::iterator begin(){ return dimensions.begin() ; }
45+
inline typename std::array<int,N>::iterator begin(){
46+
return dimensions.begin() ;
47+
}
48+
49+
inline int get_dim(int i) const {
50+
return dimensions[i] ;
51+
}
4652

4753
private:
4854

inst/include/Rcpp/Strict.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef RCPP11_Strict_H
2+
#define RCPP11_Strict_H
3+
4+
namespace Rcpp {
5+
6+
template <typename Class>
7+
class Strict {
8+
public:
9+
Strict( SEXP x ) : obj(x){
10+
if( !is<Class>(x) ){
11+
stop( "not compatible with class %s", DEMANGLE(Class) ) ;
12+
}
13+
}
14+
15+
inline Class get() const {
16+
return Class(obj) ;
17+
}
18+
19+
private:
20+
SEXP obj ;
21+
} ;
22+
23+
}
24+
25+
#endif
26+

inst/include/Rcpp/Vector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@
3333
#include <Rcpp/vector/MatrixColumn.h>
3434
#include <Rcpp/vector/MatrixRow.h>
3535
#include <Rcpp/vector/Matrix.h>
36+
#include <Rcpp/vector/SquareMatrix.h>
3637

3738
#endif

inst/include/Rcpp/sugar/functions/unique.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace Rcpp{
55

66
template <typename eT, typename Expr>
77
inline typename traits::vector_of<eT>::type unique( const SugarVectorExpression<eT, Expr>& t ){
8-
std::unordered_set<eT> set( t.begin(), t.end() ) ;
8+
std::unordered_set<eT> set( sugar_begin(t), sugar_end(t) ) ;
99
return import( set.begin(), set.end() ) ;
1010
}
1111

1212
template <typename eT, typename Expr1, typename Expr2>
1313
inline LogicalVector in( const SugarVectorExpression<eT, Expr1>& x, const SugarVectorExpression<eT, Expr2>& table ){
14-
std::unordered_set<eT> set( table.begin(), table.end() );
15-
return transform( x.begin(), x.end(), [&set](eT y) -> Rboolean {
14+
std::unordered_set<eT> set( sugar_begin(table), sugar_end(table) );
15+
return transform( sugar_begin(x), sugar_end(x), [&set](eT y) -> Rboolean {
1616
return set.count(y) ? TRUE : FALSE ;
1717
}) ;
1818
}

inst/include/Rcpp/sugar/operators/arith_Vector_Primitive.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ operator+(const Rcpp::SugarVectorExpression<eT,Expr>& lhs, eT rhs) -> decltype(
1010
template <typename eT, typename Expr>
1111
inline auto
1212
operator-( const Rcpp::SugarVectorExpression<eT,Expr>& lhs, eT rhs) -> decltype( mapply( std::minus<eT>(), lhs, rhs ) ) {
13-
RCPP_DEBUG( "%s - %s (%d)\n", DEMANGLE(Expr), DEMANGLE(eT), rhs )
1413
return mapply( std::minus<eT>(), lhs, rhs ) ;
1514
}
1615

0 commit comments

Comments
 (0)