void consumeSpectrum(SpectrumType & s) override { for (Size i = 0; i < s.size(); i++) { TIC += s[i].getIntensity(); } nr_peaks += s.size(); nr_spectra++; }
double MelFilter::Apply(const SpectrumType& dataSpectrum) { double value = 0.0; int N = dataSpectrum.size(); for (int i = 0; i < N; ++i) value += std::abs(dataSpectrum[i]) * m_spectrum[i]; return value; }
/** * Returns a single value computed by multiplying signal spectrum with * Mel filter spectrum and summing all the products. * * @param dataSpectrum complex signal spectrum * @return dot product of the spectra */ double MelFilter::apply(const SpectrumType& dataSpectrum) const { double value = 0.0; const std::size_t N = dataSpectrum.size(); // iteration over first half of the spectrum for (std::size_t i = 0; i < N / 2 - 1; ++i) { value += std::abs(dataSpectrum[i]) * m_spectrum[i]; } return value; }