File:  [local] / rpl / src / dft.c
Revision 1.64: download - view: text, annotated - select for diffs - revision graph
Fri Jan 10 11:15:41 2020 UTC (4 years, 3 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_32, HEAD
Modification du copyright.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.1.32
    4:   Copyright (C) 1989-2020 Dr. BERTRAND Joël
    5: 
    6:   This file is part of RPL/2.
    7: 
    8:   RPL/2 is free software; you can redistribute it and/or modify it
    9:   under the terms of the CeCILL V2 License as published by the french
   10:   CEA, CNRS and INRIA.
   11:  
   12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
   13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
   15:   for more details.
   16:  
   17:   You should have received a copy of the CeCILL License
   18:   along with RPL/2. If not, write to info@cecill.info.
   19: ================================================================================
   20: */
   21: 
   22: 
   23: #include "rpl-conv.h"
   24: 
   25: 
   26: /*
   27: ================================================================================
   28:   Fonction de calcul d'une transformée de Fourier discrète
   29: ================================================================================
   30:   Entrées : pointeur sur une structure struct_processus
   31: --------------------------------------------------------------------------------
   32:   Sorties :
   33: --------------------------------------------------------------------------------
   34:   Effets de bord : néant
   35: ================================================================================
   36: */
   37: 
   38: void
   39: dft(complex16 *dft, integer4 *nombre_lignes, integer4 *nombre_colonnes,
   40:         integer4 *inverse, integer4 *erreur)
   41: {
   42:     integer4                        i;
   43: 
   44:     gsl_fft_complex_wavetable       *wavetable;
   45:     gsl_fft_complex_workspace       *workspace;
   46: 
   47:     wavetable = gsl_fft_complex_wavetable_alloc((size_t) (*nombre_colonnes));
   48:     workspace = gsl_fft_complex_workspace_alloc((size_t) (*nombre_colonnes));
   49: 
   50:     (*erreur) = 0;
   51: 
   52:     if ((*inverse) == 0)
   53:     {
   54:         for(i = 0; (i < (*nombre_lignes)) && ((*erreur) == 0); i++)
   55:         {
   56:             (*erreur) = gsl_fft_complex_forward((gsl_complex_packed_array)
   57:                     &(dft[i * (*nombre_colonnes)]),
   58:                     (size_t) 1, (size_t) (*nombre_colonnes),
   59:                     wavetable, workspace);
   60:         }
   61:     }
   62:     else
   63:     {
   64:         for(i = 0; (i < (*nombre_lignes)) && ((*erreur) == 0); i++)
   65:         {
   66:             (*erreur) = gsl_fft_complex_inverse((gsl_complex_packed_array)
   67:                     &(dft[i * (*nombre_colonnes)]),
   68:                     (size_t) 1, (size_t) (*nombre_colonnes),
   69:                     wavetable, workspace);
   70:         }
   71:     }
   72: 
   73:     gsl_fft_complex_wavetable_free(wavetable);
   74:     gsl_fft_complex_workspace_free(workspace);
   75: 
   76:     return;
   77: }
   78: 
   79: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>