/* -*- mona-c++ -*-
* Copyright (c) Leipzig, Madrid 2004 - 2008
* Max-Planck-Institute for Human Cognitive and Brain Science
* Max-Planck-Institute for Evolutionary Anthropology
* BIT, ETSI Telecomunicacion, UPM
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// $Id: filter.cc 670 2005-06-29 13:22:23Z wollny $
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#pragma implementation "filter.hh"
#include <cmath>
// MONA specific
#include <libmona/filter.hh>
namespace mona {
T1DFilterKernel::T1DFilterKernel(int fsize):
m_fsize(fsize),
m_mask(2 * fsize + 1)
{
}
T1DGaussFilterKernel::T1DGaussFilterKernel(int fsize):
T1DFilterKernel(fsize)
{
int n = get_size();
int i,j;
vec_mask tmp(n);
for (i = 0; i < n; i++){
(*this)[i] = 1.0;
for (j=1; j < i; j++) {
tmp[j] = (*this)[j-1] + (*this)[j];
}
for (j=1; j < i; j++) {
(*this)[j] = tmp[j];
}
}
float norm = pow(2.0,n-1);
for (i = 0; i < n; i++){
(*this)[i] /= norm;
}
}
T1DFilterKernel::const_iterator T1DFilterKernel::begin()const
{
return m_mask.begin();
}
T1DFilterKernel::const_iterator T1DFilterKernel::end()const
{
return m_mask.end();
}
const int T1DFilterKernel::get_fsize()const
{
return m_fsize;
}
const int T1DFilterKernel::get_size()const
{
return m_mask.size();
}
} // namespace mona
/* CVS LOG
$Log$
Revision 1.4 2005/06/29 13:22:23 wollny
switch to version 0.7
Revision 1.1.1.1 2005/03/17 13:44:20 gerddie
initial import
Revision 1.3 2004/08/25 09:08:31 wollny
added an emacs style comment to all source files
Revision 1.2 2004/02/12 14:00:25 tittge
Major addaptions from libmia0
Revision 1.1.1.1 2004/02/11 18:18:05 tittge
start project
*/