# HG changeset patch # User Chris Cannam # Date 1400679713 -3600 # Node ID 237d41a0f69dca38ef3dbd5209647e353da84bb4 # Parent 26d054291412e197eb22a813d8e9677dc66452c9 Introduce shift sparsity diff -r 26d054291412 -r 237d41a0f69d src/EM.cpp --- a/src/EM.cpp Wed May 21 12:15:29 2014 +0100 +++ b/src/EM.cpp Wed May 21 14:41:53 2014 +0100 @@ -39,9 +39,8 @@ m_binCount(pack->templateHeight), m_sourceCount(pack->templates.size()), m_pitchSparsity(1.1), - //!!! note: slightly less source sparsity might help; also - //!!! consider a modest shift sparsity e.g. 1.1 - m_sourceSparsity(1.3), + m_shiftSparsity(1.1), + m_sourceSparsity(1.2), m_lowestPitch(pack->lowestNote), m_highestPitch(pack->highestNote) { @@ -255,7 +254,16 @@ if (m_pitchSparsity != 1.0) { for (int n = 0; n < m_noteCount; ++n) { m_updatePitches[n] = - pow(m_updatePitches[n], m_pitchSparsity); + powf(m_updatePitches[n], m_pitchSparsity); + } + } + + if (m_shifts && m_shiftSparsity != 1.0) { + for (int i = 0; i < m_shiftCount; ++i) { + for (int n = 0; n < m_noteCount; ++n) { + m_updateShifts[i][n] = + powf(m_updateShifts[i][n], m_shiftSparsity); + } } } @@ -263,7 +271,7 @@ for (int i = 0; i < m_sourceCount; ++i) { for (int n = 0; n < m_noteCount; ++n) { m_updateSources[i][n] = - pow(m_updateSources[i][n], m_sourceSparsity); + powf(m_updateSources[i][n], m_sourceSparsity); } } } diff -r 26d054291412 -r 237d41a0f69d src/EM.h --- a/src/EM.h Wed May 21 12:15:29 2014 +0100 +++ b/src/EM.h Wed May 21 14:41:53 2014 +0100 @@ -91,6 +91,7 @@ const int m_sourceCount; const float m_pitchSparsity; + const float m_shiftSparsity; const float m_sourceSparsity; const int m_lowestPitch;