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

L.C. Karssen lennart at karssen.org
Wed Feb 5 22:13:20 CET 2014


Hi Maarten,

Interesting commit! I didn't know about std::copy().

To help me understand: is this a bug in the current version ProbABEL as
well, or one that was introduced by one of your previous commits?


Thanks for the good work,

Lennart.

On 04-02-14 22:00, noreply at r-forge.r-project.org wrote:
> 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);
>  }
>  
> 
> _______________________________________________
> Genabel-commits mailing list
> Genabel-commits at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-commits
> 

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
Utrecht
The Netherlands

lennart at karssen.org
http://blog.karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: OpenPGP digital signature
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20140205/5a12956a/attachment.sig>


More information about the genabel-devel mailing list