You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js
+32-5Lines changed: 32 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -117,9 +117,36 @@ function iptr( i, j, k, M, stride, offset ) {
117
117
*
118
118
* ## Notes
119
119
*
120
-
* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the real and imaginary parts of a folded complex vector and where each "column" has `M` elements.
120
+
* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" corresponding to the two parts of the butterfly (`even + odd` and `even - odd`, respectively) and where each "row" has `M*L` elements.
121
121
*
122
-
* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`:
122
+
* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`:
123
+
*
124
+
* ```text
125
+
* │ k = 0 k = 1 k = 2
126
+
* │ ───────────────────────────────────────────────────────────────────────────────→ k
* └────────────────────────────────────────────────────────────────────────────────→ i
131
+
* ↑ ↑ ↑ ↑ ↑ ↑
132
+
* i = 0 M-1 0 M-1 0 M-1
133
+
* ```
134
+
*
135
+
* In the above,
136
+
*
137
+
* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to either the `even + odd` or `even - odd` part of the butterfly.
138
+
* - `j` selects between the `even + odd` and `even - odd` part of the butterfly.
139
+
* - `k` specifies the index of one of the `L` independent transforms we are processing.
140
+
*
141
+
* In linear memory, the three-dimensional logical view is arranged as follows:
* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote.
148
+
*
149
+
* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`.
123
150
*
124
151
* @private
125
152
* @param {NonNegativeInteger} i - index of an element within a sub-sequence
@@ -204,9 +231,6 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride
204
231
for(i=2;i<M;i+=2){
205
232
ic=MP1-i;
206
233
207
-
it1=i-1+ot;
208
-
it2=i+ot;
209
-
210
234
ip1=iptr(i,0,k,M,sc,oc);
211
235
ip2=iptr(ic-1,1,k,M,sc,oc);
212
236
tr2=cc[ip1]-cc[ip2];
@@ -221,6 +245,9 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride
0 commit comments