[Rcpp-commits] r927 - in pkg/RcppArmadillo: inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 20 13:56:34 CET 2010


Author: edd
Date: 2010-03-20 13:56:33 +0100 (Sat, 20 Mar 2010)
New Revision: 927

Modified:
   pkg/RcppArmadillo/inst/ChangeLog
   pkg/RcppArmadillo/src/fastLm.cpp
Log:
small fix for fastLm needed with Arma 0.8.2 -- maybe we should require 0.9.* or even 0.9.2 givem the bugreport by Davor?


Modified: pkg/RcppArmadillo/inst/ChangeLog
===================================================================
--- pkg/RcppArmadillo/inst/ChangeLog	2010-03-20 09:06:52 UTC (rev 926)
+++ pkg/RcppArmadillo/inst/ChangeLog	2010-03-20 12:56:33 UTC (rev 927)
@@ -1,7 +1,11 @@
+2010-03-20  Dirk Eddelbuettel  <edd at max.nulle.part>
+
+	* src/fastLm.cpp: Small fix for Armadillo 0.8.2
+
 2010-03-17   Romain Francois <romain at r-enthusiasts.com>
 
 	* src/fastLm.cpp: added some arma:: prefix
-	
+
 	* src/RcppArmadillo.cpp: update examples to use make_list and showcase
 	various ways to use them : Named(.)=., _[.] = , Named( ., . )
 

Modified: pkg/RcppArmadillo/src/fastLm.cpp
===================================================================
--- pkg/RcppArmadillo/src/fastLm.cpp	2010-03-20 09:06:52 UTC (rev 926)
+++ pkg/RcppArmadillo/src/fastLm.cpp	2010-03-20 12:56:33 UTC (rev 927)
@@ -44,7 +44,12 @@
 	double sig2 = ( arma::trans(resid)*resid/(n-k) );
 #endif
     						// std.error of estimate 
+#if ARMA_VERSION_GE_090
     arma::colvec stderrest = arma::sqrt( sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) );
+#else
+    arma::mat xtxinv = arma::inv(arma::trans(X)*X);
+    arma::colvec stderrest = arma::sqrt( sig2 * xtxinv.diag() );
+#endif
 
     return Rcpp::List::create( 
     	Rcpp::Named("coefficients") = coef,



More information about the Rcpp-commits mailing list