Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix complex guard in fft
  • Loading branch information
v923z committed Apr 21, 2021
commit b15e21205dad85cae82087f6c647f40537f663f0
2 changes: 1 addition & 1 deletion code/numpy/carray/carray_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void raise_complex_NotImplementedError(void);
#define NOT_IMPLEMENTED_FOR_COMPLEX() raise_complex_NotImplementedError();
#define COMPLEX_DTYPE_NOT_IMPLEMENTED(dtype) if((dtype) == NDARRAY_COMPLEX) raise_complex_NotImplementedError();
#else
#define NOT_IMPLEMENTED_FOR_COMPLEX(); // do nothing
#define NOT_IMPLEMENTED_FOR_COMPLEX() // do nothing
#define COMPLEX_DTYPE_NOT_IMPLEMENTED(dtype) // do nothing
#endif

Expand Down
1 change: 0 additions & 1 deletion code/numpy/fft/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
//| ...
//|
static mp_obj_t fft_fft(size_t n_args, const mp_obj_t *args) {
NOT_IMPLEMENTED_FOR_COMPLEX()
if(n_args == 2) {
return fft_fft_ifft_spectrogram(n_args, args[0], args[1], FFT_FFT);
} else {
Expand Down
4 changes: 4 additions & 0 deletions code/numpy/fft/fft_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "../../ndarray.h"
#include "../../ulab_tools.h"
#include "../carray/carray_tools.h"

#include "fft_tools.h"

#ifndef MP_PI
Expand Down Expand Up @@ -93,6 +95,7 @@ mp_obj_t fft_fft_ifft_spectrogram(size_t n_args, mp_obj_t arg_re, mp_obj_t arg_i
}
}
ndarray_obj_t *re = MP_OBJ_TO_PTR(arg_re);
COMPLEX_DTYPE_NOT_IMPLEMENTED(re->dtype)
#if ULAB_MAX_DIMS > 1
if(re->ndim != 1) {
mp_raise_TypeError(translate("FFT is implemented for linear arrays only"));
Expand Down Expand Up @@ -120,6 +123,7 @@ mp_obj_t fft_fft_ifft_spectrogram(size_t n_args, mp_obj_t arg_re, mp_obj_t arg_i

if(n_args == 2) {
ndarray_obj_t *im = MP_OBJ_TO_PTR(arg_im);
COMPLEX_DTYPE_NOT_IMPLEMENTED(im->dtype)
#if ULAB_MAX_DIMS > 1
if(im->ndim != 1) {
mp_raise_TypeError(translate("FFT is implemented for linear arrays only"));
Expand Down