diff --git a/src/NativeProviders/MKL/capabilities.cpp b/src/NativeProviders/MKL/capabilities.cpp index ae675c6b..270e1521 100644 --- a/src/NativeProviders/MKL/capabilities.cpp +++ b/src/NativeProviders/MKL/capabilities.cpp @@ -20,6 +20,11 @@ extern "C" { case 0: return 0; case 1: return -1; + case 4: return sizeof(size_t); // 4 (x86), 8 (x64) + case 5: return sizeof(MKL_INT); // 4 (both) + case 6: return sizeof(MKL_LONG); // 4 (both) + case 7: return sizeof(MKL_INT64); // 8 (both) + // PLATFORM case 8: #ifdef _M_IX86 diff --git a/src/NativeProviders/MKL/fft.cpp b/src/NativeProviders/MKL/fft.cpp index 870e6e77..cd20a16b 100644 --- a/src/NativeProviders/MKL/fft.cpp +++ b/src/NativeProviders/MKL/fft.cpp @@ -6,63 +6,61 @@ #include #include "mkl_dfti.h" -inline MKL_INT64 fft_free(DFTI_DESCRIPTOR_HANDLE* handle) +inline MKL_LONG fft_free(DFTI_DESCRIPTOR_HANDLE* handle) { - MKL_LONG status = DftiFreeDescriptor(handle); - return static_cast(status); + return DftiFreeDescriptor(handle); } template -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) +inline MKL_LONG fft_create_1d(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_LONG 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(n)); + MKL_LONG status = DftiCreateDescriptor(handle, precision, domain, 1, n); DFTI_DESCRIPTOR_HANDLE descriptor = *handle; if (0 == status) status = DftiSetValue(descriptor, DFTI_FORWARD_SCALE, forward_scale); if (0 == status) status = DftiSetValue(descriptor, DFTI_BACKWARD_SCALE, backward_scale); if (0 == status) status = DftiCommitDescriptor(descriptor); - return static_cast(status); + return status; } template -inline MKL_INT64 fft_compute(const DFTI_DESCRIPTOR_HANDLE handle, Data x[], FFT fft) +inline MKL_LONG fft_compute(const DFTI_DESCRIPTOR_HANDLE handle, Data x[], FFT fft) { - MKL_LONG status = fft(handle, x); - return static_cast(status); + return fft(handle, x); } extern "C" { - DLLEXPORT MKL_INT64 x_fft_free(DFTI_DESCRIPTOR_HANDLE* handle) + DLLEXPORT MKL_LONG x_fft_free(DFTI_DESCRIPTOR_HANDLE* handle) { return fft_free(handle); } - DLLEXPORT MKL_INT64 z_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const double forward_scale, const double backward_scale) + DLLEXPORT MKL_LONG z_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_COMPLEX); } - DLLEXPORT MKL_INT64 c_fft_create(DFTI_DESCRIPTOR_HANDLE* handle, const MKL_INT64 n, const float forward_scale, const float backward_scale) + DLLEXPORT MKL_LONG c_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_COMPLEX); } - DLLEXPORT MKL_INT64 z_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[]) + DLLEXPORT MKL_LONG z_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[]) { return fft_compute(handle, x, DftiComputeForward); } - DLLEXPORT MKL_INT64 c_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[]) + DLLEXPORT MKL_LONG c_fft_forward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[]) { return fft_compute(handle, x, DftiComputeForward); } - DLLEXPORT MKL_INT64 z_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[]) + DLLEXPORT MKL_LONG z_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex16 x[]) { return fft_compute(handle, x, DftiComputeBackward); } - DLLEXPORT MKL_INT64 c_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[]) + DLLEXPORT MKL_LONG c_fft_backward(const DFTI_DESCRIPTOR_HANDLE handle, MKL_Complex8 x[]) { return fft_compute(handle, x, DftiComputeBackward); } diff --git a/src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs b/src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs index 0378e5c4..c336e8f6 100644 --- a/src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs +++ b/src/Numerics/Providers/Common/Mkl/SafeNativeMethods.cs @@ -384,25 +384,25 @@ namespace MathNet.Numerics.Providers.Common.Mkl #region FFT [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] - internal static extern long x_fft_free([In] ref IntPtr handle); + internal static extern int x_fft_free([In] ref IntPtr handle); [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] - internal static extern long z_fft_create([Out] out IntPtr handle, long n, double forward_scale, double backward_scale); + internal static extern int z_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 long c_fft_create([Out] out IntPtr handle, long n, float forward_scale, float backward_scale); + 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 long z_fft_forward([In] IntPtr handle, [In, Out] Complex[] x); + internal static extern int 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([In] IntPtr handle, [In, Out] Complex32[] x); + 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 long z_fft_backward([In] IntPtr handle, [In, Out] Complex[] x); + 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 long c_fft_backward([In] IntPtr handle, [In, Out] Complex32[] x); + internal static extern int c_fft_backward([In] IntPtr handle, [In, Out] Complex32[] x); #endregion FFT