Skip to content

Commit 376ec9d

Browse files
committed
docs: add examples
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent f982356 commit 376ec9d

File tree

1 file changed

+52
-0
lines changed
  • lib/node_modules/@stdlib/fft/base/fftpack/lib

1 file changed

+52
-0
lines changed

lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
*
9797
* ```text
9898
* | cc(0,0,0) ... cc(3,0,0) | cc(0,1,0) ... cc(3,1,0) | cc(0,0,1) ... cc(3,0,1) | ... | cc(0,1,2) ... cc(3,1,2) |
99+
* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
100+
* 0 M-1 M 2M-1 2M 3M-1 (2L-1)M 2LM-1
99101
* ```
100102
*
101103
* @private
@@ -106,6 +108,30 @@
106108
* @param {integer} stride - stride length of the input array
107109
* @param {NonNegativeInteger} offset - index specifying the first indexed element in the input array
108110
* @returns {NonNegativeInteger} computed index
111+
*
112+
* @example
113+
* var stride = 1;
114+
* var offset = 0;
115+
*
116+
* var M = 4; // sub-sequence length
117+
* var L = 3; // number of sub-sequences
118+
*
119+
* var idx = iptr( 0, 0, 0, M, stride, offset );
120+
* // returns 0
121+
*
122+
* idx = iptr( 1, 0, 0, M, stride, offset );
123+
* // returns 1
124+
*
125+
* idx = iptr( M-1, 0, 0, M, stride, offset );
126+
* // returns 3
127+
*
128+
* idx = iptr( 0, 1, 0, M, stride, offset );
129+
* // returns 4
130+
*
131+
* // ...
132+
*
133+
* idx = iptr( M-1, 1, L-1, M, stride, offset );
134+
* // returns 23
109135
*/
110136
function iptr( i, j, k, M, stride, offset ) {
111137
var n = i + ( ( j+(k*2) ) * M );
@@ -142,6 +168,8 @@ function iptr( i, j, k, M, stride, offset ) {
142168
*
143169
* ```text
144170
* | out(0,0,0)...out(3,0,0) ... out(0,2,0)...out(3,2,0) | out(0,0,1)...out(3,0,1) ... out(0,2,1)...out(3,2,1) |
171+
* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
172+
* 0 M-1 LM LM-1 LM (L+1)M-1 (2L-1)M 2LM-1
145173
* ```
146174
*
147175
* 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.
@@ -157,6 +185,30 @@ function iptr( i, j, k, M, stride, offset ) {
157185
* @param {integer} stride - stride length of the output array
158186
* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array
159187
* @returns {NonNegativeInteger} computed index
188+
*
189+
* @example
190+
* var stride = 1;
191+
* var offset = 0;
192+
*
193+
* var M = 4; // sub-sequence length
194+
* var L = 3; // number of sub-sequences
195+
*
196+
* var idx = optr( 0, 0, 0, L, M, stride, offset );
197+
* // returns 0
198+
*
199+
* idx = optr( 1, 0, 0, L, M, stride, offset );
200+
* // returns 1
201+
*
202+
* idx = optr( M-1, 0, 0, L, M, stride, offset );
203+
* // returns 3
204+
*
205+
* idx = optr( 0, 1, 0, L, M, stride, offset );
206+
* // returns 4
207+
*
208+
* // ...
209+
*
210+
* idx = optr( M-1, L-1, 1, L, M, stride, offset );
211+
* // returns 23
160212
*/
161213
function optr( i, k, j, L, M, stride, offset ) {
162214
var n = i + ( ( k+(j*L) ) * M );

0 commit comments

Comments
 (0)