[Rcpp-commits] r917 - in pkg/RcppArmadillo: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 19 14:02:10 CET 2010


Author: romain
Date: 2010-03-19 14:02:10 +0100 (Fri, 19 Mar 2010)
New Revision: 917

Modified:
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/src/RcppArmadillo.cpp
   pkg/RcppArmadillo/src/fastLm.cpp
Log:
adapt RcppArmadillo (no more make_list, using create instead)

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2010-03-19 12:24:08 UTC (rev 916)
+++ pkg/RcppArmadillo/DESCRIPTION	2010-03-19 13:02:10 UTC (rev 917)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp/Armadillo translation layer
-Version: 0.1.1
+Version: 0.1.2
 Date: $Date$
 Author: Romain Francois and Dirk Eddelbuettel
 Maintainer: Dirk Eddelbuettel and Romain Francois <RomainAndDirk at r-enthusiasts.com>
@@ -24,7 +24,7 @@
  capabilities of the Rcpp package for seamless R and C++ integration/
 License: GPL (>= 2)
 LazyLoad: yes
-Depends: Rcpp (>= 0.7.10.1)
+Depends: Rcpp (>= 0.7.10.2)
 SystemRequirements: Armadillo (>= 0.6.10), Boost
 URL: http://arma.sourceforge.net/, http://dirk.eddelbuettel.com/code/rcpp.html
 OS_type: unix

Modified: pkg/RcppArmadillo/src/RcppArmadillo.cpp
===================================================================
--- pkg/RcppArmadillo/src/RcppArmadillo.cpp	2010-03-19 12:24:08 UTC (rev 916)
+++ pkg/RcppArmadillo/src/RcppArmadillo.cpp	2010-03-19 13:02:10 UTC (rev 917)
@@ -25,20 +25,18 @@
 
 extern "C" SEXP RcppArmadillo_wrap(){
 	
-    // using the Named(.) = . notation
-    List cols = make_list( 
-    	Named( "Col<double>" ) = arma::zeros<arma::mat>(5,1), 
-    	Named( "Col<float>" )  = arma::zeros<arma::fmat>(5,1)
+    // using the Argument(.) = . notation
+    List cols = List::create( 
+    	Argument( "Col<double>" ) = arma::zeros<arma::mat>(5,1), 
+    	Argument( "Col<float>" )  = arma::zeros<arma::fmat>(5,1)
     	) ; 
-    
-    // using the Named( . , . ) notation
-    List rows = make_list( 
-    	Named( "Row<double>", arma::zeros<arma::mat>(1,5) ),
-    	Named( "Row<float>" , arma::zeros<arma::fmat>(1,5) )
+    List rows = List::create( 
+    	Argument( "Row<double>") = arma::zeros<arma::mat>(1,5),
+    	Argument( "Row<float>" ) = arma::zeros<arma::fmat>(1,5)
     	) ;
 	
     // using the _[.] = . notation
-    List matrices = make_list( 
+    List matrices = List::create( 
     	_["Mat<int>"]          = arma::eye<arma::imat>( 3,3 ), 
     	_["Mat<double>"]       = arma::eye<arma::mat>( 3,3 ),
     	_["Mat<float>"]        = arma::eye<arma::fmat>( 3, 3 ), 
@@ -68,7 +66,7 @@
     f3(1,1) = arma::zeros<arma::mat>(2,1) ;
     fields["field<colvec>"] = f3 ;
 	
-    List output = make_list( 
+    List output = List::create( 
     	_["matrices : Mat<T>"]  = matrices, 
     	_["rows : Row<T>"]      = rows,
     	_["columns : Col<T>"]   = cols, 
@@ -86,7 +84,7 @@
     arma::umat m3 = input[0] ; /* implicit as */
     arma::fmat m4 = input[1] ; /* implicit as */
 	
-    List res = make_list( 
+    List res = List::create( 
     	arma::accu( m1 ),
     	arma::accu( m2 ),
     	arma::accu( m3 ),
@@ -102,7 +100,7 @@
     arma::ucolvec m3 = input[0] ; /* implicit as */
     arma::fcolvec m4 = input[1] ; /* implicit as */
 	
-    List res = make_list( 
+    List res = List::create( 
     	arma::accu( m1 ),
     	arma::accu( m2 ),
     	arma::accu( m3 ),
@@ -118,7 +116,7 @@
     arma::urowvec m3 = input[0] ; /* implicit as */
     arma::frowvec m4 = input[1] ; /* implicit as */
 	
-    List res = make_list( 
+    List res = List::create( 
     	arma::accu( m1 ),
     	arma::accu( m2 ),
     	arma::accu( m3 ),
@@ -151,12 +149,11 @@
     if( single ){
 	return Rcpp::wrap( 10000*av.major + 100*av.minor + av.patch ) ;
     }
-    IntegerVector version(3); 
-    version = av.major, av.minor, av.patch ;
-    CharacterVector names(3); 
-    names = "major", "minor", "patch" ;
-    version.names() = names ;
-    version.attr("class" ) = "armadillo_version" ;
+    IntegerVector version = IntegerVector::create( 
+    	_["major"] = av.major, 
+    	_["minor"] = av.minor, 
+    	_["patch"] = av.patch
+    	) ;
     return version ;
 }
 

Modified: pkg/RcppArmadillo/src/fastLm.cpp
===================================================================
--- pkg/RcppArmadillo/src/fastLm.cpp	2010-03-19 12:24:08 UTC (rev 916)
+++ pkg/RcppArmadillo/src/fastLm.cpp	2010-03-19 13:02:10 UTC (rev 917)
@@ -46,9 +46,9 @@
     						// std.error of estimate 
     arma::colvec stderrest = arma::sqrt( sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) );
 
-    return Rcpp::make_list( 
-    	Rcpp::Named("coefficients") = coef,
-    	Rcpp::Named("stderr")       = stderrest
+    return Rcpp::List::create( 
+    	Rcpp::Argument("coefficients") = coef,
+    	Rcpp::Argument("stderr")       = stderrest
     ) ;
     
 }



More information about the Rcpp-commits mailing list