[Rcpp-commits] r3256 - pkg/RcppEigen/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 1 16:52:25 CET 2011
Author: dmbates
Date: 2011-11-01 16:52:25 +0100 (Tue, 01 Nov 2011)
New Revision: 3256
Modified:
pkg/RcppEigen/src/fastLm.cpp
Log:
Use asDiagonal method, not constructor for DiagonalMatrix templated class
Modified: pkg/RcppEigen/src/fastLm.cpp
===================================================================
--- pkg/RcppEigen/src/fastLm.cpp 2011-11-01 15:16:41 UTC (rev 3255)
+++ pkg/RcppEigen/src/fastLm.cpp 2011-11-01 15:52:25 UTC (rev 3256)
@@ -141,7 +141,7 @@
SVD::SVD(const Map<MatrixXd> &X, const Map<VectorXd> &y) : lm(X, y) {
JacobiSVD<MatrixXd> UDV(X.jacobiSvd(ComputeThinU|ComputeThinV));
MatrixXd VDi(UDV.matrixV() *
- DiagonalMatrix(Dplus(UDV.singularValues().array()).matrix()));
+ Dplus(UDV.singularValues().array()).matrix().asDiagonal());
m_coef = VDi * UDV.matrixU().adjoint() * y;
m_fitted = X * m_coef;
m_se = VDi.rowwise().norm();
@@ -151,7 +151,7 @@
: lm(X, y) {
SelfAdjointEigenSolver<MatrixXd> eig(XtX().selfadjointView<Lower>());
MatrixXd VDi(eig.eigenvectors() *
- DiagonalMatrix(Dplus(eig.eigenvalues().array()).sqrt().matrix());
+ Dplus(eig.eigenvalues().array()).sqrt().matrix().asDiagonal());
m_coef = VDi * VDi.adjoint() * X.adjoint() * y;
m_fitted = X * m_coef;
m_se = VDi.rowwise().norm();
More information about the Rcpp-commits
mailing list