Mercurial > hg > silvet
diff src/EM.cpp @ 89:a6e136aaa202 timing
Initialise new vectors with epsilon instead of copying and then overwriting
author | Chris Cannam |
---|---|
date | Tue, 06 May 2014 12:56:18 +0100 |
parents | 97b77e7cb94c |
children | 2b0818a1c058 840c0d703bbb 91bb029a847a |
line wrap: on
line diff
--- a/src/EM.cpp Tue May 06 12:49:49 2014 +0100 +++ b/src/EM.cpp Tue May 06 12:56:18 2014 +0100 @@ -160,27 +160,23 @@ void EM::maximisation(const V &column) { - V newPitches = m_pitches; - Grid newShifts = m_shifts; - Grid newSources = m_sources; + V newPitches(m_noteCount, epsilon); + Grid newShifts(m_shiftCount, V(m_noteCount, epsilon)); + Grid newSources(m_instrumentCount, V(m_noteCount, epsilon)); for (int n = 0; n < m_noteCount; ++n) { const double pitch = m_pitches[n]; - newPitches[n] = epsilon; for (int f = 0; f < m_shiftCount; ++f) { const double shift = m_shifts[f][n]; - newShifts[f][n] = epsilon; for (int i = 0; i < m_instrumentCount; ++i) { const double source = m_sources[i][n]; - newSources[i][n] = epsilon; - + const double factor = pitch * source * shift; const double *w = templateFor(i, n, f); - const double factor = pitch * source * shift; if (n >= m_lowestPitch && n <= m_highestPitch) {