1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2006/2007 - INRIA - Alan Layec 4 * Copyright (C) 2008 - INRIA - Allan CORNET 5 * Copyright (C) 2012 - INRIA - Serge STEER 6 * 7 * Copyright (C) 2012 - 2016 - Scilab Enterprises 8 * 9 * This file is hereby licensed under the terms of the GNU GPL v2.0, 10 * pursuant to article 5.3.4 of the CeCILL v.2.1. 11 * This file was originally licensed under the terms of the CeCILL v2.1, 12 * and continues to be available under such terms. 13 * For more information, see the COPYING file which you should have received 14 * along with this program. 15 * 16 */ 17 #ifndef __FFTW_UTILITIES__ 18 #define __FFTW_UTILITIES__ 19 20 #include <string.h> 21 #include <stdio.h> 22 #include "fftw3.h" 23 24 25 /* definiton of a guru_dim structure type */ 26 typedef struct guru_dim_st 27 { 28 int rank; 29 fftw_iodim *dims; 30 int howmany_rank; 31 fftw_iodim *howmany_dims; 32 } guru_dim_struct; 33 34 enum Plan_Type 35 { 36 C2C_PLAN = 0, 37 R2C_PLAN = 1, 38 C2R_PLAN = 2, 39 R2R_PLAN = 3 40 }; 41 42 /* definition of a FFTW_Plan structure type */ 43 typedef struct fftw_plan_st 44 { 45 /* stored parameters of fftw_plan_guru_split_dft function */ 46 enum Plan_Type plan_type; 47 fftw_plan p; 48 guru_dim_struct gdim; 49 unsigned flags; 50 fftw_r2r_kind *kind; 51 } FFTW_Plan_struct; 52 53 54 55 /* prototypes of utilities functions */ 56 fftw_plan GetFFTWPlan(enum Plan_Type type, guru_dim_struct *gdim, 57 double *ri, double *ii, 58 double *ro, double *io, 59 unsigned flags, int isn, fftw_r2r_kind *kind, int *errflag); 60 61 int FreeFFTWPlan(FFTW_Plan_struct *Sci_Plan); 62 63 int CheckGuruDims(guru_dim_struct *gdim1, guru_dim_struct *gdim2); 64 int CheckKindArray(fftw_r2r_kind *kind1, fftw_r2r_kind *kind2, int rank); 65 66 void ExecuteFFTWPlan(enum Plan_Type type, const fftw_plan p, double *ri, double *ii, double *ro, double *io); 67 68 int is_real(double *Ar, double *Ai, int ndims, int *dims); 69 int check_array_symmetry(double *Ar, double *Ai, guru_dim_struct gdim); 70 int complete_array(double *Ar, double *Ai, guru_dim_struct gdim); 71 int dct_scale_array(double *Ar, double *Ai, guru_dim_struct gdim, int isn); 72 int dst_scale_array(double *Ar, double *Ai, guru_dim_struct gdim, int isn); 73 74 unsigned int getCurrentFftwFlags(void); 75 void setCurrentFftwFlags(unsigned int newFftwFlags); 76 77 FFTW_Plan_struct *getSci_Backward_Plan(void); 78 FFTW_Plan_struct *getSci_Forward_Plan(void); 79 80 #endif /* __FFTW_UTILITIES__ */ 81 /*--------------------------------------------------------------------------*/ 82