@@ -99,6 +99,7 @@ cdef extern from "src/mklfft.h":
99
99
int double_cdouble_mkl_fftnd_out (cnp .ndarray , cnp .ndarray )
100
100
int float_cfloat_mkl_ifftnd_out (cnp .ndarray , cnp .ndarray )
101
101
int double_cdouble_mkl_ifftnd_out (cnp .ndarray , cnp .ndarray )
102
+ char * mkl_dfti_error (int )
102
103
103
104
# Initialize numpy
104
105
cnp .import_array ()
@@ -265,6 +266,8 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
265
266
cdef long n_ , axis_
266
267
cdef int x_type , f_type , status = 0
267
268
cdef int ALL_HARMONICS = 1
269
+ cdef char * c_error_msg = NULL
270
+ cdef bytes py_error_msg
268
271
269
272
x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
270
273
& axis_ , & n_ , & in_place , & xnd , & dir_ , 0 )
@@ -307,7 +310,9 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
307
310
status = 1
308
311
309
312
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 ))
311
316
312
317
n_max = < long > cnp .PyArray_DIM (x_arr , axis_ )
313
318
if (n_ < n_max ):
@@ -355,7 +360,9 @@ def _fft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
355
360
x_arr , n_ , < int > axis_ , f_arr )
356
361
357
362
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 ))
359
366
360
367
return f_arr
361
368
@@ -379,6 +386,8 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
379
386
cdef int xnd , err , n_max = 0 , in_place , dir_
380
387
cdef long n_ , axis_
381
388
cdef int x_type , status
389
+ cdef char * c_error_msg = NULL
390
+ cdef bytes py_error_msg
382
391
383
392
x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
384
393
& axis_ , & n_ , & in_place , & xnd , & dir_ , 1 )
@@ -419,7 +428,9 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
419
428
status = 1
420
429
421
430
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 ))
423
434
424
435
n_max = < long > cnp .PyArray_DIM (x_arr , axis_ )
425
436
if (n_ < n_max ):
@@ -445,7 +456,9 @@ def _rrfft1d_impl(x, n=None, axis=-1, overwrite_arg=False, direction=+1):
445
456
status = float_float_mkl_rfft_out (x_arr , n_ , < int > axis_ , f_arr )
446
457
447
458
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 ))
449
462
450
463
return f_arr
451
464
@@ -463,7 +476,9 @@ def _rc_fft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
463
476
cdef long n_ , axis_
464
477
cdef int x_type , f_type , status , requirement
465
478
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
467
482
468
483
x_arr = __process_arguments (x , n , axis , overwrite_arg , direction ,
469
484
& axis_ , & n_ , & in_place , & xnd , & dir_ , 1 )
@@ -501,7 +516,9 @@ def _rc_fft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
501
516
status = double_cdouble_mkl_fft1d_out (x_arr , n_ , < int > axis_ , f_arr , HALF_HARMONICS )
502
517
503
518
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 )))
505
522
506
523
return f_arr
507
524
@@ -533,7 +550,9 @@ def _rc_ifft1d_impl(x, n=None, axis=-1, overwrite_arg=False):
533
550
cdef int xnd , err , n_max = 0 , in_place , dir_ , int_n
534
551
cdef long n_ , axis_
535
552
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
537
556
538
557
int_n = _is_integral (n )
539
558
# 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):
579
598
status = cdouble_double_mkl_irfft_out (x_arr , n_ , < int > axis_ , f_arr )
580
599
581
600
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 )))
583
604
584
605
return f_arr
585
606
0 commit comments