[Rcpp-commits] r3070 - pkg/RcppEigen/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 15 00:58:15 CEST 2011


Author: dmbates
Date: 2011-06-15 00:58:15 +0200 (Wed, 15 Jun 2011)
New Revision: 3070

Modified:
   pkg/RcppEigen/src/fastLm.cpp
Log:
Cosmetic fixes.


Modified: pkg/RcppEigen/src/fastLm.cpp
===================================================================
--- pkg/RcppEigen/src/fastLm.cpp	2011-06-14 22:52:13 UTC (rev 3069)
+++ pkg/RcppEigen/src/fastLm.cpp	2011-06-14 22:58:15 UTC (rev 3070)
@@ -95,7 +95,7 @@
 	    throw std::invalid_argument("size mismatch");
 	
 	MatrixXd      A = Map<MatrixXd>(X.begin(), n, p); // shares storage
-	VectorXd b      = Map<VectorXd>(y.begin(), n);
+	VectorXd      b = Map<VectorXd>(y.begin(), n);
 
 	HouseholderQR<MatrixXd> Aqr(A);
 	VectorXd   coef = Aqr.solve(b);
@@ -132,7 +132,7 @@
 	MatrixXd        A = Map<MatrixXd>(X.begin(), n, p); // shares storage
 	VectorXd        b = Map<VectorXd>(y.begin(), n);
 
-	LLT<MatrixXd> Ch(SelfAdjointView<MatrixXd, Lower>(MatrixXd::Zero(p, p)).rankUpdate(A.adjoint()));
+	LLT<MatrixXd>  Ch(SelfAdjointView<MatrixXd, Lower>(MatrixXd::Zero(p, p)).rankUpdate(A.adjoint()));
 	VectorXd     coef = Ch.solve(A.adjoint() * b);
 	double          s = std::sqrt((b - A*coef).squaredNorm()/df);
 
@@ -168,7 +168,7 @@
 	double         s2 = (b - A*coef).squaredNorm()/df;
 
 	ArrayXd        se = (Ch.solve(MatrixXd::Identity(p, p)).diagonal().array() * s2).sqrt();
-	NumericVector Rse(p);
+	NumericVector Rse(p);	// should define a wrap method for ArrayXd, ArrayXXd, etc.
 	std::copy(se.data(), se.data() + p, Rse.begin());
 			    
 	return List::create(_["coefficients"] = coef,



More information about the Rcpp-commits mailing list