Mercurial > hg > silvet
comparison src/EM.cpp @ 95:853b2d750688 bqvec
Fix silly bug
author | Chris Cannam |
---|---|
date | Tue, 06 May 2014 14:37:42 +0100 |
parents | 891cbcf1e4d2 |
children | 9ecad4c9c2a2 |
comparison
equal
deleted
inserted
replaced
94:891cbcf1e4d2 | 95:853b2d750688 |
---|---|
121 double *norm = allocate<double>(m_binCount); | 121 double *norm = allocate<double>(m_binCount); |
122 v_copy(norm, column, m_binCount); | 122 v_copy(norm, column, m_binCount); |
123 normaliseColumn(norm, m_binCount); | 123 normaliseColumn(norm, m_binCount); |
124 expectation(norm); | 124 expectation(norm); |
125 maximisation(norm); | 125 maximisation(norm); |
126 deallocate(norm); | |
126 } | 127 } |
127 | 128 |
128 const double * | 129 const double * |
129 EM::templateFor(int instrument, int note, int shift) | 130 EM::templateFor(int instrument, int note, int shift) |
130 { | 131 { |
191 const double source = m_sources[i][n]; | 192 const double source = m_sources[i][n]; |
192 const double factor = pitch * source * shift; | 193 const double factor = pitch * source * shift; |
193 const double *w = templateFor(i, n, f); | 194 const double *w = templateFor(i, n, f); |
194 | 195 |
195 v_copy(contributions, w, m_binCount); | 196 v_copy(contributions, w, m_binCount); |
196 v_add(contributions, m_q, m_binCount); | 197 v_multiply(contributions, m_q, m_binCount); |
197 v_scale(contributions, factor, m_binCount); | 198 v_scale(contributions, factor, m_binCount); |
198 | 199 |
199 double total = v_sum(contributions, m_binCount); | 200 double total = v_sum(contributions, m_binCount); |
200 | 201 |
201 if (n >= m_lowestPitch && n <= m_highestPitch) { | 202 if (n >= m_lowestPitch && n <= m_highestPitch) { |