From 585ca79e105c6e8ca57a2320c2335623a184ae06 Mon Sep 17 00:00:00 2001 From: Franz Zotter Date: Tue, 5 Jun 2012 09:32:22 +0000 Subject: improved check for fftw svn path=/trunk/externals/iem/iemmatrix/; revision=16149 --- src/configure.ac | 8 ++++++-- src/iemmatrix_sources.c | 1 + src/iemmatrix_sources.h | 1 + src/mtx_rfft.c | 20 ++++++++++---------- src/mtx_rifft.c | 24 ++++++++++++------------ 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/configure.ac b/src/configure.ac index 2a0a7be..5830de2 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -59,7 +59,11 @@ AC_CHECK_LIB(m, main) dnl Replace `main' with a function in -lpthread: dnl AC_CHECK_LIB(pthread, main) dnl Replace `main' with a function in -lfftw3: -AC_CHECK_LIB(fftw3, fftw_destroy_plan) +AC_CHECK_LIB([fftw3], + [fftw_execute], + [AC_CHECK_HEADER([fftw3.h], + [AC_DEFINE(USE_FFTW,1,[can we use fftw?])], + )]) dnl for soundfile reading (and writing, if we do that...) AC_CHECK_LIB(sndfile, sf_close) @@ -68,7 +72,7 @@ dnl for gnu scientific library -lgsl: dnl AC_CHECK_LIB([m], [cos]) AC_CHECK_LIB([gslcblas], [cblas_dgemm]) AC_CHECK_LIB([gsl], [gsl_blas_dgemm]) -AC_CHECK_LIB([gsl], [gsl_eigen_nonsymm],AC_DEFINE(HAVE_GSL_EIGEN_NONSYMM,1,[can gsl compute complex eigenvalues?])) +AC_CHECK_LIB([gsl], [gsl_eigen_nonsymm],[AC_DEFINE(HAVE_GSL_EIGEN_NONSYMM,1,[can gsl compute complex eigenvalues?])]) AC_CHECK_LIB([gsl], [gsl_sf_bessel_Jn],AC_DEFINE(HAVE_GSL_BESSEL,1,[can gsl compute Bessel functions?])) dnl for math.h Bessel/Neumann functions diff --git a/src/iemmatrix_sources.c b/src/iemmatrix_sources.c index d6e3431..11bb4d4 100644 --- a/src/iemmatrix_sources.c +++ b/src/iemmatrix_sources.c @@ -36,6 +36,7 @@ void iemmatrix_sources_setup(void) iemtx_dispersive_dline_setup(); /* mtx_dispersive_dline.c */ iemtx_distance2_setup(); /* mtx_distance2.c */ iemtx_egg_setup(); /* mtx_egg.c */ + iemtx_ei__setup(); /* mtx_ei~.c */ iemtx_eig_setup(); /* mtx_eig.c */ iemtx_element_setup(); /* mtx_element.c */ iemtx_eq_setup(); /* mtx_eq.c */ diff --git a/src/iemmatrix_sources.h b/src/iemmatrix_sources.h index cd1e9ab..0e24529 100644 --- a/src/iemmatrix_sources.h +++ b/src/iemmatrix_sources.h @@ -34,6 +34,7 @@ void iemtx_diff_setup(void); /* mtx_diff.c */ void iemtx_dispersive_dline_setup(void); /* mtx_dispersive_dline.c */ void iemtx_distance2_setup(void); /* mtx_distance2.c */ void iemtx_egg_setup(void); /* mtx_egg.c */ +void iemtx_ei__setup(void); /* mtx_ei~.c */ void iemtx_eig_setup(void); /* mtx_eig.c */ void iemtx_element_setup(void); /* mtx_element.c */ void iemtx_eq_setup(void); /* mtx_eq.c */ diff --git a/src/mtx_rfft.c b/src/mtx_rfft.c index 2d9d18f..705178f 100644 --- a/src/mtx_rfft.c +++ b/src/mtx_rfft.c @@ -15,13 +15,13 @@ #include "iemmatrix.h" #include -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW #include #endif static t_class *mtx_rfft_class; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW enum ComplexPart { REALPART=0, IMAGPART=1}; #endif @@ -31,7 +31,7 @@ struct _MTXRfft_ t_object x_obj; int size; int size2; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW int fftn; int rows; fftw_plan *fftplan; @@ -51,7 +51,7 @@ struct _MTXRfft_ static void deleteMTXRfft (MTXRfft *x) { -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW int n; if (x->fftplan) { for (n=0; nrows; n++) @@ -80,7 +80,7 @@ static void *newMTXRfft (t_symbol *s, int argc, t_atom *argv) x->list_re_out = outlet_new (&x->x_obj, gensym("matrix")); x->list_im_out = outlet_new (&x->x_obj, gensym("matrix")); x->size=x->size2=0; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW x->fftn=0; x->rows=0; x->f_in=0; @@ -136,7 +136,7 @@ static void readFloatFromList (int n, t_atom *l, t_float *f) *f++ = atom_getfloat (l++); } -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW static void writeFFTWComplexPartIntoList (int n, t_atom *l, fftw_complex *c, enum ComplexPart p) { t_float f; @@ -164,7 +164,7 @@ static void mTXRfftMatrix (MTXRfft *x, t_symbol *s, int fft_count; t_atom *list_re = x->list_re; t_atom *list_im = x->list_im; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW fftw_complex *f_out = x->f_out; double *f_in = x->f_in; #else @@ -184,7 +184,7 @@ static void mTXRfftMatrix (MTXRfft *x, t_symbol *s, /* ok, do the FFT! */ /* memory things */ -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW if ((x->rows!=rows)||(columns!=x->fftn)){ f_out=(fftw_complex*)realloc(f_out, sizeof(fftw_complex)*(size2-2)); f_in=(double*)realloc(f_in, sizeof(double)*size); @@ -217,7 +217,7 @@ static void mTXRfftMatrix (MTXRfft *x, t_symbol *s, x->list_re = list_re; /* main part */ -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW readDoubleFromList (size, argv, f_in); #else readFloatFromList (size, argv, f_re); @@ -226,7 +226,7 @@ static void mTXRfftMatrix (MTXRfft *x, t_symbol *s, list_re += 2; list_im += 2; for (fft_count=0;fft_countfftplan[fft_count]); writeFFTWComplexPartIntoList(columns_re,list_re,f_out,REALPART); writeFFTWComplexPartIntoList(columns_re,list_im,f_out,IMAGPART); diff --git a/src/mtx_rifft.c b/src/mtx_rifft.c index 27adc24..3f41637 100644 --- a/src/mtx_rifft.c +++ b/src/mtx_rifft.c @@ -15,13 +15,13 @@ #include "iemmatrix.h" #include -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW #include #endif static t_class *mtx_rifft_class; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW enum ComplexPart { REALPART=0, IMAGPART=1}; #endif @@ -34,7 +34,7 @@ typedef struct _MTXRifft_ int size; int size2; t_float renorm_fac; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW fftw_plan *fftplan; fftw_complex *f_in; double *f_out; @@ -90,7 +90,7 @@ static void ifftPrepareReal (int n, t_float *re, t_float *im) *++re = -*--im; } -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW static void readFFTWComplexPartFromList (int n, t_atom *l, fftw_complex *f, enum ComplexPart p) { for (;n--;) @@ -133,7 +133,7 @@ static void mTXRifftMatrixCold (MTXRifft *x, t_symbol *s, int size = rows * columns; int ifft_count; t_atom *list_re = x->list_re; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW fftw_complex *f_in = x->f_in; double *f_out = x->f_out; #else @@ -153,7 +153,7 @@ static void mTXRifftMatrixCold (MTXRifft *x, t_symbol *s, else if (columns == (1 << ilog2(columns))) { /* memory things */ -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW if ((x->rows!=rows)||(columns!=x->columns)){ for (ifft_count=0;ifft_countrows;ifft_count++) { fftw_destroy_plan(x->fftplan[ifft_count]); @@ -192,7 +192,7 @@ static void mTXRifftMatrixCold (MTXRifft *x, t_symbol *s, ifft_count = rows; x->renorm_fac = 1.0f / columns; for (ifft_count=0;ifft_countsize2; int ifft_count; -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW fftw_complex *f_in = x->f_in; #else t_float *f_re = x->f_re; @@ -235,7 +235,7 @@ static void mTXRifftMatrixHot (MTXRifft *x, t_symbol *s, post("mtx_rifft: invalid right side matrix"); else { /* main part */ for (ifft_count=0;ifft_countfftplan[ifft_count]); f_in+=columns_re; @@ -248,14 +248,14 @@ static void mTXRifftMatrixHot (MTXRifft *x, t_symbol *s, #endif argv += columns_re; } -#ifndef HAVE_FFTW3_H +#ifndef USE_FFTW f_re = x->f_re; #endif size2 = x->size2; SETFLOAT(x->list_re, rows); SETFLOAT(x->list_re+1, x->columns); -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW multiplyDoubleVector (size, x->f_out, renorm_fac); writeDoubleIntoList (size, x->list_re+2, x->f_out); #else @@ -276,7 +276,7 @@ static void mTXRifftBang (MTXRifft *x) static void deleteMTXRifft (MTXRifft *x) { -#ifdef HAVE_FFTW3_H +#ifdef USE_FFTW int n; if (x->fftplan) { for (n=0; nrows; n++) -- cgit v1.2.1