From 93b57e730232ee31ea22b35233d7f910e9c99982 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 16 Jun 2026 11:25:55 +0530 Subject: [PATCH 01/10] feat: add blas/base/ndarray/gsyr --- 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: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/ndarray/gsyr/README.md | 128 +++++++++ .../base/ndarray/gsyr/benchmark/benchmark.js | 112 ++++++++ .../blas/base/ndarray/gsyr/docs/repl.txt | 36 +++ .../base/ndarray/gsyr/docs/types/index.d.ts | 62 +++++ .../blas/base/ndarray/gsyr/docs/types/test.ts | 69 +++++ .../blas/base/ndarray/gsyr/examples/index.js | 41 +++ .../blas/base/ndarray/gsyr/lib/index.js | 53 ++++ .../blas/base/ndarray/gsyr/lib/main.js | 76 +++++ .../blas/base/ndarray/gsyr/package.json | 72 +++++ .../blas/base/ndarray/gsyr/test/test.js | 259 ++++++++++++++++++ 10 files changed, 908 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md new file mode 100644 index 000000000000..58604a52da26 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md @@ -0,0 +1,128 @@ + + +# gsyr + +> Perform the symmetric rank 1 operation `A = alpha*x*x^T + A`. + +
+ +
+ + + +
+ +## Usage + +```javascript +var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); +``` + +#### gsyr( arrays ) + +Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. + +```javascript +var vector = require( '@stdlib/ndarray/vector/ctor' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); + +var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); +var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); + +var alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' +}); + +var out = gsyr( [ x, A, alpha ] ); +// returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] + +var bool = ( out === A ); +// returns true +``` + +The function has the following parameters: + +- **arrays**: array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + - a two-dimensional input ndarray. + - a zero-dimensional ndarray containing a scalar constant. + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var vector = require( '@stdlib/ndarray/vector/ctor' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); + +var opts = { + 'dtype': 'generic' +}; + +var x = vector( discreteUniform( 3, 0, 10, opts ), 'generic' ); +console.log( ndarray2array( x ) ); + +var A = new ndarray( 'generic', discreteUniform( 9, 0, 10, opts ), [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +console.log( ndarray2array( A ) ); + +var alpha = scalar2ndarray( 1.0, opts ); + +var out = gsyr( [ x, A, alpha ] ); +console.log( ndarray2array( out ) ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js new file mode 100644 index 000000000000..3b5bd108f753 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gsyr = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var x; + var A; + + x = uniform( [ len ], -100.0, 100.0, options ); + A = uniform( [ len, len ], -100.0, 100.0, options ); + + alpha = scalar2ndarray( 1.0, options ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = gsyr( [ x, A, alpha ] ); + if ( typeof z !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( isnan( z.get( 0, i%len ) ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 3; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt new file mode 100644 index 000000000000..b0d761d4cf3b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt @@ -0,0 +1,36 @@ + +{{alias}}( arrays ) + Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where + `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an + `N` by `N` symmetric matrix. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + - a two-dimensional input ndarray. + - a zero-dimensional ndarray containing a scalar constant. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var x = {{alias:@stdlib/ndarray/vector/ctor}}( [ 1.0, 2.0 ], 'generic' ); + > var buf = [ 1.0, 2.0, 2.0, 1.0 ]; + > var sh = [ 2, 2 ]; + > var st = [ 2, 1 ]; + > var A = new {{alias:@stdlib/ndarray/base/ctor}}( 'generic', buf, sh, st, 0, 'row-major' ); + > var alpha = {{alias:@stdlib/ndarray/from-scalar}}( 2.0, { 'dtype': 'generic' }); + + > {{alias}}( [ x, A, alpha ] ); + > A + [ [ 3.0, 6.0 ], [ 2.0, 9.0 ] ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts new file mode 100644 index 000000000000..1e6fb5051772 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -0,0 +1,62 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { typedndarray } from '@stdlib/types/ndarray'; + +/** +* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* - a two-dimensional input ndarray. +* - a zero-dimensional ndarray containing a scalar constant. +* +* @param arrays - array-like object containing ndarrays +* @returns output ndarray +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* +* var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); +* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var alpha = scalar2ndarray( 2.0, { +* 'dtype': 'generic' +* }); +* +* var out = gsyr( [ x, A, alpha ] ); +* // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] +* +* var bool = ( out === A ); +* // returns true +*/ +declare function gsyr = typedndarray, U extends typedndarray = typedndarray>( arrays: [ T, U, typedndarray ] ): U; + + +// EXPORTS // + +export = gsyr; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts new file mode 100644 index 000000000000..67364c589f54 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts @@ -0,0 +1,69 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable space-in-parens */ + +import zeros = require( '@stdlib/ndarray/zeros' ); +import gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); + + +// TESTS // + +// The function returns an ndarray... +{ + const x = zeros( [ 3 ], { + 'dtype': 'generic' + }); + const A = zeros( [ 3, 3 ], { + 'dtype': 'generic' + }); + const alpha = zeros( [], { + 'dtype': 'generic' + }); + + gsyr( [ x, A, alpha ] ); // $ExpectType genericndarray +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + gsyr( '10' ); // $ExpectError + gsyr( 10 ); // $ExpectError + gsyr( true ); // $ExpectError + gsyr( false ); // $ExpectError + gsyr( null ); // $ExpectError + gsyr( undefined ); // $ExpectError + gsyr( [] ); // $ExpectError + gsyr( {} ); // $ExpectError + gsyr( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 3 ], { + 'dtype': 'generic' + }); + const A = zeros( [ 3, 3 ], { + 'dtype': 'generic' + }); + const alpha = zeros( [], { + 'dtype': 'generic' + }); + + gsyr(); // $ExpectError + gsyr( [ x, A, alpha ], {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js new file mode 100644 index 000000000000..3ea924d84f8c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var vector = require( '@stdlib/ndarray/vector/ctor' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gsyr = require( './../lib' ); + +var opts = { + 'dtype': 'generic' +}; + +var x = vector( discreteUniform( 3, 0, 10, opts ), 'generic' ); +console.log( ndarray2array( x ) ); + +var A = new ndarray( 'generic', discreteUniform( 9, 0, 10, opts ), [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +console.log( ndarray2array( A ) ); + +var alpha = scalar2ndarray( 1.0, opts ); + +var out = gsyr( [ x, A, alpha ] ); +console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js new file mode 100644 index 000000000000..4a2fe6a77f14 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 2 routine to perform the symmetric rank 1 operation `A = alpha*x*x^T + A`. +* +* @module @stdlib/blas/base/ndarray/gsyr +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); +* +* var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); +* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var alpha = scalar2ndarray( 2.0, { +* 'dtype': 'generic' +* }); +* +* var out = gsyr( [ x, A, alpha ] ); +* // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] +* +* var bool = ( out === A ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js new file mode 100644 index 000000000000..fe62254cc8d2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); +var getStride = require( '@stdlib/ndarray/base/stride' ); +var getOffset = require( '@stdlib/ndarray/base/offset' ); +var getData = require( '@stdlib/ndarray/base/data-buffer' ); +var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); +var strided = require( '@stdlib/blas/base/gsyr' ).ndarray; + + +// MAIN // + +/** +* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* - a two-dimensional input ndarray. +* - a zero-dimensional ndarray containing a scalar constant. +* +* @param {ArrayLikeObject} arrays - array-like object containing ndarrays +* @returns {Object} output ndarray +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* +* var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); +* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var alpha = scalar2ndarray( 2.0, { +* 'dtype': 'generic' +* }); +* +* var out = gsyr( [ x, A, alpha ] ); +* // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] +* +* var bool = ( out === A ); +* // returns true +*/ +function gsyr( arrays ) { + var alpha = ndarraylike2scalar( arrays[ 2 ] ); + var x = arrays[ 0 ]; + var A = arrays[ 1 ]; + strided( 'upper', numelDimension( A, 0 ), alpha, getData( x ), getStride( x, 0 ), getOffset( x ), getData( A ), getStride( A, 0 ), getStride( A, 1 ), getOffset( A ) ); + return A; +} + + +// EXPORTS // + +module.exports = gsyr; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/package.json b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/package.json new file mode 100644 index 000000000000..725d48f5e44d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/blas/base/ndarray/gsyr", + "version": "0.0.0", + "description": "Perform the symmetric rank 1 operation `A = alpha*x*x^T + A`.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "level 2", + "gsyr", + "linear", + "algebra", + "subroutines", + "symmetric", + "rank-1", + "update", + "vector", + "matrix", + "array", + "ndarray", + "generic", + "typedndarray" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js new file mode 100644 index 000000000000..ff22f71eb7ef --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js @@ -0,0 +1,259 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameArray = require( '@stdlib/assert/is-same-array' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var getData = require( '@stdlib/ndarray/data-buffer' ); +var gsyr = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Collection} buffer - underlying data buffer +* @param {NonNegativeInteger} length - number of indexed elements +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} one-dimensional ndarray +*/ +function vector( buffer, length, stride, offset ) { + return new ndarray( 'generic', buffer, [ length ], [ stride ], offset, 'row-major' ); +} + +/** +* Returns a two-dimensional ndarray. +* +* @private +* @param {Collection} buffer - underlying data buffer +* @param {NonNegativeInteger} N - number of rows and columns +* @param {integer} stride0 - stride of the first dimension +* @param {integer} stride1 - stride of the second dimension +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} two-dimensional ndarray +*/ +function matrix( buffer, N, stride0, stride1, offset ) { + return new ndarray( 'generic', buffer, [ N, N ], [ stride0, stride1 ], offset, 'row-major' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gsyr, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 1', function test( t ) { + t.strictEqual( gsyr.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A`', function test( t ) { + var expected; + var alpha; + var xbuf; + var Abuf; + var x; + var A; + var v; + + xbuf = [ 1.0, 2.0, 3.0 ]; + Abuf = [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ]; + x = vector( xbuf, 3, 1, 0 ); + A = matrix( Abuf, 3, 3, 1, 0 ); + alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ 3.0, 6.0, 9.0, 2.0, 9.0, 14.0, 3.0, 2.0, 19.0 ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + + xbuf = [ 1.0, 1.0, 1.0 ]; + Abuf = [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ]; + x = vector( xbuf, 3, 1, 0 ); + A = matrix( Abuf, 3, 1, 3, 0 ); + alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ 3.0, 2.0, 3.0, 4.0, 3.0, 2.0, 5.0, 4.0, 3.0 ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `alpha` is `0`, the function returns `A` unchanged', function test( t ) { + var expected; + var alpha; + var xbuf; + var Abuf; + var x; + var A; + var v; + + xbuf = [ 1.0, 2.0, 3.0 ]; + Abuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]; + x = vector( xbuf, 3, 1, 0 ); + A = matrix( Abuf, 3, 3, 1, 0 ); + alpha = scalar2ndarray( 0.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports ndarrays having non-unit strides', function test( t ) { + var expected; + var alpha; + var xbuf; + var Abuf; + var x; + var A; + var v; + + xbuf = [ + 1.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 3.0 // 2 + ]; + x = vector( xbuf, 3, 2, 0 ); + + Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + A = matrix( Abuf, 3, 3, 1, 0 ); + alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ 2.0, 4.0, 6.0, 0.0, 8.0, 12.0, 0.0, 0.0, 18.0 ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports ndarrays having negative strides', function test( t ) { + var expected; + var alpha; + var xbuf; + var Abuf; + var x; + var A; + var v; + + xbuf = [ + 3.0, // 2 + 2.0, // 1 + 1.0 // 0 + ]; + x = vector( xbuf, 3, -1, 2 ); + + Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + A = matrix( Abuf, 3, 3, 1, 0 ); + alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ 2.0, 4.0, 6.0, 0.0, 8.0, 12.0, 0.0, 0.0, 18.0 ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports ndarrays having non-zero offsets', function test( t ) { + var expected; + var alpha; + var xbuf; + var Abuf; + var x; + var A; + var v; + + xbuf = [ + 0.0, + 1.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 3.0 // 2 + ]; + x = vector( xbuf, 3, 2, 1 ); + + Abuf = [ + 999.0, + 999.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ]; + A = matrix( Abuf, 3, 3, 1, 2 ); + alpha = scalar2ndarray( 2.0, { + 'dtype': 'generic' + }); + + v = gsyr( [ x, A, alpha ] ); + + expected = [ + 999.0, + 999.0, + 2.0, + 4.0, + 6.0, + 0.0, + 8.0, + 12.0, + 0.0, + 0.0, + 18.0 + ]; + t.strictEqual( v, A, 'returns expected value' ); + t.strictEqual( isSameArray( getData( v ), expected ), true, 'returns expected value' ); + t.end(); +}); From a9f1f35cbd0a3e232451dbb746b0344bd3f8b7d5 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 13 Jul 2026 15:47:09 +0530 Subject: [PATCH 02/10] feat: add matrix/ndarray/ctor and cleanup --- 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: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/ndarray/gsyr/README.md | 33 +++++++++++------ .../base/ndarray/gsyr/benchmark/benchmark.js | 9 ++++- .../blas/base/ndarray/gsyr/docs/repl.txt | 36 ++++++++++-------- .../base/ndarray/gsyr/docs/types/index.d.ts | 21 +++++++---- .../blas/base/ndarray/gsyr/docs/types/test.ts | 10 ++++- .../blas/base/ndarray/gsyr/examples/index.js | 17 +++++---- .../blas/base/ndarray/gsyr/lib/index.js | 10 +++-- .../blas/base/ndarray/gsyr/lib/main.js | 37 +++++++++++++------ .../blas/base/ndarray/gsyr/test/test.js | 36 +++++++++++++++--- 9 files changed, 142 insertions(+), 67 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md index 58604a52da26..971eba2ffb66 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md @@ -38,21 +38,25 @@ var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); #### gsyr( arrays ) -Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. +Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is a one-dimensional ndarray, and `A` is an `N` by `N` symmetric matrix. ```javascript +var matrix = require( '@stdlib/ndarray/matrix/ctor' ); var vector = require( '@stdlib/ndarray/vector/ctor' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); -var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); +var uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' +}); var alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); -var out = gsyr( [ x, A, alpha ] ); +var out = gsyr( [ x, A, uplo, alpha ] ); // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] var bool = ( out === A ); @@ -63,9 +67,10 @@ The function has the following parameters: - **arrays**: array-like object containing the following ndarrays: - - a one-dimensional input ndarray. - - a two-dimensional input ndarray. - - a zero-dimensional ndarray containing a scalar constant. + - a one-dimensional input ndarray corresponding to `x`. + - a two-dimensional input ndarray corresponding to `A`. + - a zero-dimensional ndarray specifying whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. + - a zero-dimensional ndarray containing a scalar constant corresponding to `alpha`. @@ -84,10 +89,11 @@ The function has the following parameters: ```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var matrix = require( '@stdlib/ndarray/matrix/ctor' ); var vector = require( '@stdlib/ndarray/vector/ctor' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); @@ -95,15 +101,18 @@ var opts = { 'dtype': 'generic' }; -var x = vector( discreteUniform( 3, 0, 10, opts ), 'generic' ); +var x = vector( ndarray2array( discreteUniform( [ 3 ], 0, 10, opts ) ), 'generic' ); console.log( ndarray2array( x ) ); -var A = new ndarray( 'generic', discreteUniform( 9, 0, 10, opts ), [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +var A = matrix( ndarray2array( discreteUniform( [ 3, 3 ], 0, 10, opts ) ), 'generic' ); console.log( ndarray2array( A ) ); +var uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' +}); var alpha = scalar2ndarray( 1.0, opts ); -var out = gsyr( [ x, A, alpha ] ); +var out = gsyr( [ x, A, uplo, alpha ] ); console.log( ndarray2array( out ) ); ``` diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js index 3b5bd108f753..6c620d1af19b 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js @@ -21,10 +21,11 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var gsyr = require( './../lib' ); @@ -48,12 +49,16 @@ var options = { */ function createBenchmark( len ) { var alpha; + var uplo; var x; var A; x = uniform( [ len ], -100.0, 100.0, options ); A = uniform( [ len, len ], -100.0, 100.0, options ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 1.0, options ); return benchmark; @@ -70,7 +75,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - z = gsyr( [ x, A, alpha ] ); + z = gsyr( [ x, A, uplo, alpha ] ); if ( typeof z !== 'object' ) { b.fail( 'should return an ndarray' ); } diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt index b0d761d4cf3b..b1ca2069bbe5 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/repl.txt @@ -1,17 +1,20 @@ {{alias}}( arrays ) - Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where - `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an - `N` by `N` symmetric matrix. + Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, + where `alpha` is a scalar, `x` is a one-dimensional ndarray, and + `A` is an `N` by `N` symmetric matrix. Parameters ---------- arrays: ArrayLikeObject Array-like object containing the following ndarrays: - - a one-dimensional input ndarray. - - a two-dimensional input ndarray. - - a zero-dimensional ndarray containing a scalar constant. + - a one-dimensional input ndarray corresponding to `x`. + - a two-dimensional input ndarray corresponding to `A`. + - a zero-dimensional ndarray specifying whether the upper or lower + triangular part of the symmetric matrix `A` should be referenced. + - a zero-dimensional ndarray containing a scalar constant corresponding + to `alpha`. Returns ------- @@ -20,16 +23,19 @@ Examples -------- - > var x = {{alias:@stdlib/ndarray/vector/ctor}}( [ 1.0, 2.0 ], 'generic' ); - > var buf = [ 1.0, 2.0, 2.0, 1.0 ]; - > var sh = [ 2, 2 ]; - > var st = [ 2, 1 ]; - > var A = new {{alias:@stdlib/ndarray/base/ctor}}( 'generic', buf, sh, st, 0, 'row-major' ); - > var alpha = {{alias:@stdlib/ndarray/from-scalar}}( 2.0, { 'dtype': 'generic' }); - - > {{alias}}( [ x, A, alpha ] ); + > var xbuf = [ 1.0, 2.0, 3.0 ]; + > var x = {{alias:@stdlib/ndarray/vector/ctor}}( xbuf, 'generic' ); + + > var abuf = [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ]; + > var A = {{alias:@stdlib/ndarray/matrix/ctor}}( abuf, 'generic' ); + + > var uplo = {{alias:@stdlib/ndarray/from-scalar}}( 'upper' ); + > var opts = { 'dtype': 'generic' }; + > var alpha = {{alias:@stdlib/ndarray/from-scalar}}( 2.0, opts ); + + > {{alias}}( [ x, A, uplo, alpha ] ); > A - [ [ 3.0, 6.0 ], [ 2.0, 9.0 ] ] + [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] See Also -------- diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts index 1e6fb5051772..8fb14f717709 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -23,38 +23,43 @@ import { typedndarray } from '@stdlib/types/ndarray'; /** -* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. +* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is a one-dimensional ndarray, and `A` is an `N` by `N` symmetric matrix. * * ## Notes * * - The function expects the following ndarrays: * -* - a one-dimensional input ndarray. -* - a two-dimensional input ndarray. -* - a zero-dimensional ndarray containing a scalar constant. +* - a one-dimensional input ndarray corresponding to `x`. +* - a two-dimensional input ndarray corresponding to `A`. +* - a zero-dimensional ndarray specifying whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +* - a zero-dimensional ndarray containing a scalar constant corresponding to `alpha`. * * @param arrays - array-like object containing ndarrays * @returns output ndarray * * @example +* var matrix = require( '@stdlib/ndarray/matrix/ctor' ); * var vector = require( '@stdlib/ndarray/vector/ctor' ); * var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); * * var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); -* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * +* var uplo = scalar2ndarray( resolveEnum( 'upper' ), { +* 'dtype': 'int8' +* }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, alpha ] ); +* var out = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * * var bool = ( out === A ); * // returns true */ -declare function gsyr = typedndarray, U extends typedndarray = typedndarray>( arrays: [ T, U, typedndarray ] ): U; +declare function gsyr = typedndarray, U extends typedndarray = typedndarray>( arrays: [ T, U, typedndarray, typedndarray ] ): U; // EXPORTS // diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts index 67364c589f54..e7f0b2363fb7 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts @@ -32,11 +32,14 @@ import gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); const A = zeros( [ 3, 3 ], { 'dtype': 'generic' }); + const uplo = zeros( [], { + 'dtype': 'int8' + }); const alpha = zeros( [], { 'dtype': 'generic' }); - gsyr( [ x, A, alpha ] ); // $ExpectType genericndarray + gsyr( [ x, A, uplo, alpha ] ); // $ExpectType genericndarray } // The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... @@ -60,10 +63,13 @@ import gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); const A = zeros( [ 3, 3 ], { 'dtype': 'generic' }); + const uplo = zeros( [], { + 'dtype': 'int8' + }); const alpha = zeros( [], { 'dtype': 'generic' }); gsyr(); // $ExpectError - gsyr( [ x, A, alpha ], {} ); // $ExpectError + gsyr( [ x, A, uplo, alpha ], {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js index 3ea924d84f8c..c3c390c0be10 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js @@ -18,10 +18,11 @@ 'use strict'; -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var matrix = require( '@stdlib/ndarray/matrix/ctor' ); var vector = require( '@stdlib/ndarray/vector/ctor' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var gsyr = require( './../lib' ); @@ -29,13 +30,13 @@ var opts = { 'dtype': 'generic' }; -var x = vector( discreteUniform( 3, 0, 10, opts ), 'generic' ); -console.log( ndarray2array( x ) ); - -var A = new ndarray( 'generic', discreteUniform( 9, 0, 10, opts ), [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); -console.log( ndarray2array( A ) ); +var x = vector( ndarray2array( discreteUniform( [ 3 ], 0, 10, opts ) ), 'generic' ); +var A = matrix( ndarray2array( discreteUniform( [ 3, 3 ], 0, 10, opts ) ), 'generic' ); +var uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' +}); var alpha = scalar2ndarray( 1.0, opts ); -var out = gsyr( [ x, A, alpha ] ); +var out = gsyr( [ x, A, uplo, alpha ] ); console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js index 4a2fe6a77f14..2758f5f95ceb 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js @@ -24,19 +24,23 @@ * @module @stdlib/blas/base/ndarray/gsyr * * @example +* var matrix = require( '@stdlib/ndarray/matrix/ctor' ); * var vector = require( '@stdlib/ndarray/vector/ctor' ); * var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); * var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); * * var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); -* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * +* var uplo = scalar2ndarray( resolveEnum( 'upper' ), { +* 'dtype': 'int8' +* }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, alpha ] ); +* var out = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * * var bool = ( out === A ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js index fe62254cc8d2..702160a57ff8 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -25,48 +25,63 @@ var getStride = require( '@stdlib/ndarray/base/stride' ); var getOffset = require( '@stdlib/ndarray/base/offset' ); var getData = require( '@stdlib/ndarray/base/data-buffer' ); var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); +var resolveStr = require( '@stdlib/blas/base/matrix-triangle-resolve-str' ); var strided = require( '@stdlib/blas/base/gsyr' ).ndarray; // MAIN // /** -* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is an `N` element ndarray, and `A` is an `N` by `N` symmetric matrix. +* Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is a one-dimensional ndarray, and `A` is an `N` by `N` symmetric matrix. * * ## Notes * * - The function expects the following ndarrays: * -* - a one-dimensional input ndarray. -* - a two-dimensional input ndarray. -* - a zero-dimensional ndarray containing a scalar constant. +* - a one-dimensional input ndarray corresponding to `x`. +* - a two-dimensional input ndarray corresponding to `A`. +* - a zero-dimensional ndarray specifying whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +* - a zero-dimensional ndarray containing a scalar constant corresponding to `alpha`. * * @param {ArrayLikeObject} arrays - array-like object containing ndarrays * @returns {Object} output ndarray * * @example +* var matrix = require( '@stdlib/ndarray/matrix/ctor' ); * var vector = require( '@stdlib/ndarray/vector/ctor' ); * var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); * * var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); -* var A = new ndarray( 'generic', [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ], [ 3, 3 ], [ 3, 1 ], 0, 'row-major' ); +* var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * +* var uplo = scalar2ndarray( resolveEnum( 'upper' ), { +* 'dtype': 'int8' +* }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, alpha ] ); +* var out = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * * var bool = ( out === A ); * // returns true */ function gsyr( arrays ) { - var alpha = ndarraylike2scalar( arrays[ 2 ] ); - var x = arrays[ 0 ]; - var A = arrays[ 1 ]; - strided( 'upper', numelDimension( A, 0 ), alpha, getData( x ), getStride( x, 0 ), getOffset( x ), getData( A ), getStride( A, 0 ), getStride( A, 1 ), getOffset( A ) ); + var alpha; + var uplo; + var x; + var A; + + x = arrays[ 0 ]; + A = arrays[ 1 ]; + + uplo = resolveStr( ndarraylike2scalar( arrays[ 2 ] ) ); + alpha = ndarraylike2scalar( arrays[ 3 ] ); + + strided( uplo, numelDimension( A, 0 ), alpha, getData( x ), getStride( x, 0 ), getOffset( x ), getData( A ), getStride( A, 0 ), getStride( A, 1 ), getOffset( A ) ); + return A; } diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js index ff22f71eb7ef..09cd5a2b3e50 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js @@ -23,6 +23,7 @@ var tape = require( 'tape' ); var isSameArray = require( '@stdlib/assert/is-same-array' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray = require( '@stdlib/ndarray/base/ctor' ); var getData = require( '@stdlib/ndarray/data-buffer' ); var gsyr = require( './../lib' ); @@ -78,6 +79,7 @@ tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A var alpha; var xbuf; var Abuf; + var uplo; var x; var A; var v; @@ -86,11 +88,14 @@ tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A Abuf = [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ]; x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 3, 1, 0 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 3.0, 6.0, 9.0, 2.0, 9.0, 14.0, 3.0, 2.0, 19.0 ]; t.strictEqual( v, A, 'returns expected value' ); @@ -100,11 +105,14 @@ tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A Abuf = [ 1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 2.0, 1.0 ]; x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 1, 3, 0 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 3.0, 2.0, 3.0, 4.0, 3.0, 2.0, 5.0, 4.0, 3.0 ]; t.strictEqual( v, A, 'returns expected value' ); @@ -118,6 +126,7 @@ tape( 'if `alpha` is `0`, the function returns `A` unchanged', function test( t var alpha; var xbuf; var Abuf; + var uplo; var x; var A; var v; @@ -126,11 +135,14 @@ tape( 'if `alpha` is `0`, the function returns `A` unchanged', function test( t Abuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]; x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 3, 1, 0 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 0.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]; t.strictEqual( v, A, 'returns expected value' ); @@ -144,6 +156,7 @@ tape( 'the function supports ndarrays having non-unit strides', function test( t var alpha; var xbuf; var Abuf; + var uplo; var x; var A; var v; @@ -159,11 +172,14 @@ tape( 'the function supports ndarrays having non-unit strides', function test( t Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; A = matrix( Abuf, 3, 3, 1, 0 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 2.0, 4.0, 6.0, 0.0, 8.0, 12.0, 0.0, 0.0, 18.0 ]; t.strictEqual( v, A, 'returns expected value' ); @@ -176,6 +192,7 @@ tape( 'the function supports ndarrays having negative strides', function test( t var alpha; var xbuf; var Abuf; + var uplo; var x; var A; var v; @@ -189,11 +206,14 @@ tape( 'the function supports ndarrays having negative strides', function test( t Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; A = matrix( Abuf, 3, 3, 1, 0 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 2.0, 4.0, 6.0, 0.0, 8.0, 12.0, 0.0, 0.0, 18.0 ]; t.strictEqual( v, A, 'returns expected value' ); @@ -206,6 +226,7 @@ tape( 'the function supports ndarrays having non-zero offsets', function test( t var alpha; var xbuf; var Abuf; + var uplo; var x; var A; var v; @@ -234,11 +255,14 @@ tape( 'the function supports ndarrays having non-zero offsets', function test( t 0.0 ]; A = matrix( Abuf, 3, 3, 1, 2 ); + uplo = scalar2ndarray( resolveEnum( 'upper' ), { + 'dtype': 'int8' + }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); - v = gsyr( [ x, A, alpha ] ); + v = gsyr( [ x, A, uplo, alpha ] ); expected = [ 999.0, From 15bb83f650fe3152b618700a63172aff4737cfe1 Mon Sep 17 00:00:00 2001 From: Kaustubh Patange Date: Mon, 13 Jul 2026 15:53:09 +0530 Subject: [PATCH 03/10] Update lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js Signed-off-by: Kaustubh Patange --- lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js index 702160a57ff8..7845395918b2 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -77,7 +77,7 @@ function gsyr( arrays ) { x = arrays[ 0 ]; A = arrays[ 1 ]; - uplo = resolveStr( ndarraylike2scalar( arrays[ 2 ] ) ); + uplo = ndarraylike2scalar( arrays[ 2 ] ); alpha = ndarraylike2scalar( arrays[ 3 ] ); strided( uplo, numelDimension( A, 0 ), alpha, getData( x ), getStride( x, 0 ), getOffset( x ), getData( A ), getStride( A, 0 ), getStride( A, 1 ), getOffset( A ) ); From 28e7cc7ec931a873fc38102fbc193ed3e0adeafd Mon Sep 17 00:00:00 2001 From: Kaustubh Patange Date: Mon, 13 Jul 2026 15:53:19 +0530 Subject: [PATCH 04/10] Update lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js Signed-off-by: Kaustubh Patange --- lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js index 7845395918b2..07ab73e18253 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -25,7 +25,6 @@ var getStride = require( '@stdlib/ndarray/base/stride' ); var getOffset = require( '@stdlib/ndarray/base/offset' ); var getData = require( '@stdlib/ndarray/base/data-buffer' ); var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); -var resolveStr = require( '@stdlib/blas/base/matrix-triangle-resolve-str' ); var strided = require( '@stdlib/blas/base/gsyr' ).ndarray; From a8abd6db87b4380ce044ba654142f229a23f7145 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 13 Jul 2026 21:54:35 +0530 Subject: [PATCH 05/10] fix: benchmark.js --- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - 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 --- --- .../@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js index 6c620d1af19b..c209a4ea9fd0 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); +var uniform = require( '@stdlib/random/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); From c6f634ef69b50ca26cfeecf91108f394df92453f Mon Sep 17 00:00:00 2001 From: Kaustubh Patange Date: Tue, 14 Jul 2026 13:29:12 +0530 Subject: [PATCH 06/10] Apply suggestions from code review Co-authored-by: Kaustubh Patange Signed-off-by: Kaustubh Patange --- .../@stdlib/blas/base/ndarray/gsyr/README.md | 17 ++++++++--------- .../base/ndarray/gsyr/docs/types/index.d.ts | 4 ++-- .../blas/base/ndarray/gsyr/examples/index.js | 6 ++---- .../@stdlib/blas/base/ndarray/gsyr/lib/index.js | 4 ++-- .../@stdlib/blas/base/ndarray/gsyr/lib/main.js | 4 ++-- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md index 971eba2ffb66..e902f3673a32 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md @@ -40,6 +40,8 @@ var gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is a one-dimensional ndarray, and `A` is an `N` by `N` symmetric matrix. + + ```javascript var matrix = require( '@stdlib/ndarray/matrix/ctor' ); var vector = require( '@stdlib/ndarray/vector/ctor' ); @@ -56,10 +58,10 @@ var alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' }); -var out = gsyr( [ x, A, uplo, alpha ] ); +var y = gsyr( [ x, A, uplo, alpha ] ); // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] -var bool = ( out === A ); +var bool = ( y === A ); // returns true ``` @@ -86,12 +88,12 @@ The function has the following parameters: ## Examples + + ```javascript var discreteUniform = require( '@stdlib/random/discrete-uniform' ); -var matrix = require( '@stdlib/ndarray/matrix/ctor' ); -var vector = require( '@stdlib/ndarray/vector/ctor' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); @@ -101,11 +103,8 @@ var opts = { 'dtype': 'generic' }; -var x = vector( ndarray2array( discreteUniform( [ 3 ], 0, 10, opts ) ), 'generic' ); -console.log( ndarray2array( x ) ); - -var A = matrix( ndarray2array( discreteUniform( [ 3, 3 ], 0, 10, opts ) ), 'generic' ); -console.log( ndarray2array( A ) ); +var x = discreteUniform( [ 3 ], 0, 10, opts ); +var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { 'dtype': 'int8' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts index 8fb14f717709..eddabc40eca1 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -53,10 +53,10 @@ import { typedndarray } from '@stdlib/types/ndarray'; * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, uplo, alpha ] ); +* var y = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * -* var bool = ( out === A ); +* var bool = ( y === A ); * // returns true */ declare function gsyr = typedndarray, U extends typedndarray = typedndarray>( arrays: [ T, U, typedndarray, typedndarray ] ): U; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js index c3c390c0be10..68aa62e92393 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js @@ -19,8 +19,6 @@ 'use strict'; var discreteUniform = require( '@stdlib/random/discrete-uniform' ); -var matrix = require( '@stdlib/ndarray/matrix/ctor' ); -var vector = require( '@stdlib/ndarray/vector/ctor' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); @@ -30,8 +28,8 @@ var opts = { 'dtype': 'generic' }; -var x = vector( ndarray2array( discreteUniform( [ 3 ], 0, 10, opts ) ), 'generic' ); -var A = matrix( ndarray2array( discreteUniform( [ 3, 3 ], 0, 10, opts ) ), 'generic' ); +var x = discreteUniform( [ 3 ], 0, 10, opts ); +var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { 'dtype': 'int8' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js index 2758f5f95ceb..4b94ac54513a 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js @@ -40,10 +40,10 @@ * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, uplo, alpha ] ); +* var y = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * -* var bool = ( out === A ); +* var bool = ( y === A ); * // returns true */ diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js index 07ab73e18253..ce352c46be98 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -61,10 +61,10 @@ var strided = require( '@stdlib/blas/base/gsyr' ).ndarray; * 'dtype': 'generic' * }); * -* var out = gsyr( [ x, A, uplo, alpha ] ); +* var y = gsyr( [ x, A, uplo, alpha ] ); * // returns [ [ 3.0, 6.0, 9.0 ], [ 2.0, 9.0, 14.0 ], [ 3.0, 2.0, 19.0 ] ] * -* var bool = ( out === A ); +* var bool = ( y === A ); * // returns true */ function gsyr( arrays ) { From ab84e61a72f8b4a156b37c71f7e4a18e176086ae Mon Sep 17 00:00:00 2001 From: Kaustubh Patange Date: Tue, 14 Jul 2026 13:35:32 +0530 Subject: [PATCH 07/10] Update lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts Signed-off-by: Kaustubh Patange --- .../@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts index eddabc40eca1..da62a4556a92 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -59,7 +59,7 @@ import { typedndarray } from '@stdlib/types/ndarray'; * var bool = ( y === A ); * // returns true */ -declare function gsyr = typedndarray, U extends typedndarray = typedndarray>( arrays: [ T, U, typedndarray, typedndarray ] ): U; +declare function gsyr = typedndarray>( arrays: [ typedndarray, T, typedndarray, typedndarray ] ): T; // EXPORTS // From e995fe5c5a6202779cc3b1e1a09cfc672ee01cd3 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Sat, 18 Jul 2026 13:40:16 +0530 Subject: [PATCH 08/10] fix: replace int8 with int32 --- 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: passed - 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: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/ndarray/gsyr/README.md | 4 ++-- .../blas/base/ndarray/gsyr/benchmark/benchmark.js | 2 +- .../blas/base/ndarray/gsyr/docs/types/index.d.ts | 2 +- .../blas/base/ndarray/gsyr/docs/types/test.ts | 4 ++-- .../@stdlib/blas/base/ndarray/gsyr/examples/index.js | 2 +- .../@stdlib/blas/base/ndarray/gsyr/lib/index.js | 2 +- .../@stdlib/blas/base/ndarray/gsyr/lib/main.js | 2 +- .../@stdlib/blas/base/ndarray/gsyr/test/test.js | 12 ++++++------ 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md index e902f3673a32..44471ce4877d 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md @@ -52,7 +52,7 @@ var x = vector( [ 1.0, 2.0, 3.0 ], 'generic' ); var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); var alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' @@ -107,7 +107,7 @@ var x = discreteUniform( [ 3 ], 0, 10, opts ); var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); var alpha = scalar2ndarray( 1.0, opts ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js index c209a4ea9fd0..74dfe0007b29 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js @@ -57,7 +57,7 @@ function createBenchmark( len ) { A = uniform( [ len, len ], -100.0, 100.0, options ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 1.0, options ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts index da62a4556a92..829fd2177885 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -47,7 +47,7 @@ import { typedndarray } from '@stdlib/types/ndarray'; * var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * * var uplo = scalar2ndarray( resolveEnum( 'upper' ), { -* 'dtype': 'int8' +* 'dtype': 'int32' * }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts index e7f0b2363fb7..7b96902f7678 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/test.ts @@ -33,7 +33,7 @@ import gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); 'dtype': 'generic' }); const uplo = zeros( [], { - 'dtype': 'int8' + 'dtype': 'int32' }); const alpha = zeros( [], { 'dtype': 'generic' @@ -64,7 +64,7 @@ import gsyr = require( '@stdlib/blas/base/ndarray/gsyr' ); 'dtype': 'generic' }); const uplo = zeros( [], { - 'dtype': 'int8' + 'dtype': 'int32' }); const alpha = zeros( [], { 'dtype': 'generic' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js index 68aa62e92393..14abff873f0e 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js @@ -32,7 +32,7 @@ var x = discreteUniform( [ 3 ], 0, 10, opts ); var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); var alpha = scalar2ndarray( 1.0, opts ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js index 4b94ac54513a..a17112a87340 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/index.js @@ -34,7 +34,7 @@ * var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * * var uplo = scalar2ndarray( resolveEnum( 'upper' ), { -* 'dtype': 'int8' +* 'dtype': 'int32' * }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js index ce352c46be98..e9343012f255 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/lib/main.js @@ -55,7 +55,7 @@ var strided = require( '@stdlib/blas/base/gsyr' ).ndarray; * var A = matrix( [ [ 1.0, 2.0, 3.0 ], [ 2.0, 1.0, 2.0 ], [ 3.0, 2.0, 1.0 ] ], 'generic' ); * * var uplo = scalar2ndarray( resolveEnum( 'upper' ), { -* 'dtype': 'int8' +* 'dtype': 'int32' * }); * var alpha = scalar2ndarray( 2.0, { * 'dtype': 'generic' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js index 09cd5a2b3e50..5151be74275c 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/test/test.js @@ -89,7 +89,7 @@ tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 3, 1, 0 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' @@ -106,7 +106,7 @@ tape( 'the function performs the symmetric rank 1 operation `A = alpha*x*x^T + A x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 1, 3, 0 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' @@ -136,7 +136,7 @@ tape( 'if `alpha` is `0`, the function returns `A` unchanged', function test( t x = vector( xbuf, 3, 1, 0 ); A = matrix( Abuf, 3, 3, 1, 0 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 0.0, { 'dtype': 'generic' @@ -173,7 +173,7 @@ tape( 'the function supports ndarrays having non-unit strides', function test( t Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; A = matrix( Abuf, 3, 3, 1, 0 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' @@ -207,7 +207,7 @@ tape( 'the function supports ndarrays having negative strides', function test( t Abuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; A = matrix( Abuf, 3, 3, 1, 0 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' @@ -256,7 +256,7 @@ tape( 'the function supports ndarrays having non-zero offsets', function test( t ]; A = matrix( Abuf, 3, 3, 1, 2 ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { - 'dtype': 'int8' + 'dtype': 'int32' }); alpha = scalar2ndarray( 2.0, { 'dtype': 'generic' From c47649b223b1fc341c28ada750685831bb44a032 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 18 Jul 2026 20:21:52 -0700 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts index 829fd2177885..834c4459e529 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { typedndarray } from '@stdlib/types/ndarray'; +import { typedndarray, ndarray } from '@stdlib/types/ndarray'; /** * Performs the symmetric rank 1 operation `A = alpha*x*x^T + A`, where `alpha` is a scalar, `x` is a one-dimensional ndarray, and `A` is an `N` by `N` symmetric matrix. @@ -59,7 +59,7 @@ import { typedndarray } from '@stdlib/types/ndarray'; * var bool = ( y === A ); * // returns true */ -declare function gsyr = typedndarray>( arrays: [ typedndarray, T, typedndarray, typedndarray ] ): T; +declare function gsyr = typedndarray>( arrays: [ typedndarray, T, ndarray, typedndarray ] ): T; // EXPORTS // From edda92a61cc0553d5dd8f79c0dc822dcf345fcbe Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 18 Jul 2026 20:41:38 -0700 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md | 3 ++- .../@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js | 3 ++- .../@stdlib/blas/base/ndarray/gsyr/examples/index.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md index 44471ce4877d..145978a416e8 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/README.md @@ -94,6 +94,7 @@ The function has the following parameters: ```javascript var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var zeros = require( '@stdlib/ndarray/zeros' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); @@ -104,7 +105,7 @@ var opts = { }; var x = discreteUniform( [ 3 ], 0, 10, opts ); -var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); +var A = zeros( [ 3, 3 ], opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { 'dtype': 'int32' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js index 74dfe0007b29..d8cdf6f150b1 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/uniform' ); +var zeros = require( '@stdlib/ndarray/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); @@ -54,7 +55,7 @@ function createBenchmark( len ) { var A; x = uniform( [ len ], -100.0, 100.0, options ); - A = uniform( [ len, len ], -100.0, 100.0, options ); + A = zeros( [ len, len ], options ); uplo = scalar2ndarray( resolveEnum( 'upper' ), { 'dtype': 'int32' diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js index 14abff873f0e..731932d14569 100644 --- a/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gsyr/examples/index.js @@ -19,6 +19,7 @@ 'use strict'; var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var zeros = require( '@stdlib/ndarray/zeros' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var resolveEnum = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); @@ -29,7 +30,7 @@ var opts = { }; var x = discreteUniform( [ 3 ], 0, 10, opts ); -var A = discreteUniform( [ 3, 3 ], 0, 10, opts ); +var A = zeros( [ 3, 3 ], opts ); var uplo = scalar2ndarray( resolveEnum( 'upper' ), { 'dtype': 'int32'