Mercurial > hg > tipic
annotate src/LogCompress.h @ 60:1ea2aed23d4a tip
Fix version
author | Chris Cannam |
---|---|
date | Thu, 13 Feb 2020 13:37:36 +0000 |
parents | 0133b2cec3b3 |
children |
rev | line source |
---|---|
Chris@24 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@24 | 2 |
Chris@42 | 3 /* |
Chris@42 | 4 Tipic |
Chris@42 | 5 |
Chris@42 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@42 | 7 |
Chris@42 | 8 This program is free software; you can redistribute it and/or |
Chris@42 | 9 modify it under the terms of the GNU General Public License as |
Chris@42 | 10 published by the Free Software Foundation; either version 2 of the |
Chris@42 | 11 License, or (at your option) any later version. See the file |
Chris@42 | 12 COPYING included with this distribution for more information. |
Chris@42 | 13 */ |
Chris@42 | 14 |
Chris@24 | 15 #ifndef LOGCOMPRESS_H |
Chris@24 | 16 #define LOGCOMPRESS_H |
Chris@24 | 17 |
Chris@24 | 18 #include <vector> |
Chris@24 | 19 #include <cmath> |
Chris@24 | 20 |
Chris@24 | 21 class LogCompress |
Chris@24 | 22 { |
Chris@24 | 23 public: |
Chris@24 | 24 static std::vector<double> process(std::vector<double> in, |
Chris@24 | 25 double factor, |
Chris@24 | 26 double addTerm) { |
Chris@24 | 27 std::vector<double> out; |
Chris@24 | 28 out.reserve(in.size()); |
Chris@24 | 29 for (auto x: in) { |
Chris@24 | 30 out.push_back(log10(addTerm + factor * x)); |
Chris@24 | 31 } |
Chris@49 | 32 return out; |
Chris@24 | 33 } |
Chris@24 | 34 }; |
Chris@24 | 35 |
Chris@24 | 36 #endif |
Chris@24 | 37 |