[Rcpp-commits] r521 - in pkg: . inst inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 30 21:24:44 CET 2010
Author: edd
Date: 2010-01-30 21:24:43 +0100 (Sat, 30 Jan 2010)
New Revision: 521
Modified:
pkg/NEWS
pkg/inst/ChangeLog
pkg/inst/unitTests/runit.RcppMatrix.R
pkg/inst/unitTests/runit.RcppVector.R
Log:
added template meta-programming item to NEWS
updated ChangeLog
added unit tests for std::vector<> returns
Modified: pkg/NEWS
===================================================================
--- pkg/NEWS 2010-01-30 19:06:54 UTC (rev 520)
+++ pkg/NEWS 2010-01-30 20:24:43 UTC (rev 521)
@@ -1,5 +1,5 @@
-0.7.4 (under development)
+0.7.4 2010-01-30
o matrix matrix-like indexing using operator() for all vector
types : IntegerVector, NumericVector, RawVector, CharacterVector
@@ -20,6 +20,10 @@
o the clone template function was introduced to explicitely
clone an RObject by duplicating the SEXP it encapsulates.
+ o even smarter wrap programming using traits and template
+ meta-programming using a private header to be include only
+ RcppCommon.h
+
o the as template is now smarter. The template now attempts to
build an object of the requested template parameter T by using the
constructor for the type taking a SEXP. This allows third party code
@@ -53,7 +57,8 @@
o Environment::assign becomes a template and also uses wrap to
create a suitable SEXP
- o Many more unit tests for the new features
+ o Many more unit tests for the new features; also added unit tests
+ for older API
0.7.3 2010-01-21
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2010-01-30 19:06:54 UTC (rev 520)
+++ pkg/inst/ChangeLog 2010-01-30 20:24:43 UTC (rev 521)
@@ -1,8 +1,13 @@
+2010-01-30 Dirk Eddelbuettel <edd at debian.org>
+
+ * inst/unitTests/runit.RcppMatrix.R: also test STL return
+ * inst/unitTests/runit.RcppVector.R: added
+
2010-01-30 Romain Francois <francoisromain at free.fr>
- * src/Rcpp/internal/wrap.h: rework wrap using traits and
- template meta programming. wrap is now really a template
- and has many generated specializations. This file is
+ * src/Rcpp/internal/wrap.h: rework wrap using traits and
+ template meta programming. wrap is now really a template
+ and has many generated specializations. This file is
a private header and should only be included by RcppCommon.h
* src/Rcpp/Language.h: Language gains Function aware constructors
@@ -16,33 +21,33 @@
efficiently.
* src/Rcpp/DottedPair.h: Pairlist and Language are now derived
- from the new virtual class DottedPair since both class were
+ from the new virtual class DottedPair since both class were
almost identical
* src/Rcpp/SimpleVector.h: simple vectors gain a range
based assign method and a range based assign constructor
- * inst/unitTests/runit.IntegerVector.R: new unit test
+ * inst/unitTests/runit.IntegerVector.R: new unit test
test.IntegerVector.range.constructors
-
+
* src/Rcpp/Dimension.h: new class Rcpp::Dimension to support
creation of vectors with dimensions
-
+
* src/Rcpp/*Vector.h: using Rcpp::Dimension
-
- * src/Rcpp/SimpleVector.h: data is initialized with 0 when
+
+ * src/Rcpp/SimpleVector.h: data is initialized with 0 when
the object is constructed from size or Dimension constructor
-
- * inst/unitTestsrunit.CharacterVector.R: new unit test to test
+
+ * inst/unitTestsrunit.CharacterVector.R: new unit test to test
constructors using Dimension
* inst/unitTests/runit.IntegerVector.R: idem
* inst/unitTests/runit.GenericVector.R: idem
-
+
* R/unit.tests.R: new unexported function "test" to trigger
unit tests using installed test cases
* src/Rcpp/CharacterVector.h: minor bug fix in assign
- * inst/unitTest/runit.RcppResultSet.R: compare time using
+ * inst/unitTest/runit.RcppResultSet.R: compare time using
as.numeric to avoid timezone problems
2010-01-27 Dirk Eddelbuettel <edd at debian.org>
Modified: pkg/inst/unitTests/runit.RcppMatrix.R
===================================================================
--- pkg/inst/unitTests/runit.RcppMatrix.R 2010-01-30 19:06:54 UTC (rev 520)
+++ pkg/inst/unitTests/runit.RcppMatrix.R 2010-01-30 20:24:43 UTC (rev 521)
@@ -29,10 +29,12 @@
rs.add("rows", m.rows());
rs.add("cols", m.cols());
rs.add("p22", m(1,1));
+ std::vector<std::vector<int> > mm = m.stlMatrix();
+ rs.add("m", mm);
return rs.getReturnList();';
funx <- cfunction(signature(x="numeric"), src, Rcpp=TRUE)
- checkEquals(funx(x=matrix(1:6,2,3,byrow=TRUE)),
- list(dim1=2, dim2=3, rows=2, cols=3, p22=5),
+ M <- matrix(1:6,2,3,byrow=TRUE)
+ checkEquals(funx(x=M), list(dim1=2, dim2=3, rows=2, cols=3, p22=5, m=M),
msg = "RcppMatrix.int")
}
@@ -44,10 +46,12 @@
rs.add("rows", m.rows());
rs.add("cols", m.cols());
rs.add("p22", m(1,1));
+ std::vector<std::vector<double> > mm = m.stlMatrix();
+ rs.add("m", mm);
return rs.getReturnList();';
funx <- cfunction(signature(x="numeric"), src, Rcpp=TRUE)
- checkEquals(funx(x=matrix(1:6,2,3,byrow=TRUE)),
- list(dim1=2, dim2=3, rows=2, cols=3, p22=5),
+ M <- matrix(1:6,2,3,byrow=TRUE)
+ checkEquals(funx(x=M), list(dim1=2, dim2=3, rows=2, cols=3, p22=5, m=M),
msg = "RcppMatrix.double")
}
Modified: pkg/inst/unitTests/runit.RcppVector.R
===================================================================
--- pkg/inst/unitTests/runit.RcppVector.R 2010-01-30 19:06:54 UTC (rev 520)
+++ pkg/inst/unitTests/runit.RcppVector.R 2010-01-30 20:24:43 UTC (rev 521)
@@ -26,9 +26,11 @@
RcppResultSet rs;
rs.add("size", m.size());
rs.add("p2", m(1));
+ std::vector<int> v = m.stlVector();
+ rs.add("v", v);
return rs.getReturnList();';
funx <- cfunction(signature(x="numeric"), src, Rcpp=TRUE)
- checkEquals(funx(x=c(1:6)), list(size=6, p2=2), msg="RcppVector.int")
+ checkEquals(funx(x=c(1:6)), list(size=6, p2=2, v=c(1:6)), msg="RcppVector.int")
}
test.RcppVector.double <- function() {
@@ -36,9 +38,11 @@
RcppResultSet rs;
rs.add("size", m.size());
rs.add("p2", m(1));
+ std::vector<double> v = m.stlVector();
+ rs.add("v", v);
return rs.getReturnList();';
funx <- cfunction(signature(x="numeric"), src, Rcpp=TRUE)
- checkEquals(funx(x=c(1:6)), list(size=6, p2=2), msg="RcppVector.double")
+ checkEquals(funx(x=c(1:6)), list(size=6, p2=2, v=c(1:6)), msg="RcppVector.double")
}
More information about the Rcpp-commits
mailing list