Skip to content

Commit 2b2e2bb

Browse files
authored
Merge pull request #409 from vil02/use_log2
Use `std::log2`
2 parents 5d98061 + c546c0e commit 2b2e2bb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/cluster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ namespace torali
608608
// Append new edge
609609
TCompEdgeList::iterator compEdgeIt = compEdge.find(compIndex);
610610
if (compEdgeIt->second.size() < c.graphPruning) {
611-
TWeightType weight = (TWeightType) ( std::log((double) abs( abs( (_minCoord(bamItNext->pos, bamItNext->mpos, svt) - minCoord) - (_maxCoord(bamItNext->pos, bamItNext->mpos, svt) - maxCoord) ) - abs(bamIt->Median - bamItNext->Median)) + 1) / std::log(2) );
611+
TWeightType weight = (TWeightType) ( std::log2((double) abs( abs( (_minCoord(bamItNext->pos, bamItNext->mpos, svt) - minCoord) - (_maxCoord(bamItNext->pos, bamItNext->mpos, svt) - maxCoord) ) - abs(bamIt->Median - bamItNext->Median)) + 1) );
612612
compEdgeIt->second.push_back(TEdgeRecord(bamItIndex, bamItIndexNext, weight));
613613
}
614614
}

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ namespace torali
547547
for (std::vector<char>::const_iterator s = stvec.begin(); s != stvec.end(); ++s)
548548
if (*s == *c) ++ctr;
549549
TPrecision freq = (TPrecision) ctr / (TPrecision) stvec.size();
550-
ent += (freq) * log(freq)/log(2);
550+
ent += (freq) * log2(freq);
551551
}
552552
return -ent;
553553
}

0 commit comments

Comments
 (0)