comparison src/EM.cpp @ 99:9ecad4c9c2a2 bqvec

Use a couple more bqvec calls
author Chris Cannam
date Tue, 06 May 2014 14:53:11 +0100
parents 853b2d750688
children 8259193b3b16
comparison
equal deleted inserted replaced
96:c2996b9bedbe 99:9ecad4c9c2a2
135 void 135 void
136 EM::expectation(const double *column) 136 EM::expectation(const double *column)
137 { 137 {
138 // cerr << "."; 138 // cerr << ".";
139 139
140 for (int i = 0; i < m_binCount; ++i) { 140 v_set(m_estimate, epsilon, m_binCount);
141 m_estimate[i] = epsilon;
142 }
143 141
144 for (int i = 0; i < m_sourceCount; ++i) { 142 for (int i = 0; i < m_sourceCount; ++i) {
145 for (int n = 0; n < m_noteCount; ++n) { 143 for (int n = 0; n < m_noteCount; ++n) {
146 const double pitch = m_pitches[n]; 144 const double pitch = m_pitches[n];
147 const double source = m_sources[i][n]; 145 const double source = m_sources[i][n];
148 for (int f = 0; f < m_shiftCount; ++f) { 146 for (int f = 0; f < m_shiftCount; ++f) {
149 const double *w = templateFor(i, n, f); 147 const double *w = templateFor(i, n, f);
150 const double shift = m_shifts[f][n]; 148 const double shift = m_shifts[f][n];
151 const double factor = pitch * source * shift; 149 const double factor = pitch * source * shift;
152 for (int j = 0; j < m_binCount; ++j) { 150 v_add_with_gain(m_estimate, w, factor, m_binCount);
153 m_estimate[j] += w[j] * factor;
154 }
155 } 151 }
156 } 152 }
157 } 153 }
158 154
159 for (int i = 0; i < m_binCount; ++i) { 155 for (int i = 0; i < m_binCount; ++i) {