/* -*- C -*- */ /* * Copyright (c) 2003 Jindrich Novy (jnovy@users.sf.net) * * 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 * */ #include #include #include #include #define sqr(x) (x)*(x) FCE_FLOAT convol_gauss( FCE_FLOAT xx, FCE_FLOAT magn, FCE_FLOAT x ) { FCE_FLOAT sigma_sqr = -log(magn)*xx*xx/(log(magn)*log(magn)); return exp(-x*x/sigma_sqr); } /* Convolution vector order (ord>=3) have to be odd. */ void init_lookup_vector( FCE_FLOAT *vector, int ord, FCE_FLOAT xx, FCE_FLOAT magn ) { int x, ord2 = ord>>1; FCE_FLOAT r; FCE_FLOAT sigma_sqr = -log(magn)*xx*xx/(log(magn)*log(magn)); #ifdef FCE_DEBUG FILE *f = fopen("vector.txt","wt"); #endif for ( x=0; x>1; x>1))/sigmap)); } for ( x=(s>>1)-1; x>=0; x-- ) { l[x] = exp(-sqr((x-(s>>1))/sigman)); } #ifdef FCE_DEBUG for ( x=0; x