Low level routine
fr - eng


calc_fft_c - calc_fft_c title

Module

Parameters

Description

Add here a paragraph of the function description

File content


/* calc_fft_c subroutine
 *
 * INRIA - Author : A.Layec
 *
 * Copyright (C) 2007 Alan Layec
 *
 * This file is part of modnumlib.
 *
 * modnumlib 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.
 *
 * modnumlib 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 modnumlib; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

/* REVISION HISTORY :
 * $Log$
 */

#include "modnum_lib.h"

#ifdef HAVE_SCISRC
#include "machine.h"
#else
void fft842(int *k,int *n,double *r_i,double *i_i,int *ierr) {}
void dfft2(double *r_i,double *i_i,int *i,int *n,int *j,int *k,int *ierr,double *work,int *n_work) {}
#define C2F(name) name
#endif

/* calc_fft_c :
 * computation of in place fft by
 * using fft of the Standard Signal
 * Scilab library
 *
 * Input parameters :
 *   - fft_pr_struct *fft_pr
 * Input/Output parameters:
 *   - double *r_i,*r_o : time/freq domain
 *                   in/out buffer
 *
 * Return int 0 or ierr of fft842/dfftmx
 *
 */

int calc_fft_c(fft_pr_struct *fft_pr,double *r_i,double *i_i)
{
 int i,j,k;
 int ierr = 0;

 int n;
 int isn;
 int ffttyp;
 int n_work;
 double *work;

 n      = fft_pr->lfft;
 isn    = fft_pr->isn;
 ffttyp = fft_pr->ffttyp;
 n_work = fft_pr->nwork;
 work   = fft_pr->work;

 switch(ffttyp)
 {
  case 0 :{ /* fft842 */
           if ((isn==0)||(isn==-1)) {
             k = 0;
           }
           else {
             k = 1;
           }
           C2F(fft842)(&k,&n,r_i,i_i,&ierr);
           break;
  }
  case 1 :{ /* dfftmx */
           if ((isn==0)||(isn==-1)) {
             k = -1;
           }
           else {
             k = 1;
           }
           C2F(dfft2)(r_i,i_i,(i=1,&i),&n,(j=1,&j),&k,&ierr,work,&n_work);
           break;
  }
  case 2 :{ /* fftw */
           break;
  }
  break;
 }
 return ierr;
}

See Also

Authors

enter here the author name Add here the author references

Bibliography

Add here the function bibliography if any