From c73d02266e54a930a8d26cf441beaa14c9ede2b4 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Fri, 17 Jul 2026 00:00:36 +0530 Subject: [PATCH] refactor: add support for enums in blas/base/dspmv --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- lib/node_modules/@stdlib/blas/base/dspmv/lib/dspmv.js | 10 ++++++---- .../@stdlib/blas/base/dspmv/lib/ndarray.js | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/lib/dspmv.js b/lib/node_modules/@stdlib/blas/base/dspmv/lib/dspmv.js index 32b865e63310..293281194ef9 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/lib/dspmv.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/lib/dspmv.js @@ -21,7 +21,7 @@ // MODULES // var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); -var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var resolveStr = require( '@stdlib/blas/base/matrix-triangle-resolve-str' ); var stride2offset = require( '@stdlib/strided/base/stride2offset' ); var format = require( '@stdlib/string/format' ); var base = require( './base.js' ); @@ -33,7 +33,7 @@ var base = require( './base.js' ); * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * * @param {string} order - storage layout -* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied +* @param {(integer|string)} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param {NonNegativeInteger} N - number of elements along each dimension of `A` * @param {number} alpha - scalar constant * @param {Float64Array} AP - packed form of a symmetric matrix `A` @@ -62,11 +62,13 @@ var base = require( './base.js' ); function dspmv( order, uplo, N, alpha, AP, x, strideX, beta, y, strideY ) { var offsetX; var offsetY; + var u; if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( !isMatrixTriangle( uplo ) ) { + u = resolveStr( uplo ); + if ( u === null ) { throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); } if ( N < 0 ) { @@ -80,7 +82,7 @@ function dspmv( order, uplo, N, alpha, AP, x, strideX, beta, y, strideY ) { } offsetX = stride2offset( N, strideX ); offsetY = stride2offset( N, strideY ); - return base( order, uplo, N, alpha, AP, 0, x, strideX, offsetX, beta, y, strideY, offsetY ); // eslint-disable-line max-len + return base( order, u, N, alpha, AP, 0, x, strideX, offsetX, beta, y, strideY, offsetY ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dspmv/lib/ndarray.js index 2c5a1479e790..d4d1c4643752 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/lib/ndarray.js @@ -21,7 +21,7 @@ // MODULES // var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); -var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var resolveStr = require( '@stdlib/blas/base/matrix-triangle-resolve-str' ); var format = require( '@stdlib/string/format' ); var base = require( './base.js' ); @@ -32,7 +32,7 @@ var base = require( './base.js' ); * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * * @param {string} order - storage layout -* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied +* @param {(integer|string)} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param {NonNegativeInteger} N - number of elements along each dimension of `A` * @param {number} alpha - scalar constant * @param {Float64Array} AP - packed form of a symmetric matrix `A` @@ -62,10 +62,13 @@ var base = require( './base.js' ); * // y => [ ~7.0, ~12.0, ~15.0 ] */ function dspmv( order, uplo, N, alpha, AP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ) { // eslint-disable-line max-params, max-len + var u; + if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( !isMatrixTriangle( uplo ) ) { + u = resolveStr( uplo ); + if ( u === null ) { throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); } if ( N < 0 ) { @@ -77,7 +80,7 @@ function dspmv( order, uplo, N, alpha, AP, offsetAP, x, strideX, offsetX, beta, if ( strideY === 0 ) { throw new RangeError( format( 'invalid argument. Twelfth argument must be non-zero. Value: `%d`.', strideY ) ); } - return base( order, uplo, N, alpha, AP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ); // eslint-disable-line max-len + return base( order, u, N, alpha, AP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ); // eslint-disable-line max-len }