Skip to content

Commit 016d540

Browse files
committed
Auto-generated commit
1 parent 8f5e6bb commit 016d540

22 files changed

+82
-151
lines changed

CHANGELOG.md

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

3737
<details>
3838

39+
- [`1d2c4e2`](https://github.com/stdlib-js/stdlib/commit/1d2c4e2ef621e2304c5d855c4c8b6ed2f9e9e1ad) - **refactor:** avoid duplicate computation _(by Athan Reines)_
3940
- [`92bf1a1`](https://github.com/stdlib-js/stdlib/commit/92bf1a12b2398ec5823eb3094bdc89f88d9876a7) - **fix:** use resolved order when computing loop variables _(by Athan Reines)_
4041
- [`3dd8cb3`](https://github.com/stdlib-js/stdlib/commit/3dd8cb379ea22c4a92d610d146cdd662d3187e27) - **chore:** minor clean-up _(by Philipp Burckhardt)_
4142
- [`1473377`](https://github.com/stdlib-js/stdlib/commit/1473377ac4faecd7ff1448fb7972d851c3e8b2a8) - **fix:** use computed order _(by Athan Reines)_

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 {Callback} fcn - unary callback
4945
* @returns {void}
5046
*
@@ -89,12 +85,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
8985
* };
9086
*
9187
* // Apply the unary function:
92-
* unary10d( x, y, scale );
88+
* unary10d( x, y, true, scale );
9389
*
9490
* console.log( y.data );
9591
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
9692
*/
97-
function unary10d( x, y, fcn ) { // eslint-disable-line max-statements
93+
function unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements
9894
var xbuf;
9995
var ybuf;
10096
var dx0;
@@ -149,7 +145,7 @@ function unary10d( x, y, fcn ) { // eslint-disable-line max-statements
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[ 9 ];
155151
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 {Callback} fcn - unary callback
5147
* @returns {void}
5248
*
@@ -105,7 +101,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
105101
* };
106102
*
107103
* // Apply the unary function:
108-
* unary10d( x, y, scale );
104+
* unary10d( x, y, true, scale );
109105
*
110106
* var v = y.data.get( 0 );
111107
*
@@ -115,7 +111,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
115111
* var im = imagf( v );
116112
* // returns 20.0
117113
*/
118-
function unary10d( x, y, fcn ) { // eslint-disable-line max-statements
114+
function unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements
119115
var xbuf;
120116
var ybuf;
121117
var get;
@@ -172,7 +168,7 @@ function unary10d( x, y, fcn ) { // eslint-disable-line max-statements
172168
sh = x.shape;
173169
sx = x.strides;
174170
sy = y.strides;
175-
if ( strides2order( sx ) === 1 ) {
171+
if ( isRowMajor ) {
176172
// For row-major ndarrays, the last dimensions have the fastest changing indices...
177173
S0 = sh[ 9 ];
178174
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 {Callback} fcn - unary callback
4743
* @returns {void}
4844
*
@@ -87,12 +83,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
8783
* };
8884
*
8985
* // Apply the unary function:
90-
* unary2d( x, y, scale );
86+
* unary2d( x, y, true, scale );
9187
*
9288
* console.log( y.data );
9389
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0 ]
9490
*/
95-
function unary2d( x, y, fcn ) {
91+
function unary2d( x, y, isRowMajor, fcn ) {
9692
var xbuf;
9793
var ybuf;
9894
var dx0;
@@ -115,7 +111,7 @@ function unary2d( x, y, fcn ) {
115111
sh = x.shape;
116112
sx = x.strides;
117113
sy = y.strides;
118-
if ( strides2order( sx ) === 1 ) {
114+
if ( isRowMajor ) {
119115
// For row-major ndarrays, the last dimensions have the fastest changing indices...
120116
S0 = sh[ 1 ];
121117
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 {Callback} fcn - unary callback
4945
* @returns {void}
5046
*
@@ -103,7 +99,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
10399
* };
104100
*
105101
* // Apply the unary function:
106-
* unary2d( x, y, scale );
102+
* unary2d( x, y, true, scale );
107103
*
108104
* var v = y.data.get( 0 );
109105
*
@@ -113,7 +109,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
113109
* var im = imagf( v );
114110
* // returns 20.0
115111
*/
116-
function unary2d( x, y, fcn ) {
112+
function unary2d( x, y, isRowMajor, fcn ) {
117113
var xbuf;
118114
var ybuf;
119115
var get;
@@ -138,7 +134,7 @@ function unary2d( x, y, fcn ) {
138134
sh = x.shape;
139135
sx = x.strides;
140136
sy = y.strides;
141-
if ( strides2order( sx ) === 1 ) {
137+
if ( isRowMajor ) {
142138
// For row-major ndarrays, the last dimensions have the fastest changing indices...
143139
S0 = sh[ 1 ];
144140
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 {Callback} fcn - unary callback
4743
* @returns {void}
4844
*
@@ -87,12 +83,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
8783
* };
8884
*
8985
* // Apply the unary function:
90-
* unary3d( x, y, scale );
86+
* unary3d( x, y, true, scale );
9187
*
9288
* console.log( y.data );
9389
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
9490
*/
95-
function unary3d( x, y, fcn ) {
91+
function unary3d( x, y, isRowMajor, fcn ) {
9692
var xbuf;
9793
var ybuf;
9894
var dx0;
@@ -119,7 +115,7 @@ function unary3d( x, y, fcn ) {
119115
sh = x.shape;
120116
sx = x.strides;
121117
sy = y.strides;
122-
if ( strides2order( sx ) === 1 ) {
118+
if ( isRowMajor ) {
123119
// For row-major ndarrays, the last dimensions have the fastest changing indices...
124120
S0 = sh[ 2 ];
125121
S1 = sh[ 1 ];

lib/3d_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 {Callback} fcn - unary callback
4945
* @returns {void}
5046
*
@@ -103,7 +99,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
10399
* };
104100
*
105101
* // Apply the unary function:
106-
* unary3d( x, y, scale );
102+
* unary3d( x, y, true, scale );
107103
*
108104
* var v = y.data.get( 0 );
109105
*
@@ -113,7 +109,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
113109
* var im = imagf( v );
114110
* // returns 20.0
115111
*/
116-
function unary3d( x, y, fcn ) {
112+
function unary3d( x, y, isRowMajor, fcn ) {
117113
var xbuf;
118114
var ybuf;
119115
var get;
@@ -142,7 +138,7 @@ function unary3d( x, y, fcn ) {
142138
sh = x.shape;
143139
sx = x.strides;
144140
sy = y.strides;
145-
if ( strides2order( sx ) === 1 ) {
141+
if ( isRowMajor ) {
146142
// For row-major ndarrays, the last dimensions have the fastest changing indices...
147143
S0 = sh[ 2 ];
148144
S1 = sh[ 1 ];

lib/4d.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 {Callback} fcn - unary callback
4743
* @returns {void}
4844
*
@@ -87,12 +83,12 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
8783
* };
8884
*
8985
* // Apply the unary function:
90-
* unary4d( x, y, scale );
86+
* unary4d( x, y, true, scale );
9187
*
9288
* console.log( y.data );
9389
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
9490
*/
95-
function unary4d( x, y, fcn ) {
91+
function unary4d( x, y, isRowMajor, fcn ) {
9692
var xbuf;
9793
var ybuf;
9894
var dx0;
@@ -123,7 +119,7 @@ function unary4d( x, y, fcn ) {
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[ 3 ];
129125
S1 = sh[ 2 ];

lib/4d_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 {Callback} fcn - unary callback
4945
* @returns {void}
5046
*
@@ -103,7 +99,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
10399
* };
104100
*
105101
* // Apply the unary function:
106-
* unary4d( x, y, scale );
102+
* unary4d( x, y, true, scale );
107103
*
108104
* var v = y.data.get( 0 );
109105
*
@@ -113,7 +109,7 @@ var strides2order = require( '@stdlib/ndarray-base-strides2order' );
113109
* var im = imagf( v );
114110
* // returns 20.0
115111
*/
116-
function unary4d( x, y, fcn ) {
112+
function unary4d( x, y, isRowMajor, fcn ) {
117113
var xbuf;
118114
var ybuf;
119115
var get;
@@ -146,7 +142,7 @@ function unary4d( x, y, fcn ) {
146142
sh = x.shape;
147143
sx = x.strides;
148144
sy = y.strides;
149-
if ( strides2order( sx ) === 1 ) {
145+
if ( isRowMajor ) {
150146
// For row-major ndarrays, the last dimensions have the fastest changing indices...
151147
S0 = sh[ 3 ];
152148
S1 = sh[ 2 ];

0 commit comments

Comments
 (0)