Browse Source

FFT-MKL: cleanup - drop redundant suffixes

benchmark-la
Christoph Ruegg 10 years ago
parent
commit
aae1d8b0a2
  1. 24
      src/NativeProviders/MKL/fft.cpp
  2. 8
      src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs
  3. 4
      src/Numerics/Providers/FourierTransform/Mkl/MklFourierTransformProvider.cs

24
src/NativeProviders/MKL/fft.cpp

@ -13,7 +13,7 @@ inline MKL_INT64 fft_free(DFTI_DESCRIPTOR_HANDLE* handle)
}
template<typename Precision>
inline MKL_INT64 fft_1d_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const Precision forward_scale, const Precision backward_scale, const DFTI_CONFIG_VALUE precision, const DFTI_CONFIG_VALUE domain)
inline MKL_INT64 fft_create_1d(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const Precision forward_scale, const Precision backward_scale, const DFTI_CONFIG_VALUE precision, const DFTI_CONFIG_VALUE domain)
{
MKL_LONG status = DftiCreateDescriptor(handle, precision, domain, 1, static_cast<MKL_LONG>(n));
DFTI_DESCRIPTOR_HANDLE descriptor = *handle;
@ -24,7 +24,7 @@ inline MKL_INT64 fft_1d_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n
}
template<typename Data, typename FFT>
inline MKL_INT64 fft_1d_inplace(const DFTI_DESCRIPTOR_HANDLE handle, Data x[], FFT fft)
inline MKL_INT64 fft_compute(const DFTI_DESCRIPTOR_HANDLE handle, Data x[], FFT fft)
{
MKL_LONG status = fft(handle, x);
return static_cast<MKL_INT64>(status);
@ -39,31 +39,31 @@ extern "C" {
DLLEXPORT MKL_INT64 z_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const double forward_scale, const double backward_scale)
{
return fft_1d_create(handle, n, forward_scale, backward_scale, DFTI_DOUBLE, DFTI_COMPLEX);
return fft_create_1d(handle, n, forward_scale, backward_scale, DFTI_DOUBLE, DFTI_COMPLEX);
}
DLLEXPORT MKL_INT64 c_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const float forward_scale, const float backward_scale)
{
return fft_1d_create(handle, n, forward_scale, backward_scale, DFTI_SINGLE, DFTI_COMPLEX);
return fft_create_1d(handle, n, forward_scale, backward_scale, DFTI_SINGLE, DFTI_COMPLEX);
}
DLLEXPORT MKL_INT64 z_fft_forward_inplace(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[])
DLLEXPORT MKL_INT64 z_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[])
{
return fft_1d_inplace(handle, x, DftiComputeForward);
return fft_compute(handle, x, DftiComputeForward);
}
DLLEXPORT MKL_INT64 c_fft_forward_inplace(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[])
DLLEXPORT MKL_INT64 c_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[])
{
return fft_1d_inplace(handle, x, DftiComputeForward);
return fft_compute(handle, x, DftiComputeForward);
}
DLLEXPORT MKL_INT64 z_fft_backward_inplace(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[])
DLLEXPORT MKL_INT64 z_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[])
{
return fft_1d_inplace(handle, x, DftiComputeBackward);
return fft_compute(handle, x, DftiComputeBackward);
}
DLLEXPORT MKL_INT64 c_fft_backward_inplace(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[])
DLLEXPORT MKL_INT64 c_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[])
{
return fft_1d_inplace(handle, x, DftiComputeBackward);
return fft_compute(handle, x, DftiComputeBackward);
}
}

8
src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs

@ -393,16 +393,16 @@ namespace MathNet.Numerics.Providers.Common.Mkl
internal static extern long c_fft_create([Out] out IntPtr handle, long n, float forward_scale, float backward_scale);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern long z_fft_forward_inplace([In] IntPtr handle, [In, Out] Complex[] x);
internal static extern long z_fft_forward([In] IntPtr handle, [In, Out] Complex[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern long c_fft_forward_inplace([In] IntPtr handle, [In, Out] Complex32[] x);
internal static extern long c_fft_forward([In] IntPtr handle, [In, Out] Complex32[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern long z_fft_backward_inplace([In] IntPtr handle, [In, Out] Complex[] x);
internal static extern long z_fft_backward([In] IntPtr handle, [In, Out] Complex[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern long c_fft_backward_inplace([In] IntPtr handle, [In, Out] Complex32[] x);
internal static extern long c_fft_backward([In] IntPtr handle, [In, Out] Complex32[] x);
#endregion FFT

4
src/Numerics/Providers/FourierTransform/Mkl/MklFourierTransformProvider.cs

@ -181,14 +181,14 @@ namespace MathNet.Numerics.Providers.FourierTransform.Mkl
public void ForwardInplace(Complex[] complex, FourierTransformScaling scaling)
{
Kernel kernel = Configure(complex.Length, scaling);
SafeNativeMethods.z_fft_forward_inplace(kernel.Handle, complex);
SafeNativeMethods.z_fft_forward(kernel.Handle, complex);
Release(kernel);
}
public void BackwardInplace(Complex[] complex, FourierTransformScaling scaling)
{
Kernel kernel = Configure(complex.Length, scaling);
SafeNativeMethods.z_fft_backward_inplace(kernel.Handle, complex);
SafeNativeMethods.z_fft_backward(kernel.Handle, complex);
Release(kernel);
}

Loading…
Cancel
Save