<commit_before>//
// Java interface for PVFT
//

#include <jni.h>

#include "pvft.h"

#define CLASS_NAME FourierTransform
#define CAT_NAMES(a, b, c, d) a ## _ ## b ## _ ## c ## _ ## d
#define JAVA_NAME(p, c, n) CAT_NAMES(Java_, p, c, n)
#define FN_NAME(method) JAVA_NAME(PACKAGE_NAME, CLASS_NAME, method)

extern "C" JNIEXPORT jint JNICALL FN_NAME(fftSetup)(JNIEnv *env, jclass jc,
    jdoubleArray jce, jint size, jboolean inverse)
{
    double *ce  = env->GetDoubleArrayElements(jce, 0);

    fft_setup_d((complex_d *) ce, size, inverse);

    env->ReleaseDoubleArrayElements(jce, ce, 0);

    return 0;
}

extern "C" JNIEXPORT jint JNICALL FN_NAME(fftS)(JNIEnv *env, jclass jc,
    jfloatArray jcs, jfloatArray jout, jfloatArray jin, jint size)
{
    float *cs  = env->GetFloatArrayElements(jcs, 0);<commit_msg>jni: add fftSetup method implementation<commit_after>//
// Java interface for PVFT
//

#include <jni.h>

#include "pvft.h"

#define CLASS_NAME FourierTransform
#define CAT_NAMES(a, b, c, d) a ## _ ## b ## _ ## c ## _ ## d
#define JAVA_NAME(p, c, n) CAT_NAMES(Java, p, c, n)
#define FN_NAME(method) JAVA_NAME(PACKAGE_NAME, CLASS_NAME, method)

extern "C" JNIEXPORT jint JNICALL FN_NAME(fftSetupS)(JNIEnv *env, jclass jc,
    jfloatArray jce, jint size, jboolean inverse)
{
    float *ce  = env->GetFloatArrayElements(jce, 0);

    fft_setup_s((complex_s *) ce, size, inverse);

    env->ReleaseFloatArrayElements(jce, ce, 0);

    return 0;
}

extern "C" JNIEXPORT jint JNICALL FN_NAME(fftSetupD)(JNIEnv *env, jclass jc,
    jdoubleArray jce, jint size, jboolean inverse)
{
    double *ce  = env->GetDoubleArrayElements(jce, 0);

    fft_setup_d((complex_d *) ce, size, inverse);

    env->ReleaseDoubleArrayElements(jce, ce, 0);

    return 0;
}

extern "C" JNIEXPORT jint JNICALL FN_NAME(fftS)(JNIEnv *env, jclass jc,
    jfloatArray jcs, jfloatArray jout, jfloatArray jin, jint size)
{
    float *cs  = env->GetFloatArrayElements(jcs, 0);
{'fraction_non_alphanumeric': 0.1330603889457523, 'fraction_numerical': 0.005629477993858751, 'mean_word_length': 4.430555555555555, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '768620', 'n_tokens_mistral': 817, 'n_tokens_neox': 763, 'n_words': 197}