Skip to content

Commit 3a90873

Browse files
committed
refactor: use inbuilt functions to check for jobs and size
--- 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e82dc31 commit 3a90873

File tree

4 files changed

+72
-7
lines changed

4 files changed

+72
-7
lines changed

lib/node_modules/@stdlib/lapack/base/dgebak/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ The function has the following parameters:
6565
- **V**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
6666
- **LDV**: stride of the first dimension of `V` (a.k.a., leading dimension of the matrix `V`).
6767

68-
6968
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
7069

7170
<!-- eslint-disable stdlib/capitalized-comments -->

lib/node_modules/@stdlib/lapack/base/dgebak/lib/dgebak.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string
2525
var max = require( '@stdlib/math/base/special/max' );
2626
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2727
var format = require( '@stdlib/string/format' );
28+
var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' );
29+
var isJob = require( './isjob.js' );
2830
var base = require( './base.js' );
2931

3032

@@ -73,10 +75,10 @@ function dgebak( order, job, side, N, M, ilo, ihi, scale, V, LDV ) {
7375
if ( !isLayout( order ) ) {
7476
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
7577
}
76-
if ( job !== 'none' && job !== 'scale' && job !== 'permute' && job !== 'both' ) {
78+
if ( !isJob( job ) ) {
7779
throw new TypeError( format( 'invalid argument. Second argument must be a valid job. Value: `%s`.', job ) );
7880
}
79-
if ( side !== 'left' && side !== 'right' ) {
81+
if ( !isOperationSide( side ) ) {
8082
throw new TypeError( format( 'invalid argument. Third argument must be a valid side. Value: `%s`.', side ) );
8183
}
8284
if ( isRowMajor( order ) && LDV < max( 1, M ) ) {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
24+
25+
26+
// VARIABLES //
27+
28+
var JOBS = [ 'none', 'permute', 'scale', 'both' ];
29+
30+
31+
// MAIN //
32+
33+
/**
34+
* Tests whether an input value is a supported job.
35+
*
36+
* @name isJob
37+
* @type {Function}
38+
* @param {*} v - value to test
39+
* @returns {boolean} boolean indicating whether an input value is a supported job
40+
*
41+
* @example
42+
* var bool = isJob( 'both' );
43+
* // returns true
44+
*
45+
* bool = isJob( 'none' );
46+
* // returns true
47+
*
48+
* bool = isJob( 'permute' );
49+
* // returns true
50+
*
51+
* bool = isJob( 'scale' );
52+
* // returns true
53+
*
54+
* bool = isJob( 'foo' );
55+
* // returns false
56+
*/
57+
var isJob = contains( JOBS );
58+
59+
60+
// EXPORTS //
61+
62+
module.exports = isJob;

lib/node_modules/@stdlib/lapack/base/dgebak/lib/ndarray.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
// MODULES //
2222

2323
var format = require( '@stdlib/string/format' );
24+
var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' );
25+
var isJob = require( './isjob.js' );
2426
var base = require( './base.js' );
2527

2628

@@ -65,11 +67,11 @@ var base = require( './base.js' );
6567
* // returns <Float64Array>[ 0.5, 2, 4, 10, 3, 6 ]
6668
*/
6769
function dgebak( job, side, N, M, ilo, ihi, scale, strideScale, offsetScale, V, strideV1, strideV2, offsetV ) { // eslint-disable-line max-len, max-params
68-
if ( job !== 'none' && job !== 'scale' && job !== 'permute' && job !== 'both' ) {
69-
throw new TypeError( format( 'invalid argument. First argument must be a valid job. Value: `%s`.', job ) );
70+
if ( !isJob( job ) ) {
71+
throw new TypeError( format( 'invalid argument. Second argument must be a valid job. Value: `%s`.', job ) );
7072
}
71-
if ( side !== 'left' && side !== 'right' ) {
72-
throw new TypeError( format( 'invalid argument. Second argument must be a valid side. Value: `%s`.', side ) );
73+
if ( !isOperationSide( side ) ) {
74+
throw new TypeError( format( 'invalid argument. Third argument must be a valid side. Value: `%s`.', side ) );
7375
}
7476
return base( job, side, N, M, ilo, ihi, scale, strideScale, offsetScale, V, strideV1, strideV2, offsetV ); // eslint-disable-line max-len
7577
}

0 commit comments

Comments
 (0)