@@ -44,17 +44,17 @@ namespace lmsol {
4444 m_y (y),
4545 m_n(X.rows()),
4646 m_p(X.cols()),
47- m_coef(VectorXd::Constant(m_p, ::NA_REAL)),
47+ m_coef(VectorXd::Constant(m_p, ::NA_REAL)), // #nocov
4848 m_r(::NA_INTEGER),
4949 m_fitted(m_n),
50- m_se(VectorXd::Constant(m_p, ::NA_REAL)),
50+ m_se(VectorXd::Constant(m_p, ::NA_REAL)), // #nocov
5151 m_usePrescribedThreshold(false ) {
5252 }
5353
54- lm& lm::setThreshold (const RealScalar& threshold) {
54+ lm& lm::setThreshold (const RealScalar& threshold) { // #nocov start
5555 m_usePrescribedThreshold = true ;
5656 m_prescribedThreshold = threshold;
57- return *this ;
57+ return *this ; // #nocov end
5858 }
5959
6060 inline ArrayXd lm::Dplus (const ArrayXd& d) {
@@ -71,16 +71,16 @@ namespace lmsol {
7171 }
7272
7373 /* * Returns the threshold that will be used by certain methods such as rank().
74- *
74+ *
7575 * The default value comes from experimenting (see "LU precision
7676 * tuning" thread on the Eigen list) and turns out to be
77- * identical to Higham's formula used already in LDLt.
77+ * identical to Higham's formula used already in LDLt.
7878 *
7979 * @return The user-prescribed threshold or the default.
8080 */
8181 RealScalar lm::threshold () const {
8282 return m_usePrescribedThreshold ? m_prescribedThreshold
83- : numeric_limits<double >::epsilon () * m_p;
83+ : numeric_limits<double >::epsilon () * m_p;
8484 }
8585
8686 ColPivQR::ColPivQR (const Map<MatrixXd> &X, const Map<VectorXd> &y)
@@ -94,8 +94,8 @@ namespace lmsol {
9494 m_se = Pmat * PQR.matrixQR ().topRows (m_p).
9595 triangularView<Upper>().solve (I_p ()).rowwise ().norm ();
9696 return ;
97- }
98- MatrixXd Rinv (PQR.matrixQR ().topLeftCorner (m_r, m_r).
97+ }
98+ MatrixXd Rinv (PQR.matrixQR ().topLeftCorner (m_r, m_r). // #nocov start
9999 triangularView<Upper>().
100100 solve (MatrixXd::Identity (m_r, m_r)));
101101 VectorXd effects (PQR.householderQ ().adjoint () * y);
@@ -106,25 +106,25 @@ namespace lmsol {
106106 effects.tail (m_n - m_r).setZero ();
107107 m_fitted = PQR.householderQ () * effects;
108108 m_se.head (m_r) = Rinv.rowwise ().norm ();
109- m_se = Pmat * m_se;
109+ m_se = Pmat * m_se; // #nocov end
110110 }
111-
111+
112112 QR::QR (const Map<MatrixXd> &X, const Map<VectorXd> &y) : lm(X, y) {
113113 HouseholderQR<MatrixXd> QR (X);
114114 m_coef = QR.solve (y);
115115 m_fitted = X * m_coef;
116116 m_se = QR.matrixQR ().topRows (m_p).
117117 triangularView<Upper>().solve (I_p ()).rowwise ().norm ();
118118 }
119-
120-
119+
120+
121121 Llt::Llt (const Map<MatrixXd> &X, const Map<VectorXd> &y) : lm(X, y) {
122122 LLT<MatrixXd> Ch (XtX ().selfadjointView <Lower>());
123123 m_coef = Ch.solve (X.adjoint () * y);
124124 m_fitted = X * m_coef;
125125 m_se = Ch.matrixL ().solve (I_p ()).colwise ().norm ();
126126 }
127-
127+
128128 Ldlt::Ldlt (const Map<MatrixXd> &X, const Map<VectorXd> &y) : lm(X, y) {
129129 LDLT<MatrixXd> Ch (XtX ().selfadjointView <Lower>());
130130 Dplus (Ch.vectorD ()); // to set the rank
@@ -136,7 +136,7 @@ namespace lmsol {
136136 m_fitted = X * m_coef;
137137 m_se = Ch.solve (I_p ()).diagonal ().array ().sqrt ();
138138 }
139-
139+
140140 int gesdd (MatrixXd& A, ArrayXd& S, MatrixXd& Vt) {
141141 int info, mone = -1 , m = A.rows (), n = A.cols ();
142142 std::vector<int > iwork (8 * n);
@@ -222,7 +222,7 @@ namespace lmsol {
222222 if (!(colnames).isNULL ())
223223 coef.attr (" names" ) = clone (CharacterVector (colnames));
224224 }
225-
225+
226226 VectorXd resid = y - ans.fitted ();
227227 int rank = ans.rank ();
228228 int df = (rank == ::NA_INTEGER) ? n - X.cols () : n - rank;
@@ -240,9 +240,8 @@ namespace lmsol {
240240 }
241241}
242242
243- // This defines the R-callable function 'fastLm'
243+ // This defines the R-callable function 'fastLm'
244244// [[Rcpp::export]]
245245Rcpp::List fastLm_Impl (Rcpp::NumericMatrix X, Rcpp::NumericVector y, int type) {
246- return lmsol::fastLm (X, y, type);
246+ return lmsol::fastLm (X, y, type);
247247}
248-
0 commit comments