/*************************************************************************** * Copyright (C) gempa GmbH * * All rights reserved. * * Contact: gempa GmbH (seiscomp-dev@gempa.de) * * * * GNU Affero General Public License Usage * * This file may be used under the terms of the GNU Affero * * Public License version 3.0 as published by the Free Software Foundation * * and appearing in the file LICENSE included in the packaging of this * * file. Please review the following information to ensure the GNU Affero * * Public License version 3.0 requirements will be met: * * https://www.gnu.org/licenses/agpl-3.0.html. * * * * Other Usage * * Alternatively, this file may be used in accordance with the terms and * * conditions contained in a signed written agreement between you and * * gempa GmbH. * ***************************************************************************/ // namespace is Seiscomp::Filter #include #include #include using namespace std; template static vector mytransform(vector const &f, double (*func)(double)) { vector y(f.size()); transform( f.begin() , f.end() , y.begin() , func) ; return y; } template vector sin(vector const &f) { return mytransform(f, ::sin); } template vector cos(vector const &f) { return mytransform(f, ::cos); } template vector tan(vector const &f) { return mytransform(f, ::tan); } template vector sqrt(vector const &f) { return mytransform(f, ::sqrt); } template vector log(vector const &f) { return mytransform(f, ::log); } template vector log10(vector const &f) { return mytransform(f, ::log10); } template vector exp(vector const &f) { return mytransform(f, ::exp); } template static vector arange(TYPE xmax) { int size = int(xmax); size += int(ceil(xmax-size)); vector y(size); TYPE *yy = &y[0]; for(int i=0; i int main() { for (int count=0; count<5000; count++) { // vector x(10000, 0.5), y; // y = sin(x); // cerr << x[4] << " " << y[4] << endl; break; vector y; y = arange(10.1); for (int i=0; i