bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] FFT stride problem


From: Brown, Aaron D
Subject: [Bug-gsl] FFT stride problem
Date: Wed, 10 Jan 2007 17:40:48 -0500

Hi,

I have a potential bug to report:


GSL Version: 1.8
HW/OS: Dell Pentium D running Linux CentOS 4.4 Kernel 2.6.9-42 Elsmp on
i686
Compiler: GCC 3.4.6

I have been getting program crashes after using stride values greater
than 1 with the FFT functions.  The crashes seem to happen when I try to
free the data buffer that I passed into the FFT function which I
dynamically allocated.  My program also crashes sometimes if I free the
wavetable and workspaces.  Changing the stride value that I pass into
the FFT function seems to affect which deallocation will fail.  Also, it
doesn't seem to be limited to a specific FFT function.  The following is
a test program that will hopefully illustrate the problem that I have
been having:



#include <stdio.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_fft_complex.h>

int main(void)
{
   double* data = malloc(32*sizeof(double));
   gsl_fft_complex_wavetable *table =
gsl_fft_complex_wavetable_alloc(16);
   gsl_fft_complex_workspace *space =
gsl_fft_complex_workspace_alloc(16);
   int i;

   for (i = 0; i < 32; i++)
   {
      data[i] = i;
      printf("data[%d] = %f\n", i, data[i]);
   }

   int retCode = gsl_fft_complex_forward(
         data, 2, 16, table, space);

   printf("return code = %d\n", retCode);

   for (i = 0; i < 32; i++)
   {
      printf("data[%d] = %f\n", i, data[i]);
   }

   printf("freeing wavetable\n");
   gsl_fft_complex_wavetable_free(table);
   printf("free workspace\n");
   gsl_fft_complex_workspace_free(space);
   printf("free data buffer\n");
   free(data);
}




Regards,

Aaron Brown
address@hidden  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]