Skip to content

Commit fb2a747

Browse files
committed
chore: apply requested changes
1 parent 95e9b66 commit fb2a747

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+217
-214
lines changed

lib/node_modules/@stdlib/ndarray/base/where/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ Each provided ndarray should be an object with the following properties:
131131

132132
- `condition` ndarray must be a `boolean` or `uint8` ndarray.
133133
- `condition`, `x`, `y`, and `out` ndarrays must have the same shape.
134-
- The function **mutates** the input ndarrays shapes and strides if necessary.
135134
- For very high-dimensional ndarrays which are non-contiguous, one should consider copying the underlying data to contiguous memory before conditionally assigning elements in order to achieve better performance.
136135

137136
</section>

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.2d_rowmajor_accessors_complex.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
9999
var y;
100100

101101
cbuf = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
102-
xbuf = filledarrayBy( len*2, abtype[ xtype ], discreteUniform( -100, 100 ) );
103-
ybuf = filledarrayBy( len*2, abtype[ ytype ], discreteUniform( -100, 100 ) );
102+
xbuf = filledarrayBy( len*2, abtype[ xtype ], discreteUniform( -100, 100 ) ); // eslint-disable-line max-len
103+
ybuf = filledarrayBy( len*2, abtype[ ytype ], discreteUniform( -100, 100 ) ); // eslint-disable-line max-len
104104
obuf = filledarray( 0.0, len*2, abtype[ otype ] );
105105

106-
// broadcast extra dimension along last axis for the condition array for complex compatibility.
106+
// Broadcast extra dimension along last axis for the condition array for complex compatibility.
107107
stride = shape2strides( shape, order );
108108
cshape = shape.slice();
109109
cshape.push( 1 );

lib/node_modules/@stdlib/ndarray/base/where/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ndarray } from '@stdlib/types/ndarray';
2929
* @param arrays - array-like object containing three input ndarrays and one output ndarray
3030
* @throws arrays must have the same number of dimensions
3131
* @throws arrays must have the same shape
32-
* @throws {Error} condition array must be a boolean or uint8 ndarray
32+
* @throws condition array must be a boolean or uint8 ndarray
3333
*
3434
* @example
3535
* var Float64Array = require( '@stdlib/array/float64' );

lib/node_modules/@stdlib/ndarray/base/where/lib/0d_accessors.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,31 @@
3131
* @param {IntegerArray} condition.strides - stride lengths
3232
* @param {NonNegativeInteger} condition.offset - index offset
3333
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
34+
* @param {Array<Function>} condition.accessors - data buffer accessors
3435
* @param {Object} x - object containing first input ndarray meta data
3536
* @param {*} x.dtype - data type
3637
* @param {Collection} x.data - data buffer
3738
* @param {NonNegativeIntegerArray} x.shape - dimensions
3839
* @param {IntegerArray} x.strides - stride lengths
3940
* @param {NonNegativeInteger} x.offset - index offset
4041
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
42+
* @param {Array<Function>} x.accessors - data buffer accessors
4143
* @param {Object} y - object containing second input ndarray meta data
4244
* @param {*} y.dtype - data type
4345
* @param {Collection} y.data - data buffer
4446
* @param {NonNegativeIntegerArray} y.shape - dimensions
4547
* @param {IntegerArray} y.strides - stride lengths
4648
* @param {NonNegativeInteger} y.offset - index offset
4749
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
50+
* @param {Array<Function>} y.accessors - data buffer accessors
4851
* @param {Object} out - object containing output ndarray meta data
4952
* @param {*} out.dtype - data type
5053
* @param {Collection} out.data - data buffer
5154
* @param {NonNegativeIntegerArray} out.shape - dimensions
5255
* @param {IntegerArray} out.strides - stride lengths
5356
* @param {NonNegativeInteger} out.offset - index offset
5457
* @param {string} out.order - specifies whether `out` is row-major (C-style) or column-major (Fortran-style)
58+
* @param {Array<Function>} out.accessors - data buffer accessors
5559
* @returns {void}
5660
*
5761
* @example

lib/node_modules/@stdlib/ndarray/base/where/lib/10d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
* @param {IntegerArray} condition.strides - stride lengths
3434
* @param {NonNegativeInteger} condition.offset - index offset
3535
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
36-
* @param {Object} x - object containing input ndarray meta data
36+
* @param {Object} x - object containing first input ndarray meta data
3737
* @param {*} x.dtype - data type
3838
* @param {Collection} x.data - data buffer
3939
* @param {NonNegativeIntegerArray} x.shape - dimensions
4040
* @param {IntegerArray} x.strides - stride lengths
4141
* @param {NonNegativeInteger} x.offset - index offset
4242
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
43-
* @param {Object} y - object containing input ndarray meta data
43+
* @param {Object} y - object containing second input ndarray meta data
4444
* @param {*} y.dtype - data type
4545
* @param {Collection} y.data - data buffer
4646
* @param {NonNegativeIntegerArray} y.shape - dimensions
@@ -122,7 +122,7 @@
122122
* console.log( out.data );
123123
* // => <Float64Array>[ -2.0, -3.0, 6.0, 7.0, -10.0, -11.0 ]
124124
*/
125-
function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line max-statements
125+
function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line max-statements, max-lines-per-function
126126
var cbuf;
127127
var xbuf;
128128
var ybuf;
@@ -333,7 +333,7 @@ function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line m
333333
for ( i2 = 0; i2 < S2; i2++ ) {
334334
for ( i1 = 0; i1 < S1; i1++ ) {
335335
for ( i0 = 0; i0 < S0; i0++ ) {
336-
obuf[ io ] = ( cbuf[ ic ] ) ? xbuf[ ix ] : ybuf[ iy ];
336+
obuf[ io ] = ( cbuf[ ic ] ) ? xbuf[ ix ] : ybuf[ iy ]; // eslint-disable-line max-len
337337
ic += dc0;
338338
ix += dx0;
339339
iy += dy0;

lib/node_modules/@stdlib/ndarray/base/where/lib/10d_accessors.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
* @param {NonNegativeInteger} condition.offset - index offset
3535
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
3636
* @param {Array<Function>} condition.accessors - data buffer accessors
37-
* @param {Object} x - object containing input ndarray meta data
37+
* @param {Object} x - object containing first input ndarray meta data
3838
* @param {*} x.dtype - data type
3939
* @param {Collection} x.data - data buffer
4040
* @param {NonNegativeIntegerArray} x.shape - dimensions
4141
* @param {IntegerArray} x.strides - stride lengths
4242
* @param {NonNegativeInteger} x.offset - index offset
4343
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
4444
* @param {Array<Function>} x.accessors - data buffer accessors
45-
* @param {Object} y - object containing input ndarray meta data
45+
* @param {Object} y - object containing second input ndarray meta data
4646
* @param {*} y.dtype - data type
4747
* @param {Collection} y.data - data buffer
4848
* @param {NonNegativeIntegerArray} y.shape - dimensions
@@ -147,7 +147,7 @@
147147
* var im = imagf( v );
148148
* // returns 2.0
149149
*/
150-
function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line max-statements
150+
function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line max-statements, max-lines-per-function
151151
var cbuf;
152152
var xbuf;
153153
var ybuf;
@@ -368,7 +368,7 @@ function where10d( condition, x, y, out, isRowMajor ) { // eslint-disable-line m
368368
for ( i2 = 0; i2 < S2; i2++ ) {
369369
for ( i1 = 0; i1 < S1; i1++ ) {
370370
for ( i0 = 0; i0 < S0; i0++ ) {
371-
seto( obuf, io, ( getc( cbuf, ic ) ) ? getx( xbuf, ix ) : gety( ybuf, iy ) );
371+
seto( obuf, io, ( getc( cbuf, ic ) ) ? getx( xbuf, ix ) : gety( ybuf, iy ) ); // eslint-disable-line max-len
372372
ic += dc0;
373373
ix += dx0;
374374
iy += dy0;

lib/node_modules/@stdlib/ndarray/base/where/lib/10d_blocked.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable max-depth, max-len */
19+
/* eslint-disable max-depth, max-len, max-lines */
2020

2121
'use strict';
2222

@@ -39,14 +39,14 @@ var blockSize = require( '@stdlib/ndarray/base/ternary-tiling-block-size' );
3939
* @param {IntegerArray} condition.strides - stride lengths
4040
* @param {NonNegativeInteger} condition.offset - index offset
4141
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
42-
* @param {Object} x - object containing input ndarray meta data
42+
* @param {Object} x - object containing first input ndarray meta data
4343
* @param {*} x.dtype - data type
4444
* @param {Collection} x.data - data buffer
4545
* @param {NonNegativeIntegerArray} x.shape - dimensions
4646
* @param {IntegerArray} x.strides - stride lengths
4747
* @param {NonNegativeInteger} x.offset - index offset
4848
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
49-
* @param {Object} y - object containing input ndarray meta data
49+
* @param {Object} y - object containing second input ndarray meta data
5050
* @param {*} y.dtype - data type
5151
* @param {Collection} y.data - data buffer
5252
* @param {NonNegativeIntegerArray} y.shape - dimensions
@@ -60,7 +60,6 @@ var blockSize = require( '@stdlib/ndarray/base/ternary-tiling-block-size' );
6060
* @param {IntegerArray} out.strides - stride lengths
6161
* @param {NonNegativeInteger} out.offset - index offset
6262
* @param {string} out.order - specifies whether `out` is row-major (C-style) or column-major (Fortran-style)
63-
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
6463
* @returns {void}
6564
*
6665
* @example

lib/node_modules/@stdlib/ndarray/base/where/lib/10d_blocked_accessors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable max-depth, max-len */
19+
/* eslint-disable max-depth, max-len, max-lines */
2020

2121
'use strict';
2222

@@ -40,15 +40,15 @@ var blockSize = require( '@stdlib/ndarray/base/ternary-tiling-block-size' );
4040
* @param {NonNegativeInteger} condition.offset - index offset
4141
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
4242
* @param {Array<Function>} condition.accessors - data buffer accessors
43-
* @param {Object} x - object containing input ndarray meta data
43+
* @param {Object} x - object containing first input ndarray meta data
4444
* @param {*} x.dtype - data type
4545
* @param {Collection} x.data - data buffer
4646
* @param {NonNegativeIntegerArray} x.shape - dimensions
4747
* @param {IntegerArray} x.strides - stride lengths
4848
* @param {NonNegativeInteger} x.offset - index offset
4949
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
5050
* @param {Array<Function>} x.accessors - data buffer accessors
51-
* @param {Object} y - object containing input ndarray meta data
51+
* @param {Object} y - object containing second input ndarray meta data
5252
* @param {*} y.dtype - data type
5353
* @param {Collection} y.data - data buffer
5454
* @param {NonNegativeIntegerArray} y.shape - dimensions

lib/node_modules/@stdlib/ndarray/base/where/lib/1d.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
* @param {IntegerArray} condition.strides - stride lengths
3232
* @param {NonNegativeInteger} condition.offset - index offset
3333
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
34-
* @param {Object} x - object containing input ndarray meta data
34+
* @param {Object} x - object containing first input ndarray meta data
3535
* @param {*} x.dtype - data type
3636
* @param {Collection} x.data - data buffer
3737
* @param {NonNegativeIntegerArray} x.shape - dimensions
3838
* @param {IntegerArray} x.strides - stride lengths
3939
* @param {NonNegativeInteger} x.offset - index offset
4040
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
41-
* @param {Object} y - object containing input ndarray meta data
41+
* @param {Object} y - object containing second input ndarray meta data
4242
* @param {*} y.dtype - data type
4343
* @param {Collection} y.data - data buffer
4444
* @param {NonNegativeIntegerArray} y.shape - dimensions
@@ -61,7 +61,7 @@
6161
* // Create data buffers:
6262
* var cbuf = new Uint8Array( [ 1, 0, 1, 0 ] );
6363
* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
64-
* var ybuf = new Float64Array( [-1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0] );
64+
* var ybuf = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0 ] );
6565
* var obuf = new Float64Array( 4 );
6666
*
6767
* // Define the shape of the input and output arrays:
@@ -124,25 +124,23 @@ function where1d( condition, x, y, out ) {
124124
var xbuf;
125125
var ybuf;
126126
var obuf;
127-
var dc0;
128-
var dx0;
129-
var dy0;
130-
var do0;
131-
var S0;
127+
var dout;
128+
var dc;
129+
var dx;
130+
var dy;
132131
var ic;
133132
var ix;
134133
var iy;
135134
var io;
136-
var i0;
137-
138-
// Note on variable naming convention: S#, dc#, dx#, dy#, do#, i# where # corresponds to the loop number, with `0` being the innermost loop...
135+
var S;
136+
var i;
139137

140138
// Extract loop variables: dimensions and loop offset (pointer) increments...
141-
S0 = x.shape[ 0 ];
142-
dc0 = condition.strides[ 0 ];
143-
dx0 = x.strides[ 0 ];
144-
dy0 = y.strides[ 0 ];
145-
do0 = out.strides[ 0 ];
139+
S = x.shape[ 0 ];
140+
dc = condition.strides[ 0 ];
141+
dx = x.strides[ 0 ];
142+
dy = y.strides[ 0 ];
143+
dout = out.strides[ 0 ];
146144

147145
// Set the pointers to the first indexed elements in the respective ndarrays...
148146
ic = condition.offset;
@@ -157,12 +155,12 @@ function where1d( condition, x, y, out ) {
157155
obuf = out.data;
158156

159157
// Iterate over the ndarray dimensions...
160-
for ( i0 = 0; i0 < S0; i0++ ) {
158+
for ( i = 0; i < S; i++ ) {
161159
obuf[ io ] = ( cbuf[ ic ] ) ? xbuf[ ix ] : ybuf[ iy ];
162-
ic += dc0;
163-
ix += dx0;
164-
iy += dy0;
165-
io += do0;
160+
ic += dc;
161+
ix += dx;
162+
iy += dy;
163+
io += dout;
166164
}
167165
}
168166

lib/node_modules/@stdlib/ndarray/base/where/lib/1d_accessors.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,31 @@
3131
* @param {IntegerArray} condition.strides - stride lengths
3232
* @param {NonNegativeInteger} condition.offset - index offset
3333
* @param {string} condition.order - specifies whether `condition` is row-major (C-style) or column-major (Fortran-style)
34-
* @param {Object} x - object containing input ndarray meta data
34+
* @param {Array<Function>} condition.accessors - data buffer accessors
35+
* @param {Object} x - object containing first input ndarray meta data
3536
* @param {*} x.dtype - data type
3637
* @param {Collection} x.data - data buffer
3738
* @param {NonNegativeIntegerArray} x.shape - dimensions
3839
* @param {IntegerArray} x.strides - stride lengths
3940
* @param {NonNegativeInteger} x.offset - index offset
4041
* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
41-
* @param {Object} y - object containing input ndarray meta data
42+
* @param {Array<Function>} x.accessors - data buffer accessors
43+
* @param {Object} y - object containing second input ndarray meta data
4244
* @param {*} y.dtype - data type
4345
* @param {Collection} y.data - data buffer
4446
* @param {NonNegativeIntegerArray} y.shape - dimensions
4547
* @param {IntegerArray} y.strides - stride lengths
4648
* @param {NonNegativeInteger} y.offset - index offset
4749
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
50+
* @param {Array<Function>} y.accessors - data buffer accessors
4851
* @param {Object} out - object containing output ndarray meta data
4952
* @param {*} out.dtype - data type
5053
* @param {Collection} out.data - data buffer
5154
* @param {NonNegativeIntegerArray} out.shape - dimensions
5255
* @param {IntegerArray} out.strides - stride lengths
5356
* @param {NonNegativeInteger} out.offset - index offset
5457
* @param {string} out.order - specifies whether `out` is row-major (C-style) or column-major (Fortran-style)
58+
* @param {Array<Function>} out.accessors - data buffer accessors
5559
* @returns {void}
5660
*
5761
* @example
@@ -148,25 +152,23 @@ function where1d( condition, x, y, out ) {
148152
var getx;
149153
var gety;
150154
var seto;
151-
var dc0;
152-
var dx0;
153-
var dy0;
154-
var do0;
155-
var S0;
155+
var dout;
156+
var dc;
157+
var dx;
158+
var dy;
156159
var ic;
157160
var ix;
158161
var iy;
159162
var io;
160-
var i0;
161-
162-
// Note on variable naming convention: S#, dc#, dx#, dy#, do#, i# where # corresponds to the loop number, with `0` being the innermost loop...
163+
var i;
164+
var S;
163165

164166
// Extract loop variables: dimensions and loop offset (pointer) increments...
165-
S0 = x.shape[ 0 ];
166-
dc0 = condition.strides[ 0 ];
167-
dx0 = x.strides[ 0 ];
168-
dy0 = y.strides[ 0 ];
169-
do0 = out.strides[ 0 ];
167+
S = x.shape[ 0 ];
168+
dc = condition.strides[ 0 ];
169+
dx = x.strides[ 0 ];
170+
dy = y.strides[ 0 ];
171+
dout = out.strides[ 0 ];
170172

171173
// Set the pointers to the first indexed elements in the respective ndarrays...
172174
ic = condition.offset;
@@ -180,19 +182,19 @@ function where1d( condition, x, y, out ) {
180182
ybuf = y.data;
181183
obuf = out.data;
182184

183-
// Cache accessors
185+
// Cache accessors:
184186
getc = condition.accessors[ 0 ];
185187
getx = x.accessors[ 0 ];
186188
gety = y.accessors[ 0 ];
187189
seto = out.accessors[ 1 ];
188190

189191
// Iterate over the ndarray dimensions...
190-
for ( i0 = 0; i0 < S0; i0++ ) {
192+
for ( i = 0; i < S; i++ ) {
191193
seto( obuf, io, ( getc( cbuf, ic ) ) ? getx( xbuf, ix ) : gety( ybuf, iy ) ); // eslint-disable-line max-len
192-
ic += dc0;
193-
ix += dx0;
194-
iy += dy0;
195-
io += do0;
194+
ic += dc;
195+
ix += dx;
196+
iy += dy;
197+
io += dout;
196198
}
197199
}
198200

0 commit comments

Comments
 (0)