[Genabel-commits] r1693 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 22 20:06:06 CEST 2014
Author: lckarssen
Date: 2014-04-22 20:06:05 +0200 (Tue, 22 Apr 2014)
New Revision: 1693
Modified:
pkg/ProbABEL/src/maskedmatrix.cpp
pkg/ProbABEL/src/maskedmatrix.h
pkg/ProbABEL/src/regdata.cpp
pkg/ProbABEL/src/regdata.h
Log:
Changed type of masked_data arrays from unsigned short int to bool. Since these are masks, booleans are more appropriate. Moreover, a boolean uses 1 byte, whereas and unsigned int uses 2 (at least on my system). So we're a wee bit more memory efficient now.
Modified: pkg/ProbABEL/src/maskedmatrix.cpp
===================================================================
--- pkg/ProbABEL/src/maskedmatrix.cpp 2014-04-22 18:03:46 UTC (rev 1692)
+++ pkg/ProbABEL/src/maskedmatrix.cpp 2014-04-22 18:06:05 UTC (rev 1693)
@@ -49,7 +49,7 @@
{
// matrix_original = M;
masked_data = &matrix_original;
- mask_of_old = new unsigned short int[M.nrow];
+ mask_of_old = new bool[M.nrow];
std::fill(mask_of_old, mask_of_old+M.nrow, 0);
length_of_mask = M.nrow;
}
@@ -58,7 +58,7 @@
{
matrix_original = M;
masked_data = &matrix_original;
- mask_of_old = new unsigned short int[M.nrow];
+ mask_of_old = new bool[M.nrow];
std::fill(mask_of_old, mask_of_old+M.nrow, 0);
length_of_mask = M.nrow;
}
@@ -68,7 +68,7 @@
delete[] mask_of_old;
}
-void masked_matrix::update_mask(short unsigned int *newmask)
+void masked_matrix::update_mask(bool *newmask)
{
//find length of masked matrix
int nmeasured=std::count (newmask, newmask+length_of_mask, 0);
@@ -119,4 +119,3 @@
i1++;
}
}
-
Modified: pkg/ProbABEL/src/maskedmatrix.h
===================================================================
--- pkg/ProbABEL/src/maskedmatrix.h 2014-04-22 18:03:46 UTC (rev 1692)
+++ pkg/ProbABEL/src/maskedmatrix.h 2014-04-22 18:06:05 UTC (rev 1693)
@@ -43,7 +43,7 @@
masked_matrix(mematrix<double> M);
void set_matrix(const mematrix<double> &M);
~masked_matrix();
- void update_mask(short unsigned int *newmask);
+ void update_mask(bool *newmask);
// mematrix<double>* get_matrix();
mematrix<double> matrix_original;
mematrix<double> *masked_data;
@@ -51,7 +51,7 @@
private:
mematrix<double> matrix_masked_data;
- unsigned short int *mask_of_old;
+ bool *mask_of_old;
void mask_symmetric(int nmeasured);
};
Modified: pkg/ProbABEL/src/regdata.cpp
===================================================================
--- pkg/ProbABEL/src/regdata.cpp 2014-04-22 18:03:46 UTC (rev 1692)
+++ pkg/ProbABEL/src/regdata.cpp 2014-04-22 18:06:05 UTC (rev 1693)
@@ -80,7 +80,7 @@
gcount = obj.gcount;
freq = obj.freq;
is_interaction_excluded = obj.is_interaction_excluded;
- masked_data = new unsigned short int[nids];
+ masked_data = new bool[nids];
std::copy(obj.masked_data, obj.masked_data + nids, masked_data);
}
@@ -105,7 +105,7 @@
freq = 0;
gcount = 0;
nids = gend.nids;
- masked_data = new unsigned short int[nids];
+ masked_data = new bool[nids];
std::fill(masked_data, masked_data + nids, 0);
ngpreds = gend.ngpreds;
@@ -289,7 +289,7 @@
// delete [] to.masked_data;
const int arr_size = nids;
- to.masked_data = new unsigned short int[arr_size];
+ to.masked_data = new bool[arr_size];
std::copy(masked_data, masked_data + arr_size, to.masked_data);
return (to);
Modified: pkg/ProbABEL/src/regdata.h
===================================================================
--- pkg/ProbABEL/src/regdata.h 2014-04-22 18:03:46 UTC (rev 1692)
+++ pkg/ProbABEL/src/regdata.h 2014-04-22 18:06:05 UTC (rev 1693)
@@ -96,7 +96,7 @@
* ID/sample will be masked because the SNP data is NA for that
* ID.
*/
- unsigned short int * masked_data;
+ bool *masked_data;
/**
* Number of non-masked genotypes.
More information about the Genabel-commits
mailing list