@@ -50,7 +50,18 @@ arr_cmplx y6 = x1 * 2i;
50
50
### Slicing
51
51
The 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.
52
52
``` 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
54
65
arr_real x = randn(512);
55
66
arr_cmplx y = fft(x);
56
67
```
@@ -91,7 +102,7 @@ arr_real x2 = awgn(x1, 10);
91
102
arr_real y = xcorr(x1, x2);
92
103
```
93
104
94
- Simple Spectrum Analyze (16-bit scale):
105
+ ### Simple Spectrum Analyze (16-bit scale):
95
106
``` cpp
96
107
int nfft = 1024 ;
97
108
arr_real x = randn(nfft) * 1000 ;
0 commit comments