<commit_before>#include <fftw3.h>
#include <math.h>
#include <stdlib.h>

struct fft_data {

    int num_samples;

    float *window;

    float *in, *out;
    fftwf_plan forward, inverse;

};


void setup_fft (struct fft_data *d, int N) {

    d->num_samples = N;

    d->window = (float*) malloc(N);


    d->in      = (float*) fftwf_malloc(sizeof(float) * N);
    d->out     = (float*) fftwf_malloc(sizeof(float) * N);
    d->forward = fftwf_plan_r2r_1d(N, d->in, d->out, FFTW_FORWARD,  FFTW_ESTIMATE);
    d->inverse = fftwf_plan_r2r_1d(N, d->in, d->out, FFTW_BACKWARD, FFTW_ESTIMATE);


    int i;
    for (i = 0; i < N; i++) {
        d->window[i] = 0.5 * (1.0 - cos(2 * M_PI * i / (N-1.0)) );
    }
}

/*

void forward_fft (struct fft_data *d) {
    fftw_execute(d->forward);
}

void inverse_fft (struct fft_data *d) {
    fftw_execute(d->inverse);
}

void cleanup_fft (struct fft_data *d) {

    fftw_destroy_plan(d->forward);
    fftw_destroy_plan(d->inverse);

    fftw_free(d->in);
    fftw_free(d->out);

}
*/

<commit_msg>moving fft over to using single data buffer<commit_after>#include <fftw3.h>
#include <math.h>
#include <stdlib.h>

struct fft_data {

    int num_samples;

    float *window;

    float *data;
    fftwf_plan forward, inverse;

};


void setup_fft (struct fft_data *d, int N) {

    d->num_samples = N;

    d->window = (float*) malloc(N);


    d->data    = (float*) fftwf_malloc(sizeof(float) * N);
    d->forward = fftwf_plan_r2r_1d(N, d->data, d->data, FFTW_FORWARD,  FFTW_ESTIMATE);
    d->inverse = fftwf_plan_r2r_1d(N, d->data, d->data, FFTW_BACKWARD, FFTW_ESTIMATE);


    int i;
    for (i = 0; i < N; i++) {
        d->window[i] = 0.5 * (1.0 - cos(2 * M_PI * i / (N-1.0)) );
    }
}

/*

void forward_fft (struct fft_data *d) {
    fftw_execute(d->forward);
}

void inverse_fft (struct fft_data *d) {
    fftw_execute(d->inverse);
}

void cleanup_fft (struct fft_data *d) {

    fftw_destroy_plan(d->forward);
    fftw_destroy_plan(d->inverse);

    fftw_free(d->data);

}
*/


{'fraction_non_alphanumeric': 0.16782178217821783, 'fraction_numerical': 0.01287128712871287, 'mean_word_length': 3.009920634920635, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '989947', 'n_tokens_mistral': 937, 'n_tokens_neox': 870, 'n_words': 173}