[CLAM] FFTW vs GCC

Jordi Prats jordi.prats02 at campus.upf.es
Wed Nov 5 12:06:15 PST 2003


Hola,
Tinc uns petits inconvenients a l'hora d'utilitzar la FFTW:

Em dona el següent error:

[rut at arkham fftw]$ gcc tr.c -lfftw3
/usr/local/lib/libfftw3.a(trig1.o): In function `fftw_sincos':
trig1.o(.text+0xb3): undefined reference to `sin'
trig1.o(.text+0xdd): undefined reference to `cos'
collect2: ld returned 1 exit status
[rut at arkham fftw]$

Al instalar no vaig tindre cap problema, em sembla q ho vaig instalar d'un RPM 
per això. Pregunto per saber si es cosa de q no sé si compilo bé o si estan 
mal instalades.

El codi es el següent:
////////////////////////////////////
#include <fftw3.h>

typedef unsigned int size;

#define N 128

void memset2(fftw_complex *mem, fftw_complex x, size s)
{
	#define DOUBLE2 (sizeof(double)*2)
	unsigned int i;
	s=s/DOUBLE2;
	//for(i=0;i<s;i+=DOUBLE2)
	for(i=0;i<s;++i)
	{
		*(mem+i)[0]=x[0];
		*(mem+i)[1]=x[1];
	}
}

int main (void)
{
	fftw_complex *in, *out;
	fftw_plan p;
	
	double relleno[2];
	relleno[0]=3;
	relleno[1]=0;
	
	in = fftw_malloc(sizeof(fftw_complex) * N*N);
	out = fftw_malloc(sizeof(fftw_complex) * N*N);
	
	memset2(in,relleno,sizeof(fftw_complex)*N*N);
	memset(out,0,sizeof(fftw_complex)*N*N);
	
	p = fftw_plan_dft_2d(N,N,in, out, FFTW_FORWARD, FFTW_ESTIMATE);
	
	fftw_execute(p); /* repeat as needed */
	
	fftw_destroy_plan(p);
	
	fftw_free(in);
	fftw_free(out);
	return 0;
}
/////////////////////////////////

--
Jordi




More information about the clam-users mailing list