Skip to content

Commit eae38b8

Browse files
committed
refactor: replace internal utility
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 405a8c7 commit eae38b8

2 files changed

Lines changed: 8 additions & 78 deletions

File tree

lib/node_modules/@stdlib/blas/ext/linspace/lib/main.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
3333
var isOrder = require( '@stdlib/ndarray/base/assert/is-order' );
3434
var isDataType = require( '@stdlib/ndarray/base/assert/is-data-type' );
3535
var nonCoreShape = require( '@stdlib/ndarray/base/complement-shape' );
36+
var resolveOrder = require( '@stdlib/ndarray/base/output-order' );
3637
var resolveStr = require( '@stdlib/ndarray/base/dtype-resolve-str' );
3738
var getDType = require( '@stdlib/ndarray/base/dtype' );
3839
var empty = require( '@stdlib/ndarray/empty' );
@@ -42,7 +43,6 @@ var format = require( '@stdlib/string/format' );
4243
var DTYPES = require( './dtypes.js' );
4344
var ENUMS = require( './type_enums.js' );
4445
var resolveDataTypes = require( './resolve_data_types.js' );
45-
var resolveOrder = require( './resolve_order.js' );
4646
var normalizeArguments = require( './normalize_arguments.js' );
4747
var defaults = require( './defaults.js' );
4848
var base = require( './base.js' );
@@ -86,6 +86,7 @@ function linspace( shape, start, stop ) {
8686
var opts;
8787
var args;
8888
var ncsh;
89+
var arrs;
8990
var out;
9091
var sh;
9192
var dt;
@@ -99,6 +100,7 @@ function linspace( shape, start, stop ) {
99100
throw new TypeError( format( 'invalid argument. First argument must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', shape ) );
100101
}
101102
types = [ 0, 0, 0 ]; // [ start, stop, endpoint ]
103+
arrs = [];
102104
if ( isNumber( start ) ) {
103105
types[ 0 ] = ENUMS.NUMBER;
104106
} else if ( isComplexLike( start ) ) {
@@ -109,6 +111,7 @@ function linspace( shape, start, stop ) {
109111
if ( !contains( DTYPES.idtypes0, dt ) ) {
110112
throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( DTYPES.idtypes0, '", "' ), dt ) );
111113
}
114+
arrs.push( start );
112115
} else {
113116
throw new TypeError( format( 'invalid argument. Second argument must be either a number, complex number, or an ndarray. Value: `%s`.', start ) );
114117
}
@@ -122,6 +125,7 @@ function linspace( shape, start, stop ) {
122125
if ( !contains( DTYPES.idtypes1, dt ) ) {
123126
throw new TypeError( format( 'invalid argument. Third argument must have one of the following data types: "%s". Data type: `%s`.', join( DTYPES.idtypes1, '", "' ), dt ) );
124127
}
128+
arrs.push( stop );
125129
} else {
126130
throw new TypeError( format( 'invalid argument. Third argument must be either a number, complex number, or an ndarray. Value: `%s`.', stop ) );
127131
}
@@ -150,6 +154,7 @@ function linspace( shape, start, stop ) {
150154
throw new TypeError( format( 'invalid argument. Fourth argument must have one of the following data types: "%s". Data type: `%s`.', join( DTYPES.idtypes2, '", "' ), dt ) );
151155
}
152156
types[ 2 ] = ENUMS.NDARRAY;
157+
arrs.push( endpoint );
153158
}
154159
// Case: linspace( shape, start, stop, options )
155160
else {
@@ -172,6 +177,7 @@ function linspace( shape, start, stop ) {
172177
if ( !contains( DTYPES.idtypes2, dt ) ) {
173178
throw new TypeError( format( 'invalid argument. Fourth argument must have one of the following data types: "%s". Data type: `%s`.', join( DTYPES.idtypes2, '", "' ), dt ) );
174179
}
180+
arrs.push( endpoint );
175181
} else {
176182
throw new TypeError( format( 'invalid argument. Fourth argument must be either a boolean or an ndarray. Value: `%s`.', endpoint ) );
177183
}
@@ -218,7 +224,7 @@ function linspace( shape, start, stop ) {
218224
dtypes[ 3 ] = options.dtype;
219225

220226
// Resolve the output array order:
221-
options.order = options.order || resolveOrder( args, types );
227+
options.order = options.order || resolveOrder( arrs );
222228

223229
// Resolve the complement of the operation dimensions:
224230
ncsh = nonCoreShape( sh, options.dims );

lib/node_modules/@stdlib/blas/ext/linspace/lib/resolve_order.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)