# HG changeset patch # User Chris Cannam # Date 1425040502 0 # Node ID fb799a1aabd8f0c72926d483457a687ab33ebe1b # Parent 010b91e440984ed1fbcca6ad8c33eff2c9403a0c Don't create matrices in other matcher, now they aren't referred to diff -r 010b91e44098 -r fb799a1aabd8 src/Matcher.cpp --- a/src/Matcher.cpp Fri Feb 27 12:21:58 2015 +0000 +++ b/src/Matcher.cpp Fri Feb 27 12:35:02 2015 +0000 @@ -142,7 +142,7 @@ { if (m_firstPM) { if (i < 0 || i >= int(m_first.size())) { - cerr << "ERROR: Matcher::getColRange(" << i << "): Index out of range" + cerr << "ERROR: Matcher::getColRangeForRow(" << i << "): Index out of range" << endl; throw "Index out of range"; } else { @@ -154,29 +154,21 @@ } pair -Matcher::getRowRangeForCol(int j) +Matcher::getRowRangeForCol(int i) { if (m_firstPM) { - //!!! tedious, examine uses (& consider restoring use of - //!!! first/last in "other" matcher) - int a = -1, b = -1; - for (int i = 0; i < int(m_first.size()); ++i) { - if (j >= m_first[i] && j < m_last[i]) { - if (a == -1) a = i; - b = i; - } - } - if (a == -1) { - cerr << "ERROR: Matcher::getRowRange(" << j << "): Index out of range" + if (i < 0 || i >= int(m_otherMatcher->m_first.size())) { + cerr << "ERROR: Matcher::getRowRangeForCol(" << i << "): Index out of range" << endl; throw "Index out of range"; } else { - return pair(a, b + 1); + return pair(m_otherMatcher->m_first[i], + m_otherMatcher->m_last[i]); } } else { - return m_otherMatcher->getColRangeForRow(j); + return m_otherMatcher->getColRangeForRow(i); } } @@ -275,12 +267,15 @@ void Matcher::size() { - int distSize = (m_params.maxRunCount + 1) * m_blockSize; - m_bestPathCost.resize(m_distXSize, pathcostvec_t(distSize, InvalidPathCost)); - m_distance.resize(m_distXSize, distancevec_t(distSize, InvalidDistance)); - m_advance.resize(m_distXSize, advancevec_t(distSize, AdvanceNone)); m_first.resize(m_distXSize, 0); m_last.resize(m_distXSize, 0); + + if (m_firstPM) { + int distSize = (m_params.maxRunCount + 1) * m_blockSize; + m_bestPathCost.resize(m_distXSize, pathcostvec_t(distSize, InvalidPathCost)); + m_distance.resize(m_distXSize, distancevec_t(distSize, InvalidDistance)); + m_advance.resize(m_distXSize, advancevec_t(distSize, AdvanceNone)); + } } void