summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-04-26 10:05:54 +0200
committerjasplin <qt-info@nokia.com>2010-04-26 10:05:54 +0200
commit7ab6050f8bee03e296fbc62ba3d06a2ae434db2c (patch)
treecdb51cd88db7cdc673e3c6cccc2478df7adab85a
parent8a8ebc14d6a98deb603fcba886ee51a11a1e0be8 (diff)
Fixed minor bug in computing index value contributors.
-rw-r--r--src/bm/bmrequest.cpp3
-rw-r--r--src/bm/index.cpp48
2 files changed, 29 insertions, 22 deletions
diff --git a/src/bm/bmrequest.cpp b/src/bm/bmrequest.cpp
index 46d1bf1..f5efdc1 100644
--- a/src/bm/bmrequest.cpp
+++ b/src/bm/bmrequest.cpp
@@ -5570,8 +5570,7 @@ void BMRequest_IndexGetValues::handleReply_HTML(const QStringList &args) const
reply += "<b>Note:</b> Individual index values bear no useful meaning when regarded in ";
reply += "isolation. The graph is however shifted vertically so that each individual index ";
- reply += "value indicates the change from the index value at the given base time (the index ";
- reply += "value of the latter is then 0 and 1 in the log2 and linear domain respectively).";
+ reply += "value indicates the change from the index value at the given base time.";
reply += "</td></tr></table>\n";
diff --git a/src/bm/index.cpp b/src/bm/index.cpp
index 4e1cbd1..5d5bab0 100644
--- a/src/bm/index.cpp
+++ b/src/bm/index.cpp
@@ -135,8 +135,10 @@ bool IndexAlgorithm1::computeValues(
// each result history.
QVector<int> basePos(rhInfos.size()); // Base value pos of each result history.
QVector<qreal> diffPrev(rhInfos.size()); // Previous base diff value of each result hist.
+ QBitArray hasTargetPosPrev(rhInfos.size()); // Whether a previous (computable) target pos has
+ // been encountered for each result history.
QVector<qreal> targetValPrev(rhInfos.size()); // Previous target value of each result history.
- QVector<int> targetPosPrev(rhInfos.size()); // Previous target pos of each result history.
+ QVector<int> targetPosPrev(rhInfos.size(), -1); // Previous target pos of each result history.
qreal hc = 0.0; // History constant to adjust for changes to the set of contributors.
bool contr_prev_empty = true;
@@ -195,22 +197,31 @@ bool IndexAlgorithm1::computeValues(
contr.setBit(j);
- const qreal diffChange = diff - diffPrev.at(j);
-
- const QString descr =
- QString("base val: %1; val1: %2; val2: %3; abs log2 diff change: %4")
- .arg(baseVal)
- .arg(targetValPrev.at(j))
- .arg(targetVal)
- .arg(qAbs(diffChange));
- RankedInfo rankedInfo(
- rhInfo->bmcontextId(), basePos.at(j), targetPosPrev.at(j), targetPos,
- descr);
-
- BMMisc::insertRankedId<RankedInfo>(
- &rankedBest, topContrLimit, rankedInfo, diffChange);
- BMMisc::insertRankedId<RankedInfo>(
- &rankedWorst, topContrLimit, rankedInfo, -diffChange);
+ if (hasTargetPosPrev.testBit(j)) {
+
+ const qreal diffChange = diff - diffPrev.at(j);
+
+ const QString descr =
+ QString("base val: %1; val1: %2; val2: %3; abs log2 diff change: %4")
+ .arg(baseVal)
+ .arg(targetValPrev.at(j))
+ .arg(targetVal)
+ .arg(qAbs(diffChange));
+
+ RankedInfo rankedInfo(
+ rhInfo->bmcontextId(), basePos.at(j), targetPosPrev.at(j), targetPos,
+ descr);
+
+ BMMisc::insertRankedId<RankedInfo>(
+ &rankedBest, topContrLimit, rankedInfo, diffChange);
+ BMMisc::insertRankedId<RankedInfo>(
+ &rankedWorst, topContrLimit, rankedInfo, -diffChange);
+ } else {
+ hasTargetPosPrev.setBit(j);
+ }
+
+ targetValPrev.replace(j, targetVal);
+ targetPosPrev.replace(j, targetPos);
diffPrev.replace(j, diff);
} else {
@@ -218,9 +229,6 @@ bool IndexAlgorithm1::computeValues(
basePos.replace(j, targetPos);
hasBase.setBit(j);
}
-
- targetValPrev.replace(j, targetVal);
- targetPosPrev.replace(j, targetPos);
}
}