Skip to content

Commit 4308548

Browse files
committed
refactor: change stride and offset parameter names
1 parent 93ffa30 commit 4308548

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ limitations under the License.
4040
var decompose = require( '@stdlib/fft/base/fftpack/decompose' );
4141
```
4242

43-
#### decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut, offsetOut )
43+
#### decompose( N, M, initial, si, oi, out, so, oo )
4444

4545
Factorizes a sequence length into a product of integers.
4646

@@ -61,11 +61,11 @@ The function accepts the following arguments:
6161
- **N**: length of the sequence.
6262
- **M**: number of trial divisors.
6363
- **initial**: array of initial trial divisors.
64-
- **strideInitial**: stride length for `initial`.
65-
- **offsetInitial**: starting index for `initial`.
64+
- **si**: stride length for `initial`.
65+
- **oi**: starting index for `initial`.
6666
- **out**: output array for storing factorization results.
67-
- **strideOut**: stride length for `out`.
68-
- **offsetOut**: starting index for `out`.
67+
- **so**: stride length for `out`.
68+
- **oo**: starting index for `out`.
6969

7070
The function returns the number of factors into which `N` was decomposed.
7171

lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/repl.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
{{alias}}( N, M, initial, strideInitial, offsetInitial, out, strideOut, offsetOut )
2+
{{alias}}( N, M, initial, si, oi, out, so, oo )
33
Factorizes a sequence length into a product of integers.
44

55
Factorization results are stored in the output array sequentially, where
@@ -20,19 +20,19 @@
2020
initial: Collection<number>
2121
Array of initial trial divisors.
2222

23-
strideInitial: number
23+
si: number
2424
Stride length for `initial`.
2525

26-
offsetInitial: number
26+
oi: number
2727
Starting index for `initial`.
2828

2929
out: Collection<number>
3030
Output array for storing factorization results.
3131

32-
strideOut: number
32+
so: number
3333
Stride length for `out`.
3434

35-
offsetOut: number
35+
oo: number
3636
Starting index for `out`.
3737

3838
Returns

lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ import { Collection } from '@stdlib/types/array';
2828
* @param N - length of the sequence
2929
* @param M - number of trial divisors
3030
* @param initial - array of initial trial divisors
31-
* @param strideInitial - stride length for `initial`
32-
* @param offsetInitial - starting index for `initial`
31+
* @param si - stride length for `initial`
32+
* @param oi - starting index for `initial`
3333
* @param out - output array for storing factorization results
34-
* @param strideOut - stride length for `out`
35-
* @param offsetOut - starting index for `out`
34+
* @param so - stride length for `out`
35+
* @param oo - starting index for `out`
3636
* @returns number of factors into which `N` was decomposed
3737
*
3838
* @example
@@ -42,7 +42,7 @@ import { Collection } from '@stdlib/types/array';
4242
* var numFactors = decompose( 12, 4, initial, 1, 0, factors, 1, 0 );
4343
* // returns 2
4444
*/
45-
declare function decompose( N: number, M: number, initial: Collection<number>, strideInitial: number, offsetInitial: number, out: Collection<number>, strideOut: number, offsetOut: number ): number;
45+
declare function decompose( N: number, M: number, initial: Collection<number>, si: number, oi: number, out: Collection<number>, so: number, oo: number ): number;
4646

4747

4848
// EXPORTS //

lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ var floor = require( '@stdlib/math/base/special/floor' );
8080
* @param {NonNegativeInteger} N - length of the sequence
8181
* @param {NonNegativeInteger} M - number of trial divisors
8282
* @param {NonNegativeIntegerArray} initial - strided array of initial trial divisors
83-
* @param {integer} strideInitial - stride length for `initial`
84-
* @param {NonNegativeInteger} offsetInitial - starting index for `initial`
83+
* @param {integer} si - stride length for `initial`
84+
* @param {NonNegativeInteger} oi - starting index for `initial`
8585
* @param {Collection} out - output array for storing factorization results
86-
* @param {integer} strideOut - stride length for `out`
87-
* @param {NonNegativeInteger} offsetOut - starting index for `out`
86+
* @param {integer} so - stride length for `out`
87+
* @param {NonNegativeInteger} oo - starting index for `out`
8888
* @returns {NonNegativeInteger} number of factors into which `N` was decomposed
8989
*
9090
* @example
@@ -109,7 +109,7 @@ var floor = require( '@stdlib/math/base/special/floor' );
109109
* var f = factors.slice();
110110
* // returns [ 8, 2, 2, 4 ]
111111
*/
112-
function decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut, offsetOut ) { // eslint-disable-line max-len
112+
function decompose( N, M, initial, si, oi, out, so, oo ) { // eslint-disable-line max-len
113113
var divisor;
114114
var ntrials;
115115
var nl;
@@ -121,8 +121,8 @@ function decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut,
121121
var j;
122122

123123
if ( N === 0 ) {
124-
out[ offsetOut ] = N;
125-
out[ offsetOut+strideOut ] = 0;
124+
out[ oo ] = N;
125+
out[ oo+so ] = 0;
126126
return 0;
127127
}
128128

@@ -141,7 +141,7 @@ function decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut,
141141
j = 0;
142142
do {
143143
if ( j < ntrials ) {
144-
divisor = initial[ offsetInitial + (j * strideInitial) ];
144+
divisor = initial[ oi + (j * si) ];
145145
} else {
146146
divisor += 2;
147147
}
@@ -164,15 +164,15 @@ function decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut,
164164
nl = nq;
165165

166166
// Store the factor in the output array:
167-
out[ offsetOut+((nf+1)*strideOut) ] = divisor;
167+
out[ oo+((nf+1)*so) ] = divisor;
168168

169169
// When the divisor is `2` and we've already found other factors, shift the other factors right to make room for the most recent `2` factor...
170170
if ( divisor === 2 && nf !== 1 ) {
171171
for ( i = 2; i <= nf; i++ ) {
172172
ib = nf - i + 2;
173-
out[ offsetOut+((ib+1)*strideOut) ] = out[ offsetOut + (ib*strideOut) ]; // eslint-disable-line max-len
173+
out[ oo+((ib+1)*so) ] = out[ oo + (ib*so) ]; // eslint-disable-line max-len
174174
}
175-
out[ offsetOut+(2*strideOut) ] = 2;
175+
out[ oo+(2*so) ] = 2;
176176
}
177177
// If we cannot further divide the sequence length into smaller sub-sequences, we're done...
178178
if ( nl === 1 ) {
@@ -182,10 +182,10 @@ function decompose( N, M, initial, strideInitial, offsetInitial, out, strideOut,
182182
} while ( nl !== 1 );
183183

184184
// Store the sequence length:
185-
out[ offsetOut ] = N;
185+
out[ oo ] = N;
186186

187187
// Store the number of factors:
188-
out[ offsetOut+strideOut ] = nf;
188+
out[ oo+so ] = nf;
189189

190190
// Return the number of factors:
191191
return nf;

lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,19 @@ tape( 'the function returns expected results when provided a sequence length of
109109
});
110110

111111
tape( 'the function correctly handles stride and offset parameters', function test( t ) {
112-
var strideOut = 2;
113-
var offsetOut = 1;
114112
var factors;
113+
var so = 2;
114+
var oo = 1;
115115
var nf;
116116

117117
factors = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
118-
nf = decompose( 12, 4, INITIAL, 1, 0, factors, strideOut, offsetOut );
118+
nf = decompose( 12, 4, INITIAL, 1, 0, factors, so, oo );
119119

120120
t.strictEqual( nf, 2, 'returns expected number of factors' );
121-
t.strictEqual( factors[ offsetOut ], 12, 'stores sequence length at offset' );
122-
t.strictEqual( factors[ offsetOut+strideOut ], 2, 'stores number of factors at offset + stride' );
123-
t.strictEqual( factors[ offsetOut+(2*strideOut) ], 3, 'stores first factor at offset + 2*stride' );
124-
t.strictEqual( factors[ offsetOut+(3*strideOut) ], 4, 'stores second factor at offset + 3*stride' );
121+
t.strictEqual( factors[ oo ], 12, 'stores sequence length at offset' );
122+
t.strictEqual( factors[ oo+so ], 2, 'stores number of factors at offset + stride' );
123+
t.strictEqual( factors[ oo+(2*so) ], 3, 'stores first factor at offset + 2*stride' );
124+
t.strictEqual( factors[ oo+(3*so) ], 4, 'stores second factor at offset + 3*stride' );
125125

126126
t.end();
127127
});

0 commit comments

Comments
 (0)