added fft_twiddle_gen func that calculates twiddles inside provided arrays

This commit is contained in:
2025-10-09 14:34:57 +03:00
parent e7cec37ac5
commit 1256c9b807
4 changed files with 11 additions and 4 deletions

View File

@ -6,12 +6,18 @@
static int64_t twiddle_re[TWIDDLE_L] = {0,};
static int64_t twiddle_im[TWIDDLE_L] = {0,};
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){
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]);
}
}

View File

@ -19,6 +19,7 @@
#define PI 3.141592653589793238462643383279502884197169399375105820974944
#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.