[Genabel-commits] r1594 - branches/ProbABEL-0.50/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 4 22:00:43 CET 2014


Author: maartenk
Date: 2014-02-04 22:00:43 +0100 (Tue, 04 Feb 2014)
New Revision: 1594

Modified:
   branches/ProbABEL-0.50/src/maskedmatrix.cpp
   branches/ProbABEL-0.50/src/reg1.cpp
   branches/ProbABEL-0.50/src/regdata.cpp
Log:
-fixed incorrect multiplication with mmscore: other object was returned then expected.



Modified: branches/ProbABEL-0.50/src/maskedmatrix.cpp
===================================================================
--- branches/ProbABEL-0.50/src/maskedmatrix.cpp	2014-02-04 11:27:35 UTC (rev 1593)
+++ branches/ProbABEL-0.50/src/maskedmatrix.cpp	2014-02-04 21:00:43 UTC (rev 1594)
@@ -67,7 +67,6 @@
             nmeasured++;
         }
     }
-
     //Check update mask is the same as original matrix
     if (nmeasured == length_of_mask)
     {

Modified: branches/ProbABEL-0.50/src/reg1.cpp
===================================================================
--- branches/ProbABEL-0.50/src/reg1.cpp	2014-02-04 11:27:35 UTC (rev 1593)
+++ branches/ProbABEL-0.50/src/reg1.cpp	2014-02-04 21:00:43 UTC (rev 1594)
@@ -164,9 +164,11 @@
     // column with Prob(A1A1). Note the order is swapped cf the file!
     int c2 = X.ncol - 1;
 
-    for (int i = 0; i < X.nrow; i++)
-        for (int j = 0; j < (X.ncol - 2); j++)
+    for (int i = 0; i < X.nrow; i++){
+        for (int j = 0; j < (X.ncol - 2); j++){
             nX[i * nX.ncol + j] = X[i * X.ncol + j];
+        }
+    }
 
     for (int i = 0; i < nX.nrow; i++)
     {

Modified: branches/ProbABEL-0.50/src/regdata.cpp
===================================================================
--- branches/ProbABEL-0.50/src/regdata.cpp	2014-02-04 11:27:35 UTC (rev 1593)
+++ branches/ProbABEL-0.50/src/regdata.cpp	2014-02-04 21:00:43 UTC (rev 1594)
@@ -14,7 +14,7 @@
 #include "fvlib/frversion.h"
 #include "fvlib/Logger.h"
 #include "fvlib/Transposer.h"
-
+#include <algorithm> // STL algoritms
 #include "regdata.h"
 
 regdata::regdata()
@@ -203,7 +203,6 @@
     int dim2X = X.ncol;
     (to.X).reinit(to.nids, dim2X);
     (to.Y).reinit(to.nids, dim2Y);
-
     int j = 0;
     for (int i = 0; i < nids; i++)
     {
@@ -223,13 +222,10 @@
     }
 
     // delete [] to.masked_data;
-    to.masked_data = new unsigned short int[to.nids];
-    for (int i = 0; i < to.nids; i++)
-    {
-        to.masked_data[i] = 0;
-    }
-    // std::cout << "get_unmasked: " << to.nids << " "
-    //           << dim2X << " " << dim2Y << "\n";
+    const int arr_size = nids;
+    to.masked_data = new unsigned short int[arr_size];
+    std::copy(masked_data, masked_data+arr_size,to.masked_data);
+
     return (to);
 }
 



More information about the Genabel-commits mailing list