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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 8 11:50:41 CEST 2014


Author: lckarssen
Date: 2014-05-08 11:50:40 +0200 (Thu, 08 May 2014)
New Revision: 1723

Modified:
   pkg/ProbABEL/src/data.cpp
   pkg/ProbABEL/src/data.h
   pkg/ProbABEL/src/main_functions_dump.cpp
   pkg/ProbABEL/src/main_functions_dump.h
Log:
Added consts to function calls related to loading the inv.sigma matrix.

Also changed one variable from being passed as pointer to being passed as reference, according to the Google coding style guide using a reference is preferred for 'input' variables (that don't change), whereas passing pointers is for 'output' variables, i.e. those that are changed by the function.


Modified: pkg/ProbABEL/src/data.cpp
===================================================================
--- pkg/ProbABEL/src/data.cpp	2014-05-06 12:17:53 UTC (rev 1722)
+++ pkg/ProbABEL/src/data.cpp	2014-05-08 09:50:40 UTC (rev 1723)
@@ -158,9 +158,9 @@
 
 //_________________________________________Maksim_start
 
-InvSigma::InvSigma(const char * filename_, phedata * phe) : filename(filename_)
+InvSigma::InvSigma(const char * filename_, const phedata& phe) : filename(filename_)
 {
-    npeople = phe->nids;
+    npeople = phe.nids;
     std::ifstream myfile(filename_);
     char * line = new char[MAXIMUM_PEOPLE_AMOUNT];
     std::string id;
@@ -178,10 +178,10 @@
             std::stringstream line_stream(line);
             line_stream >> id;
 
-            if (phe->idnames[row] != id)
+            if (phe.idnames[row] != id)
             {
                 std::cerr << "error:in row " << row << " id="
-                          << phe->idnames[row]
+                          << phe.idnames[row]
                           << " in inverse variance matrix but id=" << id
                           << " must be there. Wrong inverse variance matrix"
                           << " (only measured id must be there)\n";

Modified: pkg/ProbABEL/src/data.h
===================================================================
--- pkg/ProbABEL/src/data.h	2014-05-06 12:17:53 UTC (rev 1722)
+++ pkg/ProbABEL/src/data.h	2014-05-08 09:50:40 UTC (rev 1723)
@@ -75,7 +75,7 @@
     mematrix<double> matrix;    /* file is stored here */
 
  public:
-    InvSigma(const char * filename_, phedata * phe);
+    InvSigma(const char * filename_, const phedata& phe);
     mematrix<double> & get_matrix();
     ~InvSigma();
 };

Modified: pkg/ProbABEL/src/main_functions_dump.cpp
===================================================================
--- pkg/ProbABEL/src/main_functions_dump.cpp	2014-05-06 12:17:53 UTC (rev 1722)
+++ pkg/ProbABEL/src/main_functions_dump.cpp	2014-05-08 09:50:40 UTC (rev 1723)
@@ -146,11 +146,11 @@
  * @param invvarmatrix The object of type masked_matrix in which the
  * inverse variance-covariance matrix is returned.
  */
-void loadInvSigma(const cmdvars& input_var, phedata& phd,
+void loadInvSigma(const cmdvars& input_var, const phedata& phd,
                   masked_matrix& invvarmatrix)
 {
     std::cout << "You are running mmscore...\n";
-    InvSigma inv(input_var.getInverseFilename(), &phd);
+    InvSigma inv(input_var.getInverseFilename(), phd);
     // invvarmatrix = inv.get_matrix();
     //double par = 1.; //var(phd.Y)*phd.nids/(phd.nids-phd.ncov-1);
     invvarmatrix.set_matrix(inv.get_matrix());    // = invvarmatrix * par;

Modified: pkg/ProbABEL/src/main_functions_dump.h
===================================================================
--- pkg/ProbABEL/src/main_functions_dump.h	2014-05-06 12:17:53 UTC (rev 1722)
+++ pkg/ProbABEL/src/main_functions_dump.h	2014-05-08 09:50:40 UTC (rev 1723)
@@ -35,7 +35,7 @@
 
 void update_progress_to_cmd_line(const int csnp, const int nsnps);
 
-void loadInvSigma(const cmdvars& input_var, phedata& phd,
+void loadInvSigma(const cmdvars& input_var, const phedata& phd,
                   masked_matrix& invvarmatrix);
 
 int create_phenotype(phedata& phd, const cmdvars& input_var);



More information about the Genabel-commits mailing list