<commit_before>#include "wrapper_common.h"

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include "mkl_service.h"
#include "mkl_dfti.h"

template<typename Data, typename Precision, typename FFT>
inline MKL_LONG fft_1d_inplace(const MKL_LONG n, Data x[], const Precision forward_scale, const Precision backward_scale, const DFTI_CONFIG_VALUE precision, const DFTI_CONFIG_VALUE domain, FFT fft)
{
	MKL_LONG status = 0;
	DFTI_DESCRIPTOR_HANDLE descriptor = 0;
	status = DftiCreateDescriptor(&descriptor, precision, domain, 1, n);
	if (0 != status) goto failed;

	status = DftiSetValue(descriptor, DFTI_FORWARD_SCALE, forward_scale);
	if (0 != status) goto failed;

	status = DftiSetValue(descriptor, DFTI_BACKWARD_SCALE, backward_scale);
	if (0 != status) goto failed;

	status = DftiCommitDescriptor(descriptor);
	if (0 != status) goto failed;

	status = fft(descriptor, x);
	if (0 != status) goto failed;

cleanup:
	DftiFreeDescriptor(&descriptor);
	return status;

failed:
	status = 1;
	goto cleanup;
}

extern "C" {

	DLLEXPORT MKL_LONG z_fft_forward_inplace(const MKL_LONG n, const double scaling, MKL_Complex16 x[])
	{
		return fft_1d_inplace(n, x, scaling, 1.0, DFTI_DOUBLE, DFTI_COMPLEX, DftiComputeForward);
	}

	DLLEXPORT MKL_LONG c_fft_forward_inplace(const MKL_LONG n, const float scaling, MKL_Complex8 x[])
	{
		return fft_1d_inplace(n, x, scaling, 1.0f, DFTI_SINGLE, DFTI_COMPLEX, DftiComputeForward);
	}

	DLLEXPORT MKL_LONG z_fft_backward_inplace(const MKL_LONG n, const double scaling, MKL_Complex16 x[])
	{
		return fft_1d_inplace(n, x, 1.0, scaling, DFTI_DOUBLE, DFTI_COMPLEX, DftiComputeBackward);
	}

	DLLEXPORT MKL_LONG c_fft_backward_inplace(const MKL_LONG n, const float scaling, MKL_Complex8 x[])
	{
		return fft_1d_inplace(n, x, 1.0f, scaling, DFTI_SINGLE, DFTI_COMPLEX, DftiComputeBackward);
	}
}
<commit_msg>FFT: do not mask MKL error status<commit_after>#include "wrapper_common.h"

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include "mkl_service.h"
#include "mkl_dfti.h"

template<typename Data, typename Precision, typename FFT>
inline MKL_LONG fft_1d_inplace(const MKL_LONG n, Data x[], const Precision forward_scale, const Precision backward_scale, const DFTI_CONFIG_VALUE precision, const DFTI_CONFIG_VALUE domain, FFT fft)
{
	MKL_LONG status = 0;
	DFTI_DESCRIPTOR_HANDLE descriptor = 0;
	status = DftiCreateDescriptor(&descriptor, precision, domain, 1, n);
	if (0 != status) goto cleanup;

	status = DftiSetValue(descriptor, DFTI_FORWARD_SCALE, forward_scale);
	if (0 != status) goto cleanup;

	status = DftiSetValue(descriptor, DFTI_BACKWARD_SCALE, backward_scale);
	if (0 != status) goto cleanup;

	status = DftiCommitDescriptor(descriptor);
	if (0 != status) goto cleanup;

	status = fft(descriptor, x);
	if (0 != status) goto cleanup;

cleanup:
	DftiFreeDescriptor(&descriptor);
	return status;
}

extern "C" {

	DLLEXPORT MKL_LONG z_fft_forward_inplace(const MKL_LONG n, const double scaling, MKL_Complex16 x[])
	{
		return fft_1d_inplace(n, x, scaling, 1.0, DFTI_DOUBLE, DFTI_COMPLEX, DftiComputeForward);
	}

	DLLEXPORT MKL_LONG c_fft_forward_inplace(const MKL_LONG n, const float scaling, MKL_Complex8 x[])
	{
		return fft_1d_inplace(n, x, scaling, 1.0f, DFTI_SINGLE, DFTI_COMPLEX, DftiComputeForward);
	}

	DLLEXPORT MKL_LONG z_fft_backward_inplace(const MKL_LONG n, const double scaling, MKL_Complex16 x[])
	{
		return fft_1d_inplace(n, x, 1.0, scaling, DFTI_DOUBLE, DFTI_COMPLEX, DftiComputeBackward);
	}

	DLLEXPORT MKL_LONG c_fft_backward_inplace(const MKL_LONG n, const float scaling, MKL_Complex8 x[])
	{
		return fft_1d_inplace(n, x, 1.0f, scaling, DFTI_SINGLE, DFTI_COMPLEX, DftiComputeBackward);
	}
}

{'fraction_non_alphanumeric': 0.10252960172228202, 'fraction_numerical': 0.014800861141011841, 'mean_word_length': 6.203488372093023, 'pattern_counts': {'":': 0, '<': 13, '<?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': '6623097', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1434, 'n_words': 349}