Skip to content

Commit

Permalink
fix segmentation fault bug in fft.ifft (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Nov 7, 2022
1 parent 155dad9 commit 25a825e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions code/numpy/fft/fft_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ mp_obj_t fft_fft_ifft_spectrogram(mp_obj_t data_in, uint8_t type) {

if(in->dtype == NDARRAY_COMPLEX) {
uint8_t sz = 2 * sizeof(mp_float_t);
uint8_t *data_ = (uint8_t *)out->array;
for(size_t i = 0; i < len; i++) {
memcpy(data_, array, sz);
memcpy(data, array, sz);
data += 2;
array += in->strides[ULAB_MAX_DIMS - 1];
}
} else {
Expand Down Expand Up @@ -149,7 +149,7 @@ mp_obj_t fft_fft_ifft_spectrogram(mp_obj_t data_in, uint8_t type) {
} else { // inverse transform
fft_kernel_complex(data, len, -1);
// TODO: numpy accepts the norm keyword argument
for(size_t i = 0; i < len; i++) {
for(size_t i = 0; i < 2 * len; i++) {
*data++ /= len;
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/ulab.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "user/user.h"
#include "utils/utils.h"

#define ULAB_VERSION 6.0.0
#define ULAB_VERSION 6.0.1
#define xstr(s) str(s)
#define str(s) #s

Expand Down
6 changes: 6 additions & 0 deletions docs/ulab-change-log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Sat, 5 Nov 2022

version 6.0.1

fix fft.ifft

Wed, 21 Sep 2022

version 6.0.0
Expand Down

0 comments on commit 25a825e

Please sign in to comment.