Compare commits

..

4 Commits

12 changed files with 65074 additions and 65041 deletions

11
.project Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Theta_fourier</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@ -3,15 +3,28 @@
#include <math.h>
#include <stdio.h>
#ifndef FFT_FP_EXTERNAL_TWIDDLES
static int64_t twiddle_re[TWIDDLE_L] = {0,};
static int64_t twiddle_im[TWIDDLE_L] = {0,};
#define PRINTF
#endif
void fft_fp_prepare(void){
void fft_twiddle_gen(int64_t* tw_re, int64_t* tw_im){
for (uint32_t k = 0; k < TWIDDLE_L; ++k){
double angle = 2.0 * PI * k / DATA_L;
twiddle_re[k] = lround(cos(angle) * FP_acc);
twiddle_im[k] = lround(-sin(angle) * FP_acc);
printf("k, angle, tw_re, tw_im: %u %g %lld %lld\n", k, angle, (long long)twiddle_re[k], (long long)twiddle_im[k]);
tw_re[k] = lround(cos(angle) * FP_acc);
tw_im[k] = lround(-sin(angle) * FP_acc);
}
}
void fft_fp_prepare(void){
fft_twiddle_gen(twiddle_re, twiddle_im);
for (uint32_t k = 0; k < TWIDDLE_L; ++k){
#ifdef PRINTF
printf("k, angle, tw_re, tw_im: %u %g %lld %lld\n", k, 2.0 * PI * k / DATA_L, (long long)twiddle_re[k], (long long)twiddle_im[k]);
#endif
}
}
@ -82,7 +95,10 @@ void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf){
for (uint32_t ii = 0; ii < inp_L; ++ii){
buf[ii*2] /= inp_L;
buf[ii*2+1] /= inp_L;
#ifdef PRINTF
printf("re,im: %lld, %lld\n", (long long)buf[ii*2], (long long)buf[ii*2 +1]);
#endif
}
}

View File

@ -19,6 +19,12 @@
#define PI 3.141592653589793238462643383279502884197169399375105820974944
#endif
#ifdef FFT_FP_EXTERNAL_TWIDDLES
extern volatile int64_t twiddle_re[TWIDDLE_L];
extern volatile int64_t twiddle_im[TWIDDLE_L];
#endif
void fft_twiddle_gen(int64_t* twiddle_re, int64_t* twiddle_im);
void fft_fp_prepare(void);
void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf);

Binary file not shown.

BIN
C/FP_math

Binary file not shown.

View File

@ -5,7 +5,7 @@
#include <math.h>
#define DATA_L (1<<16)
#define FP_acc 1000
#define FP_acc (1<<16)
#include "FFT_FP_realisation.h"

Binary file not shown.

130072
C/tmp

File diff suppressed because it is too large Load Diff