@@ -50,7 +50,18 @@ arr_cmplx y6 = x1 * 2i;
5050### Slicing
5151The behavior of slices is as close as possible to numpy. Except for cases with invalid indexes, in which case numpy does not throw an exception.
5252``` cpp
53- using namespace dsplib ;
53+ arr_real x = {0, 1, 2, 3, 4, 5, 6};
54+ x.slice(0, 2) ///{0, 1}
55+ x.slice(2, -1) ///{2, 3, 4, 5}
56+ x.slice(-1, 0, -1) ///{6, 5, 4, 3, 2, 1}
57+ x.slice(-1, 0) ///OUT_OF_RANGE, but numpy returns [ ]
58+ x.slice(0, -1, -1) ///OUT_OF_RANGE, but numpy returns [ ]
59+ x.slice(-8, 7) ///OUT_OF_RANGE, but numpy returns [ 0 1 2 3 4 5 6]
60+ ```
61+
62+ ### Fast Fourier Transform:
63+ The FFT/IFFT calculation table is cached on first run. To eliminate this behavior, you can use the fft_plan object.
64+ ```cpp
5465arr_real x = randn(512);
5566arr_cmplx y = fft(x);
5667```
@@ -91,7 +102,7 @@ arr_real x2 = awgn(x1, 10);
91102arr_real y = xcorr(x1, x2);
92103```
93104
94- Simple Spectrum Analyze (16-bit scale):
105+ ### Simple Spectrum Analyze (16-bit scale):
95106``` cpp
96107int nfft = 1024 ;
97108arr_real x = randn(nfft) * 1000 ;
0 commit comments