Skip to content

Commit 027e140

Browse files
committed
Auto-generated commit
1 parent eb2c535 commit 027e140

File tree

9 files changed

+41
-11
lines changed

9 files changed

+41
-11
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ A total of 15 issues were closed in this release:
369369

370370
<details>
371371

372+
- [`ccb3f8e`](https://github.com/stdlib-js/stdlib/commit/ccb3f8e33a29e6a09074d8bc7e54f0a6fa88a022) - **refactor:** use base assertion utility _(by Athan Reines)_
373+
- [`53de942`](https://github.com/stdlib-js/stdlib/commit/53de94256d47d502f47da4af97c0dfeb6ceb086e) - **refactor:** use base assertion utility _(by Athan Reines)_
374+
- [`b1ed7bc`](https://github.com/stdlib-js/stdlib/commit/b1ed7bc33de9d21119087820e0002a8803d97203) - **refactor:** use base assertion utility _(by Athan Reines)_
375+
- [`7321e29`](https://github.com/stdlib-js/stdlib/commit/7321e294d995d496b35f24f253055190ae6a78d5) - **refactor:** use base assertion utility _(by Athan Reines)_
376+
- [`ed2d89f`](https://github.com/stdlib-js/stdlib/commit/ed2d89f2c0c0950bfb6fad6375296173a7aee0b9) - **refactor:** use base assertion utility _(by Athan Reines)_
377+
- [`f84a4f9`](https://github.com/stdlib-js/stdlib/commit/f84a4f981f22b7ac35f917941264e792f4ba854b) - **refactor:** use base assertion utility _(by Athan Reines)_
372378
- [`92b9956`](https://github.com/stdlib-js/stdlib/commit/92b99565374d44d5456a36871bd19a957e33a986) - **chore:** fix EditorConfig lint errors [(#6939)](https://github.com/stdlib-js/stdlib/pull/6939) _(by zhanggy)_
373379
- [`3d355ab`](https://github.com/stdlib-js/stdlib/commit/3d355ab124de9c965171d08aebc8d14156fb9711) - **chore:** fix meta data _(by Athan Reines)_
374380
- [`79338a4`](https://github.com/stdlib-js/stdlib/commit/79338a45542acc87c31fb6ad7220b8ecab4c467d) - **chore:** update meta data _(by Athan Reines)_

array/lib/main.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var strides2offset = require( './../../base/strides2offset' );
3131
var strides2order = require( './../../base/strides2order' );
3232
var numel = require( './../../base/numel' );
3333
var ndarray = require( './../../ctor' );
34+
var isColumnMajor = require( './../../base/assert/is-column-major-string' );
3435
var isDataType = require( './../../base/assert/is-data-type' );
3536
var isOrder = require( './../../base/assert/is-order' );
3637
var isCastingMode = require( './../../base/assert/is-casting-mode' );
@@ -321,7 +322,7 @@ function array() {
321322
}
322323
} else if ( buffer ) {
323324
if ( btype === 'generic' && opts.flatten && isArray( buffer ) ) {
324-
buffer = flatten( buffer, osh || arrayShape( buffer ), order === 'column-major' );
325+
buffer = flatten( buffer, osh || arrayShape( buffer ), isColumnMajor( order ) );
325326
}
326327
if ( buffer.length !== len ) {
327328
throw new RangeError( 'invalid arguments. Array shape is incompatible with provided data source. Number of data source elements does not match array shape.' );

base/bind2vind/lib/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020

2121
// MODULES //
2222

23-
var format = require( '@stdlib/string/format' );
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
2424
var trunc = require( '@stdlib/math/base/special/trunc' );
2525
var abs = require( '@stdlib/math/base/special/abs' );
26+
var format = require( '@stdlib/string/format' );
2627

2728

2829
// MAIN //
@@ -93,7 +94,7 @@ function bind2vind( shape, strides, offset, order, idx, mode ) {
9394
}
9495
// The approach which follows is to resolve a buffer index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the array view (i.e., where all strides are positive and offset is 0)...
9596
ind = 0;
96-
if ( order === 'column-major' ) {
97+
if ( isColumnMajor( order ) ) {
9798
for ( i = ndims-1; i >= 0; i-- ) {
9899
s = strides[ i ];
99100
if ( s < 0 ) {

base/ctor/lib/iget.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -67,7 +72,7 @@ function iget( idx ) {
6772
shape = this._shape;
6873
strides = this._strides;
6974
ind = this._offset;
70-
if ( this._order === 'column-major' ) {
75+
if ( isColumnMajor( this._order ) ) {
7176
for ( i = 0; i < ndims; i++ ) {
7277
s = idx % shape[ i ];
7378
idx -= s;

base/ctor/lib/iset.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -74,7 +79,7 @@ function iset( idx, v ) {
7479
shape = this._shape;
7580
strides = this._strides;
7681
ind = this._offset;
77-
if ( this._order === 'column-major' ) {
82+
if ( isColumnMajor( this._order ) ) {
7883
for ( i = 0; i < ndims; i++ ) {
7984
s = idx % shape[ i ];
8085
idx -= s;

base/ind2sub/lib/assign.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020

2121
// MODULES //
2222

23-
var format = require( '@stdlib/string/format' );
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
2424
var trunc = require( '@stdlib/math/base/special/trunc' );
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// MAIN //
@@ -94,7 +95,7 @@ function ind2sub( shape, strides, offset, order, idx, mode, out ) {
9495
}
9596
}
9697
if ( offset === 0 ) {
97-
if ( order === 'column-major' ) {
98+
if ( isColumnMajor( order ) ) {
9899
for ( i = 0; i < ndims; i++ ) {
99100
s = idx % shape[ i ];
100101
idx -= s;
@@ -112,7 +113,7 @@ function ind2sub( shape, strides, offset, order, idx, mode, out ) {
112113
}
113114
return out;
114115
}
115-
if ( order === 'column-major' ) {
116+
if ( isColumnMajor( order ) ) {
116117
for ( i = ndims-1; i >= 0; i-- ) {
117118
s = strides[ i ];
118119
if ( s < 0 ) {

base/shape2strides/lib/assign.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
24+
25+
2126
// FUNCTIONS //
2227

2328
/**
@@ -86,7 +91,7 @@ function columnmajor( shape, out ) {
8691
* // returns [ 1, 3 ]
8792
*/
8893
function shape2strides( shape, order, out ) {
89-
if ( order === 'column-major' ) {
94+
if ( isColumnMajor( order ) ) {
9095
return columnmajor( shape, out );
9196
}
9297
return rowmajor( shape, out );

base/shape2strides/lib/main.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
24+
25+
2126
// FUNCTIONS //
2227

2328
/**
@@ -85,7 +90,7 @@ function columnmajor( shape ) {
8590
* // returns [ 1, 3 ]
8691
*/
8792
function shape2strides( shape, order ) {
88-
if ( order === 'column-major' ) {
93+
if ( isColumnMajor( order ) ) {
8994
return columnmajor( shape );
9095
}
9196
return rowmajor( shape );

base/vind2bind/lib/main.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// MODULES //
2222

23+
var isColumnMajor = require( './../../../base/assert/is-column-major-string' );
2324
var format = require( '@stdlib/string/format' );
2425

2526

@@ -90,7 +91,7 @@ function vind2bind( shape, strides, offset, order, idx, mode ) {
9091
}
9192
// The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying data buffer...
9293
ind = offset;
93-
if ( order === 'column-major' ) {
94+
if ( isColumnMajor( order ) ) {
9495
for ( i = 0; i < ndims; i++ ) {
9596
s = idx % shape[ i ];
9697
idx -= s;

0 commit comments

Comments
 (0)