Browse Source

FFT-MKL: real packed transformation support

pull/445/head
Christoph Ruegg 10 years ago
parent
commit
f1f3b93bb9
  1. 30
      src/NativeProviders/MKL/fft.cpp
  2. 18
      src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs

30
src/NativeProviders/MKL/fft.cpp

@ -47,6 +47,16 @@ extern "C" {
return fft_create_1d(handle, n, forward_scale, backward_scale, DFTI_SINGLE, DFTI_COMPLEX);
}
DLLEXPORT MKL_LONG d_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_LONG n, const double forward_scale, const double backward_scale)
{
return fft_create_1d(handle, n, forward_scale, backward_scale, DFTI_DOUBLE, DFTI_REAL);
}
DLLEXPORT MKL_LONG s_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_LONG n, const float forward_scale, const float backward_scale)
{
return fft_create_1d(handle, n, forward_scale, backward_scale, DFTI_SINGLE, DFTI_REAL);
}
DLLEXPORT MKL_LONG z_fft_create_multidim(DFTI_DESCRIPTOR_HANDLE* handle, MKL_LONG dimensions, MKL_LONG n[], const double forward_scale, const double backward_scale)
{
return fft_create_md(handle, dimensions, n, forward_scale, backward_scale, DFTI_DOUBLE, DFTI_COMPLEX);
@ -67,6 +77,16 @@ extern "C" {
return DftiComputeForward(handle, x);
}
DLLEXPORT MKL_LONG d_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, double x[])
{
return DftiComputeForward(handle, x);
}
DLLEXPORT MKL_LONG s_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, float x[])
{
return DftiComputeForward(handle, x);
}
DLLEXPORT MKL_LONG z_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[])
{
return DftiComputeBackward(handle, x);
@ -76,4 +96,14 @@ extern "C" {
{
return DftiComputeBackward(handle, x);
}
DLLEXPORT MKL_LONG d_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, double x[])
{
return DftiComputeBackward(handle, x);
}
DLLEXPORT MKL_LONG s_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, float x[])
{
return DftiComputeBackward(handle, x);
}
}

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

@ -392,6 +392,12 @@ namespace MathNet.Numerics.Providers.Common.Mkl
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_fft_create([Out] out IntPtr handle, int n, float forward_scale, float backward_scale);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_fft_create([Out] out IntPtr handle, int n, double forward_scale, double backward_scale);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_fft_create([Out] out IntPtr handle, int n, float forward_scale, float backward_scale);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_fft_create_multidim([Out] out IntPtr handle, int dimensions, [In] int[] n, double forward_scale, double backward_scale);
@ -404,12 +410,24 @@ namespace MathNet.Numerics.Providers.Common.Mkl
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_fft_forward([In] IntPtr handle, [In, Out] Complex32[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_fft_forward([In] IntPtr handle, [In, Out] double[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_fft_forward([In] IntPtr handle, [In, Out] float[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_fft_backward([In] IntPtr handle, [In, Out] Complex[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_fft_backward([In] IntPtr handle, [In, Out] Complex32[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_fft_backward([In] IntPtr handle, [In, Out] double[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_fft_backward([In] IntPtr handle, [In, Out] float[] x);
#endregion FFT
// ReSharper restore InconsistentNaming

Loading…
Cancel
Save