[Genabel-commits] r1716 - pkg/ProbABEL/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 28 23:12:55 CEST 2014


Author: lckarssen
Date: 2014-04-28 23:12:55 +0200 (Mon, 28 Apr 2014)
New Revision: 1716

Modified:
   pkg/ProbABEL/src/reg1.cpp
   pkg/ProbABEL/src/reg1.h
Log:
Fixing some cpplint warnings in ProbABEL's reg1.{cpp,h}.
Added some more consts in these two files.


Modified: pkg/ProbABEL/src/reg1.cpp
===================================================================
--- pkg/ProbABEL/src/reg1.cpp	2014-04-28 21:01:01 UTC (rev 1715)
+++ pkg/ProbABEL/src/reg1.cpp	2014-04-28 21:12:55 UTC (rev 1716)
@@ -305,7 +305,7 @@
             reg_data.is_interaction_excluded, false, nullmodel);
     beta.reinit(X.ncol, 1);
     sebeta.reinit(X.ncol, 1);
-    int length_beta=X.ncol;
+    int length_beta = X.ncol;
     double N = static_cast<double>(resid.nrow);
     mematrix<double> tX = transpose(X);
     if (invvarmatrix.length_of_mask != 0){
@@ -415,21 +415,21 @@
 
 void linear_reg::RobustSEandCovariance(const mematrix<double> &X,
                                        mematrix<double> robust_sigma2,
-                                       MatrixXd tXX_inv,
+                                       const MatrixXd tXX_inv,
                                        const int offset) {
     MatrixXd Xresiduals = X.data.array().colwise()
-            * residuals.data.col(0).array();
+        * residuals.data.col(0).array();
     MatrixXd XbyR =
-            MatrixXd(X.ncol, X.ncol).setZero().selfadjointView<Lower>().rankUpdate(
-                    Xresiduals.adjoint());
+        MatrixXd(X.ncol, X.ncol).setZero().selfadjointView<Lower>().rankUpdate(
+            Xresiduals.adjoint());
     robust_sigma2.data = tXX_inv * XbyR * tXX_inv;
     sebeta.data = robust_sigma2.data.diagonal().array().sqrt();
     covariance.data =
-            robust_sigma2.data.bottomLeftCorner(offset, offset).diagonal();
+        robust_sigma2.data.bottomLeftCorner(offset, offset).diagonal();
 }
 
 
-void linear_reg::PlainSEandCovariance(double sigma2_internal,
+void linear_reg::PlainSEandCovariance(const double sigma2_internal,
                                       const MatrixXd &tXX_inv,
                                       const int offset) {
     sebeta.data = (sigma2_internal * tXX_inv.diagonal().array()).sqrt();
@@ -501,8 +501,7 @@
     }
     else  // NO mm-score regression : normal least square regression
     {
-
-        LeastSquaredRegression(X,Ch);
+        LeastSquaredRegression(X, Ch);
         double N = static_cast<double>(X.nrow);
         double P = static_cast<double>(length_beta);
         sigma2_internal = sigma2 / (N - P);
@@ -579,9 +578,11 @@
 }
 
 
-void logistic_reg::estimate(int verbose, int maxiter,
-        double eps, int model, int interaction, int ngpreds,
-        masked_matrix& invvarmatrixin, int robust, int nullmodel) {
+void logistic_reg::estimate(const int verbose, const int maxiter,
+                            const double eps, const int model,
+                            const int interaction, const int ngpreds,
+                            masked_matrix& invvarmatrixin,
+                            const int robust, const int nullmodel) {
     // In contrast to the 'linear' case 'invvarmatrix' contains the
     // inverse of correlation matrix (not the inverse of var-cov matrix)
     // h2.object$InvSigma * h.object2$h2an$estimate[length(h2$h2an$estimate)]

Modified: pkg/ProbABEL/src/reg1.h
===================================================================
--- pkg/ProbABEL/src/reg1.h	2014-04-28 21:01:01 UTC (rev 1715)
+++ pkg/ProbABEL/src/reg1.h	2014-04-28 21:12:55 UTC (rev 1716)
@@ -114,9 +114,9 @@
                                 LDLT<MatrixXd>& Ch);
     void RobustSEandCovariance(const mematrix<double> & X,
                                mematrix <double> robust_sigma2,
-                               MatrixXd tXX_inv,
+                               const MatrixXd tXX_inv,
                                const int offset);
-    void PlainSEandCovariance(double sigma2_internal,
+    void PlainSEandCovariance(const double sigma2_internal,
                               const MatrixXd & tXX_inv,
                               const int offset);
 };



More information about the Genabel-commits mailing list