@@ -99,6 +99,7 @@ cdef extern from "src/mklfft.h":
9999 int double_cdouble_mkl_fftnd_out (cnp .ndarray , cnp .ndarray )
100100 int float_cfloat_mkl_ifftnd_out (cnp .ndarray , cnp .ndarray )
101101 int double_cdouble_mkl_ifftnd_out (cnp .ndarray , cnp .ndarray )
102+ char * mkl_dfti_error (int )
102103
103104# Initialize numpy
104105cnp .import_array ()
@@ -265,6 +266,8 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
265266 cdef long n_ , axis_
266267 cdef int x_type , f_type , status = 0
267268 cdef int ALL_HARMONICS = 1
269+ cdef char * c_error_msg = NULL
270+ cdef bytes py_error_msg
268271
269272 x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
270273 & axis_ , & n_ , & in_place , & xnd , & dir_ , 0 )
@@ -307,7 +310,9 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
307310 status = 1
308311
309312 if status :
310- raise ValueError ("Internal error, status={}" .format (status ))
313+ c_error_msg = mkl_dfti_error (status )
314+ py_error_msg = c_error_msg
315+ raise ValueError ("Internal error occurred: {}" .format (py_error_msg ))
311316
312317 n_max = < long > cnp .PyArray_DIM (x_arr , axis_ )
313318 if (n_ < n_max ):
@@ -355,7 +360,9 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
355360 x_arr , n_ , < int > axis_ , f_arr )
356361
357362 if (status ):
358- raise ValueError ("Internal error occurred, status={}" .format (status ))
363+ c_error_msg = mkl_dfti_error (status )
364+ py_error_msg = c_error_msg
365+ raise ValueError ("Internal error occurred: {}" .format (py_error_msg ))
359366
360367 return f_arr
361368
@@ -379,6 +386,8 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
379386 cdef int xnd , err , n_max = 0 , in_place , dir_
380387 cdef long n_ , axis_
381388 cdef int x_type , status
389+ cdef char * c_error_msg = NULL
390+ cdef bytes py_error_msg
382391
383392 x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
384393 & axis_ , & n_ , & in_place , & xnd , & dir_ , 1 )
@@ -419,7 +428,9 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
419428 status = 1
420429
421430 if status :
422- raise ValueError ("Internal error, status={}" .format (status ))
431+ c_error_msg = mkl_dfti_error (status )
432+ py_error_msg = c_error_msg
433+ raise ValueError ("Internal error occurred: {}" .format (py_error_msg ))
423434
424435 n_max = < long > cnp .PyArray_DIM (x_arr , axis_ )
425436 if (n_ < n_max ):
@@ -445,7 +456,9 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
445456 status = float_float_mkl_rfft_out (x_arr , n_ , < int > axis_ , f_arr )
446457
447458 if (status ):
448- raise ValueError ("Internal error occurred, status={}" .format (status ))
459+ c_error_msg = mkl_dfti_error (status )
460+ py_error_msg = c_error_msg
461+ raise ValueError ("Internal error occurred: {}" .format (py_error_msg ))
449462
450463 return f_arr
451464
@@ -463,7 +476,9 @@ def _rc_fft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
463476 cdef long n_ , axis_
464477 cdef int x_type , f_type , status , requirement
465478 cdef int HALF_HARMONICS = 0 # give only positive index harmonics
466- direction = 1 # dummy, only used for the sake of arg-processing
479+ cdef int direction = 1 # dummy, only used for the sake of arg-processing
480+ cdef char * c_error_msg = NULL
481+ cdef bytes py_error_msg
467482
468483 x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
469484 & axis_ , & n_ , & in_place , & xnd , & dir_ , 1 )
@@ -501,7 +516,9 @@ def _rc_fft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
501516 status = double_cdouble_mkl_fft1d_out (x_arr , n_ , < int > axis_ , f_arr , HALF_HARMONICS )
502517
503518 if (status ):
504- raise ValueError ("Internal error occurred, with status={}" .format (status ))
519+ c_error_msg = mkl_dfti_error (status )
520+ py_error_msg = c_error_msg
521+ raise ValueError ("Internal error occurred: {}" .format (str (py_error_msg )))
505522
506523 return f_arr
507524
@@ -533,7 +550,9 @@ def _rc_ifft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
533550 cdef int xnd , err , n_max = 0 , in_place , dir_ , int_n
534551 cdef long n_ , axis_
535552 cdef int x_type , f_type , status
536- direction = 1 # dummy, only used for the sake of arg-processing
553+ cdef int direction = 1 # dummy, only used for the sake of arg-processing
554+ cdef char * c_error_msg = NULL
555+ cdef bytes py_error_msg
537556
538557 int_n = _is_integral (n )
539558 # nn gives the number elements along axis of the input that we use
@@ -579,7 +598,9 @@ def _rc_ifft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
579598 status = cdouble_double_mkl_irfft_out (x_arr , n_ , < int > axis_ , f_arr )
580599
581600 if (status ):
582- raise ValueError ("Internal error occurred, status={}" .format (status ))
601+ c_error_msg = mkl_dfti_error (status )
602+ py_error_msg = c_error_msg
603+ raise ValueError ("Internal error occurred: {}" .format (str (py_error_msg )))
583604
584605 return f_arr
585606
0 commit comments