8000 Auto-generated commit · stdlib-js/ndarray-base-unary-by@a455334 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit a455334

Browse files
committed
Auto-generated commit
1 parent 582adaf commit a455334

22 files changed

+82
-151
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
<details>
2626

27+
- [`a616f66`](https://github.com/stdlib-js/stdlib/commit/a616f66172ea9e5ea730258daff8232f38675e39) - **refactor:** avoid duplicate computation _(by Athan Reines)_
2728
- [`b9e9eca`](https://github.com/stdlib-js/stdlib/commit/b9e9eca93c4611a77122090ab8e589e6ba82e47b) - **fix:** use resolved order when computing loop variables _(by Athan Reines)_
2829
- [`23f47b4`](https://github.com/stdlib-js/stdlib/commit/23f47b4ef44cb8bbdc7009c403630d003af9c0a2) - **fix:** use computed order _(by Athan Reines)_
2930
- [`845e64a`](https://github.com/stdlib-js/stdlib/commit/845e64a2f7e12bd60729097230774569b2d4954e) - **refactor:** update paths _(by Gururaj Gurram)_

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/10d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -45,6 +40,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4540
* @param {IntegerArray} y.strides - stride lengths
4641
* @param {NonNegativeInteger} y.offset - index offset
4742
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4844
* @param {Function} fcn - unary function to apply to callback return values
4945
* @param {Callback} clbk - callback
5046
* @param {*} [thisArg] - callback execution context
@@ -95,12 +91,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
9591
* };
9692
*
9793
* // Apply the unary function:
98-
* unary10d( x, y, scale, accessor );
94+
* unary10d( x, y, true, scale, accessor );
9995
*
10096
* console.log( y.data );
10197
* // => <Float64Array>[ 40.0, 60.0, 120.0, 140.0, 200.0, 220.0 ]
10298
*/
103-
function unary10d( x, y, fcn, clbk, thisArg ) { // eslint-disable-line max-statements
99+
function unary10d( x, y, isRowMajor, fcn, clbk, thisArg ) { // eslint-disable-line max-statements
104100
var xbuf;
105101
var ybuf;
106102
var dx0;
@@ -157,7 +153,7 @@ function unary10d( x, y, fcn, clbk, thisArg ) { // eslint-disable-line max-state
157153
sh = x.shape;
158154
sx = x.strides;
159155
sy = y.strides;
160-
if ( strides2order( sx ) === 1 ) {
156+
if ( isRowMajor ) {
161157
// For row-major ndarrays, the last dimensions have the fastest changing indices...
162158
S0 = sh[ 9 ];
163159
S1 = sh[ 8 ];

lib/10d_accessors.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -47,6 +42,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4742
* @param {NonNegativeInteger} y.offset - index offset
4843
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
4944
* @param {Array<Function>} y.accessors - data buffer accessors
45+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5046
* @param {Function} fcn - unary function to apply to callback return values
5147
* @param {Callback} clbk - callback
5248
* @param {*} [thisArg] - callback execution context
@@ -108,7 +104,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
108104
* };
109105
*
110106
* // Apply the unary function:
111-
* unary10d( x, y, scale, cidentityf );
107+
* unary10d( x, y, true, scale, cidentityf );
112108
*
113109
* var v = y.data.get( 0 );
114110
*
@@ -118,7 +114,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
118114
* var im = imagf( v );
119115
* // returns 20.0
120116
*/
121-
function unary10d( x, y, fcn, clbk, thisArg ) { // eslint-disable-line max-statements
117+
function unary10d( x, y, isRowMajor, fcn, clbk, thisArg ) { // eslint-disable-line max-statements
122118
var xbuf;
123119
var ybuf;
124120
var get;
@@ -177,7 +173,7 @@ function unary10d( x, y, fcn, clbk, thisArg ) { // eslint-disable-line max-state
177173
sh = x.shape;
178174
sx = x.strides;
179175
sy = y.strides;
180-
if ( strides2order( sx ) === 1 ) {
176+
if ( isRowMajor ) {
181177
// For row-major ndarrays, the last dimensions have the fastest changing indices...
182178
S0 = sh[ 9 ];
183179
S1 = sh[ 8 ];

lib/2d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -43,6 +38,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4338
* @param {IntegerArray} y.strides - stride lengths
4439
* @param {NonNegativeInteger} y.offset - index offset
4540
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4642
* @param {Function} fcn - unary function to apply to callback return values
4743
* @param {Callback} clbk - callback
4844
* @param {*} [thisArg] - callback execution context
@@ -93,12 +89,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
9389
* };
9490
*
9591
* // Apply the unary function:
96-
* unary2d( x, y, scale, accessor );
92+
* unary2d( x, y, true, scale, accessor );
9793
*
9894
* console.log( y.data );
9995
* // => <Float64Array>[ 40.0, 60.0, 120.0, 140.0 ]
10096
*/
101-
function unary2d( x, y, fcn, clbk, thisArg ) {
97+
function unary2d( x, y, isRowMajor, fcn, clbk, thisArg ) {
10298
var xbuf;
10399
var ybuf;
104100
var dx0;
@@ -123,7 +119,7 @@ function unary2d( x, y, fcn, clbk, thisArg ) {
123119
sh = x.shape;
124120
sx = x.strides;
125121
sy = y.strides;
126-
if ( strides2order( sx ) === 1 ) {
122+
if ( isRowMajor ) {
127123
// For row-major ndarrays, the last dimensions have the fastest changing indices...
128124
S0 = sh[ 1 ];
129125
S1 = sh[ 0 ];

lib/2d_accessors.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -45,6 +40,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4540
* @param {NonNegativeInteger} y.offset - index offset
4641
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
4742
* @param {Array<Function>} y.accessors - data buffer accessors
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4844
* @param {Function} fcn - unary function to apply to callback return values
4945
* @param {Callback} clbk - callback
5046
* @param {*} [thisArg] - callback execution context
@@ -106,7 +102,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
106102
* };
107103
*
108104
* // Apply the unary function:
109-
* unary2d( x, y, scale, cidentityf );
105+
* unary2d( x, y, true, scale, cidentityf );
110106
*
111107
* var v = y.data.get( 0 );
112108
*
@@ -116,7 +112,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
116112
* var im = imagf( v );
117113
* // returns 20.0
118114
*/
119-
function unary2d( x, y, fcn, clbk, thisArg ) {
115+
function unary2d( x, y, isRowMajor, fcn, clbk, thisArg ) {
120116
var xbuf;
121117
var ybuf;
122118
var get;
@@ -143,7 +139,7 @@ function unary2d( x, y, fcn, clbk, thisArg ) {
143139
sh = x.shape;
144140
sx = x.strides;
145141
sy = y.strides;
146-
if ( strides2order( sx ) === 1 ) {
142+
if ( isRowMajor ) {
147143
// For row-major ndarrays, the last dimensions have the fastest changing indices...
148144
S0 = sh[ 1 ];
149145
S1 = sh[ 0 ];

lib/3d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -43,6 +38,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4338
* @param {IntegerArray} y.strides - stride lengths
4439
* @param {NonNegativeInteger} y.offset - index offset
4540
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4642
* @param {Function} fcn - unary function to apply to callback return values
4743
* @param {Callback} clbk - callback
4844
* @param {*} [thisArg] - callback execution context
@@ -93,12 +89,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
9389
* };
9490
*
9591
* // Apply the unary function:
96-
* unary3d( x, y, scale, accessor );
92+
* unary3d( x, y, true, scale, accessor );
9793
*
9894
* console.log( y.data );
9995
* // => <Float64Array>[ 40.0, 60.0, 120.0, 140.0, 200.0, 220.0 ]
10096
*/
101-
function unary3d( x, y, fcn, clbk, thisArg ) {
97+
function unary3d( x, y, isRowMajor, fcn, clbk, thisArg ) {
10298
var xbuf;
10399
var ybuf;
104100
var dx0;
@@ -127,7 +123,7 @@ function unary3d( x, y, fcn, clbk, thisArg ) {
127123
sh = x.shape;
128124
sx = x.strides;
129125
sy = y.strides;
130-
if ( strides2order( sx ) === 1 ) {
126+
if ( isRowMajor ) {
131127
// For row-major ndarrays, the last dimensions have the fastest changing indices...
132128
S0 = sh[ 2 ];
133129
S1 = sh[ 1 ];

lib/3d_accessors.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -47,6 +42,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4742
* @param {NonNegativeInteger} y.offset - index offset
4843
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
4944
* @param {Array<Function>} y.accessors - data buffer accessors
45+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5046
* @param {Function} fcn - unary function to apply to callback return values
5147
* @param {Callback} clbk - callback
5248
* @param {*} [thisArg] - callback execution context
@@ -108,7 +104,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
108104
* };
109105
*
110106
* // Apply the unary function:
111-
* unary3d( x, y, scale, cidentityf );
107+
* unary3d( x, y, true, scale, cidentityf );
112108
*
113109
* var v = y.data.get( 0 );
114110
*
@@ -118,7 +114,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
118114
* var im = imagf( v );
119115
* // returns 20.0
120116
*/
121-
function unary3d( x, y, fcn, clbk, thisArg ) {
117+
function unary3d( x, y, isRowMajor, fcn, clbk, thisArg ) {
122118
var xbuf;
123119
var ybuf;
124120
var get;
@@ -149,7 +145,7 @@ function unary3d( x, y, fcn, clbk, thisArg ) {
149145
sh = x.shape;
150146
sx = x.strides;
151147
sy = y.strides;
152-
if ( strides2order( sx ) === 1 ) {
148+
if ( isRowMajor ) {
153149
// For row-major ndarrays, the last dimensions have the fastest changing indices...
154150
S0 = sh[ 2 ];
155151
S1 = sh[ 1 ];

lib/4d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
/* eslint-disable max-len */
2222

23-
// MODULES //
24-
25-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -45,6 +40,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4540
* @param {IntegerArray} y.strides - stride lengths
4641
* @param {NonNegativeInteger} y.offset - index offset
4742
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4844
* @param {Function} fcn - unary function to apply to callback return values
4945
* @param {Callback} clbk - callback
5046
* @param {*} [thisArg] - callback execution context
@@ -95,12 +91,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
9591
* };
9692
*
9793
* // Apply the unary function:
98-
* unary4d( x, y, scale, accessor );
94+
* unary4d( x, y, true, scale, accessor );
9995
*
10096
* console.log( y.data );
10197
* // => <Float64Array>[ 40.0, 60.0, 120.0, 140.0, 200.0, 220.0 ]
10298
*/
103-
function unary4d( x, y, fcn, clbk, thisArg ) {
99+
function unary4d( x, y, isRowMajor, fcn, clbk, thisArg ) {
104100
var xbuf;
105101
var ybuf;
106102
var dx0;
@@ -133,7 +129,7 @@ function unary4d( x, y, fcn, clbk, thisArg ) {
133129
sh = x.shape;
134130
sx = x.strides;
135131
sy = y.strides;
136-
if ( strides2order( sx ) === 1 ) {
132+
if ( isRowMajor ) {
137133
// For row-major ndarrays, the last dimensions have the fastest changing indices...
138134
S0 = sh[ 3 ];
139135
S1 = sh[ 2 ];

lib/4d_accessors.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var strides2order = require( '@stdlib/ndarray-base-strides2order' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -47,6 +42,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
4742
* @param {NonNegativeInteger} y.offset - index offset
4843
* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)
4944
* @param {Array<Function>} y.accessors - data buffer accessors
45+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5046
* @param {Function} fcn - unary function to apply to callback return values
5147
* @param {Callback} clbk - callback
5248
* @param {*} [thisArg] - callback execution context
@@ -108,7 +104,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
108104
* };
109105
*
110106
* // Apply the unary function:
111-
* unary4d( x, y, scale, cidentityf );
107+
* unary4d( x, y, true, scale, cidentityf );
112108
*
113109
* var v = y.data.get( 0 );
114110
*
@@ -118,7 +114,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
118114
* var im = imagf( v );
119115
* // returns 20.0
120116
*/
121-
function unary4d( x, y, fcn, clbk, thisArg ) {
117+
function unary4d( x, y, isRowMajor, fcn, clbk, thisArg ) {
122118
var xbuf;
123119
var ybuf;
124120
var get;
@@ -153,7 +149,7 @@ function unary4d( x, y, fcn, clbk, thisArg ) {
153149
sh = x.shape;
154150
sx = x.strides;
155151
sy = y.strides;
156-
if ( strides2order( sx ) === 1 ) {
152+
if ( isRowMajor ) {
157153
// For row-major ndarrays, the last dimensions have the fastest changing indices...
158154
S0 = sh[ 3 ];
159155
S1 = sh[ 2 ];

0 commit comments

Comments
 (0)
0