Skip to content

Commit

Permalink
simplify value getter expr
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalvovs committed Nov 15, 2024
1 parent 007c78b commit b06f01b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gibbs_sampler/SparseNormalModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ float SparseNormalModel::chiSq() const
SparseIterator<1> it(mDMatrix.getCol(j)); // iterate non-zero elements of col j
while (!it.atEnd())
{
float val = get<1>(it); // val = Data
float dot = gaps::dot(mMatrix.getRow(j), mOtherMatrix->getRow(it.getIndex())); // dot = A * P again
float dsq = get<1>(it) * get<1>(it); // dsq = Data squared
chisq += (1 + dot * (dot - 2 * get<1>(it) - dsq * dot)) / (1 + dsq); // chisq
float dsq = val * val; // dsq = Data squared
chisq += (1 + dot * (dot - 2 * val - dsq * dot)) / (1 + dsq); // chisq
it.next();
}
}
Expand Down

0 comments on commit b06f01b

Please sign in to comment.