... | ... |
@@ -13,8 +13,8 @@ |
13 | 13 |
GapsRunner::GapsRunner(const RowMatrix &data, unsigned nPatterns, float alphaA, |
14 | 14 |
float alphaP, float maxGibbsMassA, float maxGibbsMassP, bool singleCell) |
15 | 15 |
: |
16 |
-mASampler(data, data * 0.1f, nPatterns, alphaA, maxGibbsMassA), |
|
17 |
-mPSampler(data, data * 0.1f, nPatterns, alphaP, maxGibbsMassP), |
|
16 |
+mASampler(data, data.pmax(0.1f), nPatterns, alphaA, maxGibbsMassA), |
|
17 |
+mPSampler(data, data.pmax(0.1f), nPatterns, alphaP, maxGibbsMassP), |
|
18 | 18 |
mStatistics(data.nRow(), data.nCol(), nPatterns), |
19 | 19 |
mSamplePhase(false), mNumUpdatesA(0), mNumUpdatesP(0), |
20 | 20 |
mNumRows(data.nRow()), mNumCols(data.nCol()) |
... | ... |
@@ -76,6 +76,7 @@ unsigned nCores) |
76 | 76 |
{ |
77 | 77 |
displayStatus(outputFreq, i, nIter); |
78 | 78 |
} |
79 |
+ |
|
79 | 80 |
if (mSamplePhase) |
80 | 81 |
{ |
81 | 82 |
mStatistics.update(mASampler, mPSampler); |
... | ... |
@@ -103,6 +103,19 @@ RowMatrix RowMatrix::operator/(float val) const |
103 | 103 |
return mat; |
104 | 104 |
} |
105 | 105 |
|
106 |
+RowMatrix RowMatrix::pmax(float scale) const |
|
107 |
+{ |
|
108 |
+ RowMatrix mat(mNumRows, mNumCols); |
|
109 |
+ for (unsigned i = 0; i < mNumRows; ++i) |
|
110 |
+ { |
|
111 |
+ for (unsigned j = 0; j < mNumCols; ++j) |
|
112 |
+ { |
|
113 |
+ mat(i,j) = std::max(this->operator()(i,j) * scale, scale); |
|
114 |
+ } |
|
115 |
+ } |
|
116 |
+ return mat; |
|
117 |
+} |
|
118 |
+ |
|
106 | 119 |
Archive& operator<<(Archive &ar, RowMatrix &mat) |
107 | 120 |
{ |
108 | 121 |
for (unsigned i = 0; i < mat.nRow(); ++i) |
... | ... |
@@ -41,6 +41,7 @@ public: |
41 | 41 |
RowMatrix operator*(float val) const; |
42 | 42 |
RowMatrix operator/(float val) const; |
43 | 43 |
RowMatrix& operator=(const ColMatrix &mat); |
44 |
+ RowMatrix pmax(float scale) const; |
|
44 | 45 |
|
45 | 46 |
friend Archive& operator<<(Archive &ar, RowMatrix &mat); |
46 | 47 |
friend Archive& operator>>(Archive &ar, RowMatrix &mat); |