com_fft.c, enable fft for clipped vectors
This commit is contained in:
parent
ad5ccd2d61
commit
1aa086ca71
|
|
@ -165,8 +165,12 @@ com_fft(wordlist *wl)
|
||||||
in = fftw_malloc(sizeof(double) * (unsigned int) length);
|
in = fftw_malloc(sizeof(double) * (unsigned int) length);
|
||||||
out = fftw_malloc(sizeof(fftw_complex) * (unsigned int) fpts);
|
out = fftw_malloc(sizeof(fftw_complex) * (unsigned int) fpts);
|
||||||
|
|
||||||
for (j = 0; j < length; j++)
|
for (j = 0; j < length; j++) {
|
||||||
in[j] = tdvec[i][j]*win[j];
|
in[j] = tdvec[i][j] * win[j];
|
||||||
|
/* check for clipped values (NaNs) */
|
||||||
|
if (isnan(in[j]))
|
||||||
|
in[j] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
plan_forward = fftw_plan_dft_r2c_1d(length, in, out, FFTW_ESTIMATE);
|
plan_forward = fftw_plan_dft_r2c_1d(length, in, out, FFTW_ESTIMATE);
|
||||||
|
|
||||||
|
|
@ -191,6 +195,9 @@ com_fft(wordlist *wl)
|
||||||
in = TMALLOC(double, N);
|
in = TMALLOC(double, N);
|
||||||
for (j = 0; j < length; j++) {
|
for (j = 0; j < length; j++) {
|
||||||
in[j] = tdvec[i][j]*win[j];
|
in[j] = tdvec[i][j]*win[j];
|
||||||
|
/* check for clipped values (NaNs) */
|
||||||
|
if (isnan(in[j]))
|
||||||
|
in[j] = 0.0;
|
||||||
}
|
}
|
||||||
for (j = length; j < N; j++) {
|
for (j = length; j < N; j++) {
|
||||||
in[j] = 0.0;
|
in[j] = 0.0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue