From cbead2a2512f02ba68118b9aed97ab024e84f33a Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 11 Jan 2025 12:38:17 +0000 Subject: [PATCH 01/24] feat: add blas/base/dzasum --- 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: passed - 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/dzasum/README.md | 205 ++++++++++++++++++ .../blas/base/dzasum/benchmark/benchmark.js | 105 +++++++++ .../dzasum/benchmark/benchmark.ndarray.js | 105 +++++++++ .../blas/base/dzasum/docs/types/index.d.ts | 96 ++++++++ .../blas/base/dzasum/docs/types/test.ts | 158 ++++++++++++++ .../blas/base/dzasum/examples/index.js | 35 +++ .../@stdlib/blas/base/dzasum/lib/dzasum.js | 53 +++++ .../@stdlib/blas/base/dzasum/lib/index.js | 68 ++++++ .../@stdlib/blas/base/dzasum/lib/main.js | 35 +++ .../@stdlib/blas/base/dzasum/lib/ndarray.js | 65 ++++++ .../@stdlib/blas/base/dzasum/package.json | 83 +++++++ .../blas/base/dzasum/test/test.dzasum.js | 129 +++++++++++ .../@stdlib/blas/base/dzasum/test/test.js | 82 +++++++ .../blas/base/dzasum/test/test.ndarray.js | 128 +++++++++++ 14 files changed, 1347 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md new file mode 100644 index 000000000000..135590fee4f0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -0,0 +1,205 @@ + + +# dzasum + +> Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. + +
+ +dzasum is defined as + + + +```math +\|\mathbf{x}\|_1 = \sum_{i=0}^{n-1} \left( |a_i| + |b_i| \right) +``` + + + + + +
+ + + +
+ +## Usage + +```javascript +var dzasum = require( '@stdlib/blas/base/dzasum' ); +``` + +#### dzasum( N, x, stride ) + +Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = dzasum( x.length, x, 1 ); +// returns 19.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **x**: input [`Complex128Array`][complex128array]. +- **stride**: index increment. + +The `N` and `stride` parameters determine which elements in `x` are used to compute the sum. For example, to sum every other value, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = dzasum( 2, x, 2 ); +// returns 7.0 +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +// Initial array... +var x0 = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); + +// Create an offset view... +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Sum every other value... +var sum = dzasum( 2, x1, 2 ); +// returns 22.0 +``` + +If `N` is less than or equal to `0`, the function returns `0`. + +#### dzasum.ndarray( N, x, stride, offset ) + +Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = dzasum.ndarray( x.length, x, 1, 0 ); +// returns 19.0 +``` + +The function has the following additional parameters: + +- **offset**: starting index. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offset` parameter supports indexing semantics based on a starting index. For example, to sum the last three elements, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); + +var sum = dzasum.ndarray( 3, x, 1, x.length-3 ); +// returns 33.0 + +// Using a negative stride to sum from the last element: +sum = dzasum.ndarray( 3, x, -1, x.length-1 ); +// returns 33.0 +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, the sum is `0`. +- `dzasum()` corresponds to the [BLAS][blas] level 1 function dzasum. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var dzasum = require( '@stdlib/blas/base/dzasum' ); + +function rand() { + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +// Generate random input arrays: +var x = filledarrayBy( 10, 'complex128', rand ); +console.log( x.toString() ); + +var out = dzasum( x.length, x, 1 ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js new file mode 100644 index 000000000000..8cee6bfd8a5c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var pkg = require( './../package.json' ).name; +var dzasum = require( './../lib/dzasum.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x; + + x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dzasum( x.length, x, 1 ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..5fd95fe79ec7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var pkg = require( './../package.json' ).name; +var dzasum = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x; + + x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dzasum( x.length, x, 1, 0 ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts new file mode 100644 index 000000000000..af30dd68a8ca --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts @@ -0,0 +1,96 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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 { Complex128Array } from '@stdlib/types/array'; + +/** +* Interface describing `dzasum`. +*/ +interface Routine { + /** + * Compute the sum of the absolute values of each element in a double-precision complex floating-point vector. + * + * @param N - number of indexed elements + * @param x - input array + * @param stride - stride length + * @returns sum of absolute values + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + * + * var sum = dzasum( x.length, x, 1 ); + * // returns 19.0 + */ + ( N: number, x: Complex128Array, stride: number ): number; + + /** + * Computes the sum of the absolute values using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param x - input array + * @param stride - stride length + * @param offset - starting index + * @returns sum of absolute values + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + * + * var z = dzasum.ndarray( x.length, x, 1, 0 ); + * // returns 19.0 + */ + ndarray( N: number, x: Complex128Array, stride: number, offset: number ): number; +} + +/** +* Compute the sum of the absolute values of each element in a double-precision complex floating-point vector. +* +* @param N - number of indexed elements +* @param x - input array +* @param stride - stride length +* @returns sum of absolute values +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var sum = dzasum( x.length, x, 1 ); +* // returns 19.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var z = dzasum.ndarray( x.length, x, 1, 0 ); +* // returns 19.0 +*/ +declare var dzasum: Routine; + + +// EXPORTS // + +export = dzasum; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts new file mode 100644 index 000000000000..98c9680adc1d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts @@ -0,0 +1,158 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2020 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. +*/ + +import Complex128Array = require( '@stdlib/array/complex128' ); +import dzasum = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const x = new Complex128Array( 10 ); + + dzasum( x.length, x, 1 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Complex128Array( 10 ); + + dzasum( '10', x, 1 ); // $ExpectError + dzasum( true, x, 1 ); // $ExpectError + dzasum( false, x, 1 ); // $ExpectError + dzasum( null, x, 1 ); // $ExpectError + dzasum( undefined, x, 1 ); // $ExpectError + dzasum( [], x, 1 ); // $ExpectError + dzasum( {}, x, 1 ); // $ExpectError + dzasum( ( x: number ): number => x, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + + dzasum( x.length, 10, 1 ); // $ExpectError + dzasum( x.length, '10', 1 ); // $ExpectError + dzasum( x.length, true, 1 ); // $ExpectError + dzasum( x.length, false, 1 ); // $ExpectError + dzasum( x.length, null, 1 ); // $ExpectError + dzasum( x.length, undefined, 1 ); // $ExpectError + dzasum( x.length, [], 1 ); // $ExpectError + dzasum( x.length, {}, 1 ); // $ExpectError + dzasum( x.length, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex128Array( 10 ); + + dzasum( x.length, x, '10' ); // $ExpectError + dzasum( x.length, x, true ); // $ExpectError + dzasum( x.length, x, false ); // $ExpectError + dzasum( x.length, x, null ); // $ExpectError + dzasum( x.length, x, undefined ); // $ExpectError + dzasum( x.length, x, [] ); // $ExpectError + dzasum( x.length, x, {} ); // $ExpectError + dzasum( x.length, x, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex128Array( 10 ); + + dzasum(); // $ExpectError + dzasum( x.length ); // $ExpectError + dzasum( x.length, x ); // $ExpectError + dzasum( x.length, x, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray( x.length, x, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray( '10', x, 1, 0 ); // $ExpectError + dzasum.ndarray( true, x, 1, 0 ); // $ExpectError + dzasum.ndarray( false, x, 1, 0 ); // $ExpectError + dzasum.ndarray( null, x, 1, 0 ); // $ExpectError + dzasum.ndarray( undefined, x, 1, 0 ); // $ExpectError + dzasum.ndarray( [], x, 1, 0 ); // $ExpectError + dzasum.ndarray( {}, x, 1, 0 ); // $ExpectError + dzasum.ndarray( ( x: number ): number => x, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray( x.length, 10, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, '10', 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, true, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, false, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, null, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, undefined, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, [], 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, {}, 1, 0 ); // $ExpectError + dzasum.ndarray( x.length, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray( x.length, x, '10', 0 ); // $ExpectError + dzasum.ndarray( x.length, x, true, 0 ); // $ExpectError + dzasum.ndarray( x.length, x, false, 0 ); // $ExpectError + dzasum.ndarray( x.length, x, null, 0 ); // $ExpectError + dzasum.ndarray( x.length, x, undefined, 0 ); // $ExpectError + dzasum.ndarray( x.length, x, [], 0 ); // $ExpectError + dzasum.ndarray( x.length, x, {}, 0 ); // $ExpectError + dzasum.ndarray( x.length, x, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray( x.length, x, 1, '10' ); // $ExpectError + dzasum.ndarray( x.length, x, 1, true ); // $ExpectError + dzasum.ndarray( x.length, x, 1, false ); // $ExpectError + dzasum.ndarray( x.length, x, 1, null ); // $ExpectError + dzasum.ndarray( x.length, x, 1, undefined ); // $ExpectError + dzasum.ndarray( x.length, x, 1, [] ); // $ExpectError + dzasum.ndarray( x.length, x, 1, {} ); // $ExpectError + dzasum.ndarray( x.length, x, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Complex128Array( 10 ); + + dzasum.ndarray(); // $ExpectError + dzasum.ndarray( x.length ); // $ExpectError + dzasum.ndarray( x.length, x ); // $ExpectError + dzasum.ndarray( x.length, x, 1 ); // $ExpectError + dzasum.ndarray( x.length, x, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js new file mode 100644 index 000000000000..55e808dac0f2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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/base/discrete-uniform' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var dzasum = require( '@stdlib/blas/base/dzasum' ); + +function rand() { + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +// Generate random input arrays: +var x = filledarrayBy( 10, 'complex128', rand ); +console.log( x.toString() ); + +var out = dzasum( x.length, x, 1 ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js new file mode 100644 index 000000000000..f7be49fde4ce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64Array} x - input array +* @param {integer} stride - `x` stride length +* @returns {number} sum +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var sum = dzasum( x.length, x, 1 ); +* // returns 19.0 +*/ +function dzasum( N, x, stride ) { + var ox = stride2offset( N, stride ); + return ndarray( N, x, stride, ox ); +} + + +// EXPORTS // + +module.exports = dzasum; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js new file mode 100644 index 000000000000..44a78a24abea --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 1 routine to compute the sum of absolute values of each element in a double-precision complex floating-point vector. +* +* @module @stdlib/blas/base/dzasum +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var dzasum = require( '@stdlib/blas/base/dzasum' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var sum = dzasum( x.length, x, 1 ); +* // returns 19.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var dzasum = require( '@stdlib/blas/base/dzasum' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var sum = dzasum.ndarray( x.length, x, 1, 0 ); +* // returns 19.0 +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dzasum; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dzasum = main; +} else { + dzasum = tmp; +} + + +// EXPORTS // + +module.exports = dzasum; + +// exports: { "ndarray": "dzasum.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js new file mode 100644 index 000000000000..02691681c914 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dzasum = require( './dzasum.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dzasum, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dzasum; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js new file mode 100644 index 000000000000..e59053675ede --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 dcabs1 = require( '@stdlib/blas/base/dcabs1' ); + + +// MAIN // + +/** +* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64Array} x - input array +* @param {integer} stride - `x` stride length +* @param {NonNegativeInteger} offset - starting index for `x` +* @returns {number} sum +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var sum = dzasum( x.length, x, 1, 0 ); +* // returns 19.0 +*/ +function dzasum( N, x, stride, offset ) { + var sum; + var ix; + var i; + + sum = 0.0; + if ( N <= 0 ) { + return sum; + } + ix = offset; + for ( i = 0; i < N; i++ ) { + sum += dcabs1( x.get( ix ) ); + ix += stride; + } + return sum; +} + + +// EXPORTS // + +module.exports = dzasum; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/package.json b/lib/node_modules/@stdlib/blas/base/dzasum/package.json new file mode 100644 index 000000000000..693df0d5e522 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/package.json @@ -0,0 +1,83 @@ +{ + "name": "@stdlib/blas/base/dzasum", + "version": "0.0.0", + "description": "Compute the sum of the absolute values of each element in a double-precision complex floating-point vector.", + "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", + "browser": "./lib/main.js", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "src": "./src", + "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 1", + "linear", + "algebra", + "subroutines", + "dcabs1", + "absolute", + "value", + "sum", + "l1norm", + "norm", + "taxicab", + "manhattan", + "vector", + "array", + "ndarray", + "double", + "complex128", + "complex128array" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js new file mode 100644 index 000000000000..181c7a728d82 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js @@ -0,0 +1,129 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 Complex128Array = require( '@stdlib/array/complex128' ); +var dzasum = require( './../lib/dzasum.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dzasum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 3', function test( t ) { + t.strictEqual( dzasum.length, 3, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the sum of absolute values', function test( t ) { + var x; + var y; + + x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + y = dzasum( x.length, x, 1 ); + + t.strictEqual( y, 21.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var x; + var y; + var N; + + x = new Complex128Array([ + 1.0, // 1 + -2.0, // 1 + 3.0, + -4.0, + 5.0, // 2 + -6.0 // 2 + ]); + N = 2; + + y = dzasum( N, x, 2 ); + + t.strictEqual( y, 14.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { + var x; + var y; + + x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + y = dzasum( 0, x, 1 ); + + t.strictEqual( y, 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var x; + var y; + var N; + + x = new Complex128Array([ + 1.0, // 2 + -2.0, // 2 + 3.0, + -4.0, + 5.0, // 1 + -6.0 // 1 + ]); + N = 2; + + y = dzasum( N, x, -2 ); + + t.strictEqual( y, 14.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var x0; + var x1; + var y; + var N; + + // Initial array... + x0 = new Complex128Array([ + 1.0, + -2.0, + 3.0, // 1 + -4.0, // 1 + 5.0, // 2 + -6.0 // 2 + ]); + + // Create an offset view... + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + + N = 2; + y = dzasum( N, x1, 1 ); + + t.strictEqual( y, 18.0, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js new file mode 100644 index 000000000000..c7c4ac04005a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dzasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dzasum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof dzasum.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var dzasum = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dzasum, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var dzasum; + var main; + + main = require( './../lib/dzasum.js' ); + + dzasum = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dzasum, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js new file mode 100644 index 000000000000..e94b718f7c75 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js @@ -0,0 +1,128 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 Complex128Array = require( '@stdlib/array/complex128' ); +var dzasum = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dzasum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 4', function test( t ) { + t.strictEqual( dzasum.length, 4, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the sum of absolute values', function test( t ) { + var x; + var y; + + x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + y = dzasum( x.length, x, 1, 0 ); + + t.strictEqual( y, 21.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var x; + var y; + var N; + + x = new Complex128Array([ + 1.0, // 1 + -2.0, // 1 + 3.0, + -4.0, + 5.0, // 2 + -6.0 // 2 + ]); + N = 2; + + y = dzasum( N, x, 2, 0 ); + + t.strictEqual( y, 14.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` offset', function test( t ) { + var x; + var y; + var N; + + x = new Complex128Array([ + 1.0, + -2.0, + 3.0, // 1 + -4.0, // 1 + 5.0, // 2 + -6.0 // 2 + ]); + N = 2; + + y = dzasum( N, x, 1, 1 ); + + t.strictEqual( y, 18.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { + var x; + var y; + + x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + + y = dzasum( -1, x, 1, 0 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + y = dzasum( 0, x, 1, 0 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var x; + var y; + var N; + + x = new Complex128Array([ + 1.0, // 2 + -2.0, // 2 + 3.0, + -4.0, + 5.0, // 1 + -6.0 // 1 + ]); + N = 2; + + y = dzasum( N, x, -2, x.length-1 ); + + t.strictEqual( y, 14.0, 'returns expected value' ); + t.end(); +}); From 9ef0e0ed5c5192719643710584ccb9e9346fcc8e Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 11 Jan 2025 12:45:54 +0000 Subject: [PATCH 02/24] add repl.txt --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/base/dzasum/docs/repl.txt | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt new file mode 100644 index 000000000000..d7a062f681a6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt @@ -0,0 +1,90 @@ + +{{alias}}( N, x, stride ) + Compute the sum of the absolute values of each element in a + double-precision complex floating-point vector + + The `N` and `stride` parameters determine which elements in `x` are used + to compute the sum. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is less than or equal to `0`, the function returns `0`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex128Array + Input array. + + stride: integer + Index increment. + + Returns + ------- + sum: number + Sum of absolute values. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var s = {{alias}}( x.length, x, 1 ) + 15.0 + + // Sum every other value: + > s = {{alias}}( 2, x, 2 ) + 7.0 + + // Use view offset; e.g., starting at 2nd element: + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > s = {{alias}}( 2, x1, 2 ) + 22.0 + + +{{alias}}.ndarray( N, x, stride, offset ) + Compute the sum of the absolute values of each element in a + double-precision complex floating-point vector using alternative indexing + semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the `offset` parameter supports indexing semantics based on a + starting index. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex128Array + Input array. + + stride: integer + Index increment. + + offset: integer + Starting index. + + Returns + ------- + sum: number + Sum of absolute values. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + > var s = {{alias}}.ndarray( x.length, x, 1, 0 ) + 19.0 + + // Sum the last three elements: + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); + > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) + 33.0 + + See Also + -------- + From cb2094fdfd56f44d88cd91125e4f87a57ec64c70 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 11 Jan 2025 12:56:41 +0000 Subject: [PATCH 03/24] fix: copyright years --- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - 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: passed - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed --- --- lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts index 98c9680adc1d..16f905048756 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js index e94b718f7c75..ac1ca0fa4b91 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 114b390533cd208b1da508bf571461c2e62ff958 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 13:30:36 +0530 Subject: [PATCH 04/24] bench: update variable naming --- 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: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/dzasum/benchmark/benchmark.js | 14 +++++++------- .../base/dzasum/benchmark/benchmark.ndarray.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js index 8cee6bfd8a5c..14a79ecdb1d7 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js @@ -42,13 +42,13 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} len - array length +* @param {PositiveInteger} N - array length * @returns {Function} benchmark function */ -function createBenchmark( len ) { +function createBenchmark( N ) { var x; - x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) ); return benchmark; /** @@ -86,9 +86,9 @@ function createBenchmark( len ) { * @private */ function main() { - var len; var min; var max; + var N; var f; var i; @@ -96,9 +96,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':size='+N, f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js index 5fd95fe79ec7..ad9098469294 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js @@ -42,13 +42,13 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} len - array length +* @param {PositiveInteger} N - array length * @returns {Function} benchmark function */ -function createBenchmark( len ) { +function createBenchmark( N ) { var x; - x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) ); return benchmark; /** @@ -86,9 +86,9 @@ function createBenchmark( len ) { * @private */ function main() { - var len; var min; var max; + var N; var f; var i; @@ -96,9 +96,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':ndarray:len='+len, f ); + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':ndarray:size='+N, f ); } } From 9860165c3da0399af4bc2c54d939892f0df3f2fe Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 13:45:06 +0530 Subject: [PATCH 05/24] docs: update variable naming and jsdoc --- 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: passed - 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: 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 --- --- .../@stdlib/blas/base/dzasum/docs/repl.txt | 41 ++++++++++--------- .../blas/base/dzasum/docs/types/index.d.ts | 10 ++--- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt index d7a062f681a6..1f38f8eba558 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt @@ -1,9 +1,9 @@ -{{alias}}( N, x, stride ) - Compute the sum of the absolute values of each element in a - double-precision complex floating-point vector +{{alias}}( N, x, strideX ) + Computes the sum of the absolute values of each element in a + double-precision complex floating-point vector. - The `N` and `stride` parameters determine which elements in `x` are used + The `N` and `strideX` parameters determine which elements in `x` are used to compute the sum. Indexing is relative to the first index. To introduce an offset, use typed @@ -19,7 +19,7 @@ x: Complex128Array Input array. - stride: integer + strideX: integer Index increment. Returns @@ -30,28 +30,29 @@ Examples -------- // Standard usage: - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ]); > var s = {{alias}}( x.length, x, 1 ) - 15.0 + 11.0 - // Sum every other value: + // Advanced indexing: + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); > s = {{alias}}( 2, x, 2 ) 7.0 - // Use view offset; e.g., starting at 2nd element: - > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > s = {{alias}}( 2, x1, 2 ) - 22.0 + > s = {{alias}}( 2, x1, 1 ) + 18.0 -{{alias}}.ndarray( N, x, stride, offset ) - Compute the sum of the absolute values of each element in a +{{alias}}.ndarray( N, x, strideX, offsetX ) + Computes the sum of the absolute values of each element in a double-precision complex floating-point vector using alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offset` parameter supports indexing semantics based on a + buffer, the `offsetX` parameter supports indexing semantics based on a starting index. Parameters @@ -62,10 +63,10 @@ x: Complex128Array Input array. - stride: integer + strideX: integer Index increment. - offset: integer + offsetX: integer Starting index. Returns @@ -76,11 +77,11 @@ Examples -------- // Standard usage: - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ] ); > var s = {{alias}}.ndarray( x.length, x, 1, 0 ) - 19.0 + 11.0 - // Sum the last three elements: + // Advanced indexing: > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) 33.0 diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts index af30dd68a8ca..f5679e6c8f85 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts @@ -27,7 +27,7 @@ import { Complex128Array } from '@stdlib/types/array'; */ interface Routine { /** - * Compute the sum of the absolute values of each element in a double-precision complex floating-point vector. + * Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. * * @param N - number of indexed elements * @param x - input array @@ -45,12 +45,12 @@ interface Routine { ( N: number, x: Complex128Array, stride: number ): number; /** - * Computes the sum of the absolute values using alternative indexing semantics. + * Computes the sum of the absolute values of each element in a double-precision complex floating-point vector using alternative indexing semantics. * * @param N - number of indexed elements * @param x - input array * @param stride - stride length - * @param offset - starting index + * @param offsetX - starting index * @returns sum of absolute values * * @example @@ -61,11 +61,11 @@ interface Routine { * var z = dzasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ - ndarray( N: number, x: Complex128Array, stride: number, offset: number ): number; + ndarray( N: number, x: Complex128Array, stride: number, offsetX: number ): number; } /** -* Compute the sum of the absolute values of each element in a double-precision complex floating-point vector. +* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. * * @param N - number of indexed elements * @param x - input array From 10ba7b3e895e9b6a4f1f715675e3c467d8a4f048 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 13:49:50 +0530 Subject: [PATCH 06/24] chore: add ndarray example --- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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 --- --- .../@stdlib/blas/base/dzasum/examples/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js index 55e808dac0f2..2f0a93e5c503 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js @@ -21,7 +21,7 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); var filledarrayBy = require( '@stdlib/array/filled-by' ); -var dzasum = require( '@stdlib/blas/base/dzasum' ); +var dzasum = require( './../lib' ); function rand() { return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); @@ -31,5 +31,10 @@ function rand() { var x = filledarrayBy( 10, 'complex128', rand ); console.log( x.toString() ); +// Compute the sum of the absolute values of each element: var out = dzasum( x.length, x, 1 ); console.log( out ); + +// Compute the sum of the absolute values of each element using alternative indexing semantics: +out = dzasum.ndarray( x.length, x, 1, 0 ); +console.log( out ); From 2a604f9fc2a8dee4721a8481a6109a978f260f51 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 13:51:30 +0530 Subject: [PATCH 07/24] docs: update jsdoc and variable naming --- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dzasum/lib/dzasum.js | 8 ++++---- .../@stdlib/blas/base/dzasum/lib/ndarray.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js index f7be49fde4ce..bcfea6022966 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js @@ -31,7 +31,7 @@ var ndarray = require( './ndarray.js' ); * * @param {PositiveInteger} N - number of indexed elements * @param {Complex64Array} x - input array -* @param {integer} stride - `x` stride length +* @param {integer} strideX - `x` stride length * @returns {number} sum * * @example @@ -42,9 +42,9 @@ var ndarray = require( './ndarray.js' ); * var sum = dzasum( x.length, x, 1 ); * // returns 19.0 */ -function dzasum( N, x, stride ) { - var ox = stride2offset( N, stride ); - return ndarray( N, x, stride, ox ); +function dzasum( N, x, strideX ) { + var ox = stride2offset( N, strideX ); + return ndarray( N, x, strideX, ox ); } diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js index e59053675ede..864d39527722 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js @@ -30,8 +30,8 @@ var dcabs1 = require( '@stdlib/blas/base/dcabs1' ); * * @param {PositiveInteger} N - number of indexed elements * @param {Complex64Array} x - input array -* @param {integer} stride - `x` stride length -* @param {NonNegativeInteger} offset - starting index for `x` +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` * @returns {number} sum * * @example @@ -42,7 +42,7 @@ var dcabs1 = require( '@stdlib/blas/base/dcabs1' ); * var sum = dzasum( x.length, x, 1, 0 ); * // returns 19.0 */ -function dzasum( N, x, stride, offset ) { +function dzasum( N, x, strideX, offsetX ) { var sum; var ix; var i; @@ -51,10 +51,10 @@ function dzasum( N, x, stride, offset ) { if ( N <= 0 ) { return sum; } - ix = offset; + ix = offsetX; for ( i = 0; i < N; i++ ) { sum += dcabs1( x.get( ix ) ); - ix += stride; + ix += strideX; } return sum; } From 5a3cb83683f43a897482ab0c17a54d08cc6dafe6 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 13:56:16 +0530 Subject: [PATCH 08/24] chore: update markdown --- 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: na - 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 --- --- .../@stdlib/blas/base/dzasum/README.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index 135590fee4f0..4f8d84cda15c 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -20,7 +20,7 @@ limitations under the License. # dzasum -> Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. +> Computes the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element.
@@ -51,9 +51,9 @@ dzasum is defined as var dzasum = require( '@stdlib/blas/base/dzasum' ); ``` -#### dzasum( N, x, stride ) +#### dzasum( N, x, strideX ) -Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. +Compute the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -68,9 +68,9 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Complex128Array`][complex128array]. -- **stride**: index increment. +- **strideX**: stride length for `x`. -The `N` and `stride` parameters determine which elements in `x` are used to compute the sum. For example, to sum every other value, +The `N` and `strideX` parameters determine which elements in `x` are used to compute the sum. For example, to sum every other value, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -97,11 +97,9 @@ var sum = dzasum( 2, x1, 2 ); // returns 22.0 ``` -If `N` is less than or equal to `0`, the function returns `0`. +#### dzasum.ndarray( N, x, strideX, offsetX ) -#### dzasum.ndarray( N, x, stride, offset ) - -Compute the sum of the [absolute values][@stdlib/blas/base/dcab1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector using alternative indexing semantics. +Compute the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector using alternative indexing semantics. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -114,9 +112,9 @@ var sum = dzasum.ndarray( x.length, x, 1, 0 ); The function has the following additional parameters: -- **offset**: starting index. +- **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offset` parameter supports indexing semantics based on a starting index. For example, to sum the last three elements, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offsetX` parameter supports indexing semantics based on a starting index. For example, to sum the last three elements, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -140,7 +138,7 @@ sum = dzasum.ndarray( 3, x, -1, x.length-1 ); ## Notes - If `N <= 0`, the sum is `0`. -- `dzasum()` corresponds to the [BLAS][blas] level 1 function dzasum. +- `dzasum()` corresponds to the [BLAS][blas] level 1 function [`dzasum`][blas-dzasum].
@@ -190,7 +188,9 @@ console.log( out ); [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray -[@stdlib/blas/base/dcab1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/dcab1 +[blas-dzasum]: https://www.netlib.org/lapack/explore-html-3.6.1/de/da4/group__double__blas__level1_ga60d5c8001b317c929778670a15013eb4.html + +[@stdlib/blas/base/dcabs1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/dcabs1 [complex128array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex128 From 88559fbdb434613492ce0a804846f68c89fecc07 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 7 Jul 2025 14:02:46 +0530 Subject: [PATCH 09/24] fix: linting in package.json --- 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: passed - 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: 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 --- --- lib/node_modules/@stdlib/blas/base/dzasum/package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/package.json b/lib/node_modules/@stdlib/blas/base/dzasum/package.json index 693df0d5e522..3294b7b49a19 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/package.json +++ b/lib/node_modules/@stdlib/blas/base/dzasum/package.json @@ -14,15 +14,11 @@ } ], "main": "./lib", - "browser": "./lib/main.js", - "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", - "include": "./include", "lib": "./lib", - "src": "./src", "test": "./test" }, "types": "./docs/types", From 1a3dc71856620b75646ab84fff88f2a073e3de9a Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Mon, 7 Jul 2025 17:59:31 +0530 Subject: [PATCH 10/24] chore: update markdown example Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dzasum/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index 4f8d84cda15c..cab604cc7933 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -157,15 +157,20 @@ var filledarrayBy = require( '@stdlib/array/filled-by' ); var dzasum = require( '@stdlib/blas/base/dzasum' ); function rand() { - return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } // Generate random input arrays: var x = filledarrayBy( 10, 'complex128', rand ); console.log( x.toString() ); +// Compute the sum of the absolute values of each element: var out = dzasum( x.length, x, 1 ); console.log( out ); + +// Compute the sum of the absolute values of each element using alternative indexing semantics: +out = dzasum.ndarray( x.length, x, 1, 0 ); +console.log( out ); ``` From f4c25fecb4a36a7e35ce6da94590e44b41e1219a Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Tue, 8 Jul 2025 21:46:05 +0530 Subject: [PATCH 11/24] chore: convert tabs to spaces --- 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: na - 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 --- --- lib/node_modules/@stdlib/blas/base/dzasum/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index cab604cc7933..8665ab73f8f8 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -157,7 +157,7 @@ var filledarrayBy = require( '@stdlib/array/filled-by' ); var dzasum = require( '@stdlib/blas/base/dzasum' ); function rand() { - return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } // Generate random input arrays: From c3291eb4d948516746eb5c6998139394d24b4c2a Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 26 May 2026 23:27:36 +0530 Subject: [PATCH 12/24] fix: add C API placeholder and refactor readme according to standard conventions --- 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: na - 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 --- --- .../@stdlib/blas/base/dzasum/README.md | 131 ++++++++++++------ 1 file changed, 92 insertions(+), 39 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index 8665ab73f8f8..3476e58e61fd 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +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. @@ -20,7 +20,7 @@ limitations under the License. # dzasum -> Computes the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element. +> Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector.
@@ -53,31 +53,31 @@ var dzasum = require( '@stdlib/blas/base/dzasum' ); #### dzasum( N, x, strideX ) -Compute the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector. +Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = dzasum( x.length, x, 1 ); +var out = dzasum( x.length, x, 1 ); // returns 19.0 ``` The function has the following parameters: - **N**: number of indexed elements. -- **x**: input [`Complex128Array`][complex128array]. -- **strideX**: stride length for `x`. +- **x**: input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `x`. -The `N` and `strideX` parameters determine which elements in `x` are used to compute the sum. For example, to sum every other value, +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to traverse every other value, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = dzasum( 2, x, 2 ); +var out = dzasum( 2, x, 2 ); // returns 7.0 ``` @@ -86,27 +86,27 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); -// Initial array... +// Initial array: var x0 = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); -// Create an offset view... +// Create an offset view: var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -// Sum every other value... -var sum = dzasum( 2, x1, 2 ); +// Compute the sum of absolute values: +var out = dzasum( 2, x1, 2 ); // returns 22.0 ``` #### dzasum.ndarray( N, x, strideX, offsetX ) -Compute the sum of the [absolute values][@stdlib/blas/base/dcabs1] of each element in a double-precision [complex][@stdlib/complex/float64/ctor] floating-point vector using alternative indexing semantics. +Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector using alternative indexing semantics. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = dzasum.ndarray( x.length, x, 1, 0 ); +var out = dzasum.ndarray( x.length, x, 1, 0 ); // returns 19.0 ``` @@ -114,18 +114,14 @@ The function has the following additional parameters: - **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offsetX` parameter supports indexing semantics based on a starting index. For example, to sum the last three elements, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to start from the second index, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); -var sum = dzasum.ndarray( 3, x, 1, x.length-3 ); -// returns 33.0 - -// Using a negative stride to sum from the last element: -sum = dzasum.ndarray( 3, x, -1, x.length-1 ); +var out = dzasum.ndarray( 3, x, 1, 1 ); // returns 33.0 ``` @@ -137,8 +133,8 @@ sum = dzasum.ndarray( 3, x, -1, x.length-1 ); ## Notes -- If `N <= 0`, the sum is `0`. -- `dzasum()` corresponds to the [BLAS][blas] level 1 function [`dzasum`][blas-dzasum]. +- If `N <= 0`, both functions return `0.0`. +- `dzasum()` corresponds to the [BLAS][blas] level 1 function [`dzasum`][dzasum].
@@ -152,31 +148,96 @@ sum = dzasum.ndarray( 3, x, -1, x.length-1 ); ```javascript var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var dzasum = require( '@stdlib/blas/base/dzasum' ); function rand() { return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -// Generate random input arrays: var x = filledarrayBy( 10, 'complex128', rand ); console.log( x.toString() ); -// Compute the sum of the absolute values of each element: +// Compute the sum of the absolute values of real and imaginary components: var out = dzasum( x.length, x, 1 ); console.log( out ); +``` -// Compute the sum of the absolute values of each element using alternative indexing semantics: -out = dzasum.ndarray( x.length, x, 1, 0 ); -console.log( out ); + + + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO ```
+
+ + + From 1305408acf756e657165ce44b14a8941d76d75c9 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 26 May 2026 23:30:11 +0530 Subject: [PATCH 13/24] chore: fix description in package.json --- 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: passed - 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: 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/dzasum/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/package.json b/lib/node_modules/@stdlib/blas/base/dzasum/package.json index 3294b7b49a19..f32d1a9a3c20 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/package.json +++ b/lib/node_modules/@stdlib/blas/base/dzasum/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/dzasum", "version": "0.0.0", - "description": "Compute the sum of the absolute values of each element in a double-precision complex floating-point vector.", + "description": "Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From 64cb6e5b223e5ec6e8820eaa0038364b3457b462 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 26 May 2026 23:41:46 +0530 Subject: [PATCH 14/24] chore: update the JS test implementation --- 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: passed - 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 --- --- .../blas/base/dzasum/test/test.dzasum.js | 181 +++++++++++---- .../@stdlib/blas/base/dzasum/test/test.js | 10 +- .../blas/base/dzasum/test/test.ndarray.js | 219 ++++++++++++++---- 3 files changed, 308 insertions(+), 102 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js index 181c7a728d82..0ad9a1872407 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -22,9 +22,36 @@ var tape = require( 'tape' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); var dzasum = require( './../lib/dzasum.js' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {number} actual - actual value +* @param {number} expected - expected value +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + + if ( actual === expected ) { + t.strictEqual( actual, expected, 'returns expected value' ); + } else { + delta = abs( actual - expected ); + tol = rtol * EPS * abs( expected ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual+'. expected: '+expected+'. delta: '+delta+'. tol: '+tol+'.' ); + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -38,92 +65,150 @@ tape( 'the function has an arity of 3', function test( t ) { t.end(); }); -tape( 'the function computes the sum of absolute values', function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector', function test( t ) { + var expected; + var actual; var x; - var y; - x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); - y = dzasum( x.length, x, 1 ); + x = new Complex128Array([ + 0.3, // 1 + 0.1, // 1 + 0.5, // 2 + 0.0, // 2 + 0.0, // 3 + 0.5, // 3 + 0.0, // 4 + 0.2, // 4 + 2.0, + 3.0 + ]); + expected = 1.6; + + actual = dzasum( 4, x, 1 ); + isApprox( t, actual, expected, 2.0 ); + + x = new Complex128Array([ + 0.1, // 1 + 0.1, // 1 + -0.6, // 2 + 0.1, // 2 + 0.1, // 3 + -0.3, // 3 + 7.0, + 8.0 + ]); + expected = 1.3; - t.strictEqual( y, 21.0, 'returns expected value' ); + actual = dzasum( 3, x, 1 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); -tape( 'the function supports an `x` stride', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) { + var expected; + var actual; var x; - var y; - var N; x = new Complex128Array([ - 1.0, // 1 - -2.0, // 1 + 1.0, + 2.0, + 3.0, + 4.0 + ]); + expected = 0.0; + + actual = dzasum( 0, x, 1 ); + t.strictEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array([ + 1.0, + 2.0, 3.0, - -4.0, - 5.0, // 2 - -6.0 // 2 + 4.0 ]); - N = 2; + expected = 0.0; - y = dzasum( N, x, 2 ); + actual = dzasum( -1, x, 1 ); + t.strictEqual( actual, expected, 'returns expected value' ); - t.strictEqual( y, 14.0, 'returns expected value' ); t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var actual; var x; - var y; - x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); - y = dzasum( 0, x, 1 ); + x = new Complex128Array([ + 0.3, // 1 + 0.1, // 1 + 5.0, + 8.0, + 0.5, // 2 + 0.0, // 2 + 6.0, + 9.0, + 0.0, // 3 + 0.5, // 3 + 8.0, + 3.0, + 0.0, // 4 + 0.2, // 4 + 9.0, + 4.0 + ]); + expected = 1.6; - t.strictEqual( y, 0.0, 'returns expected value' ); + actual = dzasum( 4, x, 2 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var actual; var x; - var y; - var N; x = new Complex128Array([ - 1.0, // 2 - -2.0, // 2 - 3.0, - -4.0, - 5.0, // 1 - -6.0 // 1 + 0.3, // 4 + 0.1, // 4 + 5.0, // 3 + 8.0, // 3 + 0.5, // 2 + 0.0, // 2 + 6.0, // 1 + 9.0 // 1 ]); - N = 2; - - y = dzasum( N, x, -2 ); + expected = 28.9; - t.strictEqual( y, 14.0, 'returns expected value' ); + actual = dzasum( 4, x, -1 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); tape( 'the function supports view offsets', function test( t ) { + var expected; + var actual; var x0; var x1; - var y; - var N; - // Initial array... x0 = new Complex128Array([ 1.0, - -2.0, - 3.0, // 1 - -4.0, // 1 - 5.0, // 2 - -6.0 // 2 + 2.0, + 3.0, // 1 + 4.0, // 1 + 5.0, // 2 + 6.0, // 2 + 7.0, // 3 + 8.0, // 3 + 9.0, + 10.0 ]); + expected = 33.0; - // Create an offset view... - x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element - - N = 2; - y = dzasum( N, x1, 1 ); + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - t.strictEqual( y, 18.0, 'returns expected value' ); + actual = dzasum( 3, x1, 1 ); + t.strictEqual( actual, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js index c7c4ac04005a..724163f2e8a3 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -22,14 +22,14 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var isBrowser = require( '@stdlib/assert/is-browser' ); var dzasum = require( './../lib' ); // VARIABLES // var opts = { - 'skip': IS_BROWSER + 'skip': isBrowser }; @@ -51,7 +51,7 @@ tape( 'if a native implementation is available, the main export is the native im '@stdlib/utils/try-require': tryRequire }); - t.strictEqual( dzasum, mock, 'returns expected value' ); + t.strictEqual( dzasum, mock, 'returns native implementation' ); t.end(); function tryRequire() { @@ -73,7 +73,7 @@ tape( 'if a native implementation is not available, the main export is a JavaScr '@stdlib/utils/try-require': tryRequire }); - t.strictEqual( dzasum, main, 'returns expected value' ); + t.strictEqual( dzasum, main, 'returns JavaScript implementation' ); t.end(); function tryRequire() { diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js index ac1ca0fa4b91..fa7c643dfb61 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -22,9 +22,36 @@ var tape = require( 'tape' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); var dzasum = require( './../lib/ndarray.js' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {number} actual - actual value +* @param {number} expected - expected value +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + + if ( actual === expected ) { + t.strictEqual( actual, expected, 'returns expected value' ); + } else { + delta = abs( actual - expected ); + tol = rtol * EPS * abs( expected ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual+'. expected: '+expected+'. delta: '+delta+'. tol: '+tol+'.' ); + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -38,91 +65,185 @@ tape( 'the function has an arity of 4', function test( t ) { t.end(); }); -tape( 'the function computes the sum of absolute values', function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector', function test( t ) { + var expected; + var actual; var x; - var y; - x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); - y = dzasum( x.length, x, 1, 0 ); + x = new Complex128Array([ + 0.3, // 1 + 0.1, // 1 + 0.5, // 2 + 0.0, // 2 + 0.0, // 3 + 0.5, // 3 + 0.0, // 4 + 0.2, // 4 + 2.0, + 3.0 + ]); + expected = 1.6; + + actual = dzasum( 4, x, 1, 0 ); + isApprox( t, actual, expected, 2.0 ); - t.strictEqual( y, 21.0, 'returns expected value' ); + x = new Complex128Array([ + 0.1, // 1 + 0.1, // 1 + -0.6, // 2 + 0.1, // 2 + 0.1, // 3 + -0.3, // 3 + 7.0, + 8.0 + ]); + expected = 1.3; + + actual = dzasum( 3, x, 1, 0 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); -tape( 'the function supports an `x` stride', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) { + var expected; + var actual; var x; - var y; - var N; x = new Complex128Array([ - 1.0, // 1 - -2.0, // 1 + 1.0, + 2.0, + 3.0, + 4.0 + ]); + expected = 0.0; + + actual = dzasum( 0, x, 1, 0 ); + t.strictEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array([ + 1.0, + 2.0, 3.0, - -4.0, - 5.0, // 2 - -6.0 // 2 + 4.0 ]); - N = 2; + expected = 0.0; - y = dzasum( N, x, 2, 0 ); + actual = dzasum( -1, x, 1, 0 ); + t.strictEqual( actual, expected, 'returns expected value' ); - t.strictEqual( y, 14.0, 'returns expected value' ); t.end(); }); -tape( 'the function supports an `x` offset', function test( t ) { +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var actual; var x; - var y; - var N; x = new Complex128Array([ - 1.0, - -2.0, - 3.0, // 1 - -4.0, // 1 - 5.0, // 2 - -6.0 // 2 + 0.3, // 1 + 0.1, // 1 + 5.0, + 8.0, + 0.5, // 2 + 0.0, // 2 + 6.0, + 9.0, + 0.0, // 3 + 0.5, // 3 + 8.0, + 3.0, + 0.0, // 4 + 0.2, // 4 + 9.0, + 4.0 ]); - N = 2; - - y = dzasum( N, x, 1, 1 ); + expected = 1.6; - t.strictEqual( y, 18.0, 'returns expected value' ); + actual = dzasum( 4, x, 2, 0 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { +tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var actual; var x; - var y; - x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + x = new Complex128Array([ + 0.3, // 4 + 0.1, // 4 + 5.0, // 3 + 8.0, // 3 + 0.5, // 2 + 0.0, // 2 + 6.0, // 1 + 9.0, // 1 + 0.0, + 0.5, + 8.0, + 3.0, + 0.0, + 0.2, + 9.0, + 4.0 + ]); + expected = 28.9; + + actual = dzasum( 4, x, -1, 3 ); + isApprox( t, actual, expected, 2.0 ); + t.end(); +}); - y = dzasum( -1, x, 1, 0 ); - t.strictEqual( y, 0.0, 'returns expected value' ); +tape( 'the function supports specifying an offset', function test( t ) { + var expected; + var actual; + var x; - y = dzasum( 0, x, 1, 0 ); - t.strictEqual( y, 0.0, 'returns expected value' ); + x = new Complex128Array([ + 1.0, + 2.0, + 3.0, // 1 + 4.0, // 1 + 5.0, // 2 + 6.0, // 2 + 7.0, // 3 + 8.0, // 3 + 9.0, + 10.0 + ]); + expected = 33.0; + actual = dzasum( 3, x, 1, 1 ); + t.strictEqual( actual, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports specifying a negative stride', function test( t ) { +tape( 'the function supports specifying complex access patterns', function test( t ) { + var expected; + var actual; var x; - var y; - var N; x = new Complex128Array([ - 1.0, // 2 - -2.0, // 2 + 0.3, // 4 + 0.1, // 4 + 5.0, + 8.0, + 0.5, // 3 + 0.0, // 3 + 6.0, + 9.0, + 0.0, // 2 + 0.5, // 2 + 8.0, 3.0, - -4.0, - 5.0, // 1 - -6.0 // 1 + 0.0, // 1 + 0.2, // 1 + 9.0, + 4.0 ]); - N = 2; - - y = dzasum( N, x, -2, x.length-1 ); + expected = 1.6; - t.strictEqual( y, 14.0, 'returns expected value' ); + actual = dzasum( 4, x, -2, 6 ); + isApprox( t, actual, expected, 2.0 ); t.end(); }); From 840afdcadb42bac5ef0259400129dfa3a9c9a2f7 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 26 May 2026 23:56:55 +0530 Subject: [PATCH 15/24] chore: update and cleanup for lib files --- 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 --- --- .../@stdlib/blas/base/dzasum/lib/dzasum.js | 10 +++--- .../@stdlib/blas/base/dzasum/lib/index.js | 8 ++--- .../@stdlib/blas/base/dzasum/lib/main.js | 2 +- .../@stdlib/blas/base/dzasum/lib/ndarray.js | 31 +++++++++++-------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js index bcfea6022966..bd5e994a1665 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -27,19 +27,19 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex64Array} x - input array +* @param {Complex128Array} x - input array * @param {integer} strideX - `x` stride length -* @returns {number} sum +* @returns {number} result * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); * -* var sum = dzasum( x.length, x, 1 ); +* var out = dzasum( x.length, x, 1 ); * // returns 19.0 */ function dzasum( N, x, strideX ) { diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js index 44a78a24abea..87a5cc789dff 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -19,7 +19,7 @@ 'use strict'; /** -* BLAS level 1 routine to compute the sum of absolute values of each element in a double-precision complex floating-point vector. +* BLAS level 1 routine to compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. * * @module @stdlib/blas/base/dzasum * @@ -29,7 +29,7 @@ * * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); * -* var sum = dzasum( x.length, x, 1 ); +* var out = dzasum( x.length, x, 1 ); * // returns 19.0 * * @example @@ -38,7 +38,7 @@ * * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); * -* var sum = dzasum.ndarray( x.length, x, 1, 0 ); +* var out = dzasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js index 02691681c914..1dfa09e73ab1 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js index 864d39527722..31a1e3530f4c 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -20,43 +20,48 @@ // MODULES // -var dcabs1 = require( '@stdlib/blas/base/dcabs1' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); // MAIN // /** -* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex64Array} x - input array +* @param {Complex128Array} x - input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` -* @returns {number} sum +* @returns {number} result * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); * -* var sum = dzasum( x.length, x, 1, 0 ); +* var out = dzasum( x.length, x, 1, 0 ); * // returns 19.0 */ function dzasum( N, x, strideX, offsetX ) { - var sum; + var viewX; + var stemp; var ix; + var sx; var i; - sum = 0.0; + stemp = 0.0; if ( N <= 0 ) { - return sum; + return stemp; } - ix = offsetX; + viewX = reinterpret( x, 0 ); + sx = strideX * 2; + ix = offsetX * 2; for ( i = 0; i < N; i++ ) { - sum += dcabs1( x.get( ix ) ); - ix += strideX; + stemp += abs( viewX[ ix ] ) + abs( viewX[ ix+1 ] ); + ix += sx; } - return sum; + return stemp; } From 0ff876470f337b432e7628118f17db8335d2afb1 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Wed, 27 May 2026 00:03:01 +0530 Subject: [PATCH 16/24] chore: update examples --- 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: passed - 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 --- --- .../@stdlib/blas/base/dzasum/examples/index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js index 2f0a93e5c503..d5c271b8e2c5 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -19,22 +19,17 @@ 'use strict'; var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var dzasum = require( './../lib' ); function rand() { return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -// Generate random input arrays: var x = filledarrayBy( 10, 'complex128', rand ); console.log( x.toString() ); -// Compute the sum of the absolute values of each element: +// Compute the sum of the absolute values of the real and imaginary components: var out = dzasum( x.length, x, 1 ); console.log( out ); - -// Compute the sum of the absolute values of each element using alternative indexing semantics: -out = dzasum.ndarray( x.length, x, 1, 0 ); -console.log( out ); From 874d1e6179a898d39e5144ba04505cc3efb5332d Mon Sep 17 00:00:00 2001 From: kaustubh Date: Wed, 27 May 2026 00:32:28 +0530 Subject: [PATCH 17/24] chore: update bench --- 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 --- --- .../blas/base/dzasum/benchmark/benchmark.js | 29 +++++++++---------- .../dzasum/benchmark/benchmark.ndarray.js | 29 +++++++++---------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js index 14a79ecdb1d7..b77c8efa24d6 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -25,6 +25,7 @@ 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 Complex128Array = require( '@stdlib/array/complex128' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dzasum = require( './../lib/dzasum.js' ); @@ -39,16 +40,14 @@ var options = { // FUNCTIONS // /** -* Creates a benchmark function. +* Create a benchmark function. * * @private -* @param {PositiveInteger} N - array length +* @param {PositiveInteger} len - array length * @returns {Function} benchmark function */ -function createBenchmark( N ) { - var x; - - x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) ); +function createBenchmark( len ) { + var x = new Complex128Array( uniform( len*2, -10.0, 10.0, options ) ); return benchmark; /** @@ -58,18 +57,18 @@ function createBenchmark( N ) { * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { - var y; + var out; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dzasum( x.length, x, 1 ); - if ( isnan( y ) ) { + out = dzasum( x.length, x, 1 ); + if ( isnan( out ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( y ) ) { + if ( isnan( out ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -86,9 +85,9 @@ function createBenchmark( N ) { * @private */ function main() { + var len; var min; var max; - var N; var f; var i; @@ -96,9 +95,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - N = pow( 10, i ); - f = createBenchmark( N ); - bench( pkg+':size='+N, f ); + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js index ad9098469294..adfd2d68559f 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -25,6 +25,7 @@ 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 Complex128Array = require( '@stdlib/array/complex128' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dzasum = require( './../lib/ndarray.js' ); @@ -39,16 +40,14 @@ var options = { // FUNCTIONS // /** -* Creates a benchmark function. +* Create a benchmark function. * * @private -* @param {PositiveInteger} N - array length +* @param {PositiveInteger} len - array length * @returns {Function} benchmark function */ -function createBenchmark( N ) { - var x; - - x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) ); +function createBenchmark( len ) { + var x = new Complex128Array( uniform( len*2, -10.0, 10.0, options ) ); return benchmark; /** @@ -58,18 +57,18 @@ function createBenchmark( N ) { * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { - var y; + var out; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dzasum( x.length, x, 1, 0 ); - if ( isnan( y ) ) { + out = dzasum( x.length, x, 1, 0 ); + if ( isnan( out ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( y ) ) { + if ( isnan( out ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -86,9 +85,9 @@ function createBenchmark( N ) { * @private */ function main() { + var len; var min; var max; - var N; var f; var i; @@ -96,9 +95,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - N = pow( 10, i ); - f = createBenchmark( N ); - bench( pkg+':ndarray:size='+N, f ); + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:len=%d', pkg, len ), f ); } } From dc490065881b095cb4168762423b8c2415e3dc5f Mon Sep 17 00:00:00 2001 From: kaustubh Date: Wed, 27 May 2026 00:38:37 +0530 Subject: [PATCH 18/24] chore: update documentation --- 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: passed - 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: 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dzasum/docs/repl.txt | 74 +++++++++---------- .../blas/base/dzasum/docs/types/index.d.ts | 50 ++++++------- .../blas/base/dzasum/docs/types/test.ts | 2 +- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt index 1f38f8eba558..f59bab9c2fc2 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt @@ -1,15 +1,15 @@ {{alias}}( N, x, strideX ) - Computes the sum of the absolute values of each element in a - double-precision complex floating-point vector. + Computes the sum of the absolute values of the real and imaginary components + of a double-precision complex floating-point vector. - The `N` and `strideX` parameters determine which elements in `x` are used - to compute the sum. + The `N` and stride parameters determine which elements in the strided array + are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N` is less than or equal to `0`, the function returns `0`. + If `N <= 0`, the function returns `0.0`. Parameters ---------- @@ -20,40 +20,40 @@ Input array. strideX: integer - Index increment. + Index increment for `x`. Returns ------- - sum: number - Sum of absolute values. + out: number + Result. Examples -------- - // Standard usage: - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ]); - > var s = {{alias}}( x.length, x, 1 ) - 11.0 - - // Advanced indexing: - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); - > s = {{alias}}( 2, x, 2 ) - 7.0 + // Standard Usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 ] ); + > var out = {{alias}}( 4, x, 1 ) + ~1.6 + + // Using `N` and stride parameters: + > x = new {{alias:@stdlib/array/complex128}}( [ 3.0, -4.0, 0.0, 0.0, 5.0, -6.0 ] ); + > out = {{alias}}( 2, x, 2 ) + 18.0 - // Using typed array views: + // Using view offsets: > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > s = {{alias}}( 2, x1, 1 ) + > out = {{alias}}( 2, x1, 1 ) 18.0 {{alias}}.ndarray( N, x, strideX, offsetX ) - Computes the sum of the absolute values of each element in a - double-precision complex floating-point vector using alternative indexing - semantics. + Computes the sum of the absolute values of the real and imaginary components + of a double-precision complex floating-point vector using alternative + indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offsetX` parameter supports indexing semantics based on a - starting index. + buffer, the offset parameter supports indexing semantics based on a starting + index. Parameters ---------- @@ -64,27 +64,27 @@ Input array. strideX: integer - Index increment. + Index increment for `x`. offsetX: integer - Starting index. + Starting index of `x`. Returns ------- - sum: number - Sum of absolute values. + out: number + Result. Examples -------- - // Standard usage: - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ] ); - > var s = {{alias}}.ndarray( x.length, x, 1, 0 ) - 11.0 - - // Advanced indexing: - > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); - > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) - 33.0 + // Standard Usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 3.0, -4.0, 0.0, 0.0, 5.0, -6.0 ] ); + > var out = {{alias}}.ndarray( 2, x, 2, 0 ) + 18.0 + + // Using an index offset: + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + > out = {{alias}}.ndarray( 2, x, 1, 1 ) + 18.0 See Also -------- diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts index f5679e6c8f85..50f48b3f97c0 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -27,66 +27,66 @@ import { Complex128Array } from '@stdlib/types/array'; */ interface Routine { /** - * Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. + * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length - * @returns sum of absolute values + * @param strideX - `x` stride length + * @returns out * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * - * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + * var x = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2, 2.0, 3.0 ] ); * - * var sum = dzasum( x.length, x, 1 ); - * // returns 19.0 + * var out = dzasum( 5, x, 1 ); + * // returns ~6.6 */ - ( N: number, x: Complex128Array, stride: number ): number; + ( N: number, x: Complex128Array, strideX: number ): number; /** - * Computes the sum of the absolute values of each element in a double-precision complex floating-point vector using alternative indexing semantics. + * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector using alternative indexing semantics. * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length - * @param offsetX - starting index - * @returns sum of absolute values + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @returns out * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * - * var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + * var x = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2, 2.0, 3.0 ] ); * - * var z = dzasum.ndarray( x.length, x, 1, 0 ); - * // returns 19.0 + * var out = dzasum.ndarray( 5, x, 1, 0 ); + * // returns ~6.6 */ - ndarray( N: number, x: Complex128Array, stride: number, offsetX: number ): number; + ndarray( N: number, x: Complex128Array, strideX: number, offsetX: number ): number; } /** -* Computes the sum of the absolute values of each element in a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. * * @param N - number of indexed elements * @param x - input array -* @param stride - stride length -* @returns sum of absolute values +* @param strideX - `x` stride length +* @returns out * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * -* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* var x = new Complex128Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); * -* var sum = dzasum( x.length, x, 1 ); -* // returns 19.0 +* var out = dzasum( 4, x, 2 ); +* // returns ~1.6 * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * -* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* var x = new Complex128Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); * -* var z = dzasum.ndarray( x.length, x, 1, 0 ); -* // returns 19.0 +* var out = dzasum.ndarray( 4, x, 2, 0 ); +* // returns ~1.6 */ declare var dzasum: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts index 16f905048756..7d25b9f4dfd7 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. From c19837b9c280f7f7636a2dfdf45cc0b1a9b9f09c Mon Sep 17 00:00:00 2001 From: kaustubh Date: Wed, 27 May 2026 01:29:07 +0530 Subject: [PATCH 19/24] chore: final docs changes --- 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: 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 --- --- .../@stdlib/blas/base/dzasum/README.md | 45 +++++-------------- .../@stdlib/blas/base/dzasum/lib/dzasum.js | 4 +- .../@stdlib/blas/base/dzasum/lib/ndarray.js | 4 +- 3 files changed, 16 insertions(+), 37 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index 3476e58e61fd..c09e1bc4a991 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -22,27 +22,6 @@ limitations under the License. > Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. -
- -dzasum is defined as - - - -```math -\|\mathbf{x}\|_1 = \sum_{i=0}^{n-1} \left( |a_i| + |b_i| \right) -``` - - - - - -
- - -
## Usage @@ -58,10 +37,10 @@ Computes the sum of the absolute values of the real and imaginary components of ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); -var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +var x = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 ] ); -var out = dzasum( x.length, x, 1 ); -// returns 19.0 +var out = dzasum( 4, x, 1 ); +// returns ~1.6 ``` The function has the following parameters: @@ -87,14 +66,14 @@ Note that indexing is relative to the first index. To introduce an offset, use [ var Complex128Array = require( '@stdlib/array/complex128' ); // Initial array: -var x0 = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); +var x0 = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); // Create an offset view: var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element // Compute the sum of absolute values: -var out = dzasum( 2, x1, 2 ); -// returns 22.0 +var out = dzasum( 2, x1, 1 ); +// returns 18.0 ``` #### dzasum.ndarray( N, x, strideX, offsetX ) @@ -104,10 +83,10 @@ Computes the sum of the absolute values of the real and imaginary components of ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); -var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +var x = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 ] ); -var out = dzasum.ndarray( x.length, x, 1, 0 ); -// returns 19.0 +var out = dzasum.ndarray( 4, x, 1, 0 ); +// returns ~1.6 ``` The function has the following additional parameters: @@ -119,10 +98,10 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); -var x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); +var x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); -var out = dzasum.ndarray( 3, x, 1, 1 ); -// returns 33.0 +var out = dzasum.ndarray( 2, x, 1, 1 ); +// returns 18.0 ```
diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js index bd5e994a1665..c5526813612b 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js @@ -37,10 +37,10 @@ var ndarray = require( './ndarray.js' ); * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * -* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* var x = new Complex128Array( [ 5.0, -3.0, 6.0, 4.0 ] ); * * var out = dzasum( x.length, x, 1 ); -* // returns 19.0 +* // returns 18.0 */ function dzasum( N, x, strideX ) { var ox = stride2offset( N, strideX ); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js index 31a1e3530f4c..73ca9246aacb 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js @@ -38,10 +38,10 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * -* var x = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* var x = new Complex128Array( [ 5.0, -3.0, 6.0, 4.0 ] ); * * var out = dzasum( x.length, x, 1, 0 ); -* // returns 19.0 +* // returns 18.0 */ function dzasum( N, x, strideX, offsetX ) { var viewX; From d53c798a3d244d13f12e85169f9439d68033ce04 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 27 May 2026 00:59:48 -0700 Subject: [PATCH 20/24] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/base/dzasum/docs/types/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts index 50f48b3f97c0..ef180abff562 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts @@ -31,8 +31,8 @@ interface Routine { * * @param N - number of indexed elements * @param x - input array - * @param strideX - `x` stride length - * @returns out + * @param strideX - stride length + * @returns sum * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); @@ -49,9 +49,9 @@ interface Routine { * * @param N - number of indexed elements * @param x - input array - * @param strideX - `x` stride length - * @param offsetX - starting index for `x` - * @returns out + * @param strideX - stride length + * @param offsetX - starting index + * @returns sum * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); @@ -69,7 +69,7 @@ interface Routine { * * @param N - number of indexed elements * @param x - input array -* @param strideX - `x` stride length +* @param strideX - stride length * @returns out * * @example From 469533d34a0786b83de44f7dec3275adec3de6c4 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 27 May 2026 01:01:28 -0700 Subject: [PATCH 21/24] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt index f59bab9c2fc2..4fddea849ae2 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt @@ -20,7 +20,7 @@ Input array. strideX: integer - Index increment for `x`. + Stride length. Returns ------- @@ -64,10 +64,10 @@ Input array. strideX: integer - Index increment for `x`. + Stride length. offsetX: integer - Starting index of `x`. + Starting index. Returns ------- From c3618029ec1e9894735518a874e1c9a6a7ea2cd2 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 27 May 2026 01:09:40 -0700 Subject: [PATCH 22/24] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dzasum/README.md | 8 ++++---- lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt | 4 ++-- .../@stdlib/blas/base/dzasum/docs/types/index.d.ts | 6 +++--- lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js | 4 ++-- lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js | 6 +++--- .../@stdlib/blas/base/dzasum/test/test.dzasum.js | 4 ++-- .../@stdlib/blas/base/dzasum/test/test.ndarray.js | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index c09e1bc4a991..a3d10cd152da 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -20,7 +20,7 @@ limitations under the License. # dzasum -> Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +> Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array.
@@ -32,7 +32,7 @@ var dzasum = require( '@stdlib/blas/base/dzasum' ); #### dzasum( N, x, strideX ) -Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -47,7 +47,7 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Complex128Array`][@stdlib/array/complex128]. -- **strideX**: index increment for `x`. +- **strideX**: stride length. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to traverse every other value, @@ -78,7 +78,7 @@ var out = dzasum( 2, x1, 1 ); #### dzasum.ndarray( N, x, strideX, offsetX ) -Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector using alternative indexing semantics. +Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array using alternative indexing semantics. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt index 4fddea849ae2..e389ed150653 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( N, x, strideX ) Computes the sum of the absolute values of the real and imaginary components - of a double-precision complex floating-point vector. + of a double-precision complex floating-point strided array. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. @@ -48,7 +48,7 @@ {{alias}}.ndarray( N, x, strideX, offsetX ) Computes the sum of the absolute values of the real and imaginary components - of a double-precision complex floating-point vector using alternative + of a double-precision complex floating-point strided array using alternative indexing semantics. While typed array views mandate a view offset based on the underlying diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts index ef180abff562..0d988db3f3ce 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/dzasum/docs/types/index.d.ts @@ -27,7 +27,7 @@ import { Complex128Array } from '@stdlib/types/array'; */ interface Routine { /** - * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. + * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. * * @param N - number of indexed elements * @param x - input array @@ -45,7 +45,7 @@ interface Routine { ( N: number, x: Complex128Array, strideX: number ): number; /** - * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector using alternative indexing semantics. + * Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array using alternative indexing semantics. * * @param N - number of indexed elements * @param x - input array @@ -65,7 +65,7 @@ interface Routine { } /** -* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. * * @param N - number of indexed elements * @param x - input array diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js index c5526813612b..607cb6661754 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/dzasum.js @@ -27,11 +27,11 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. * * @param {PositiveInteger} N - number of indexed elements * @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length +* @param {integer} strideX - stride length * @returns {number} result * * @example diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js index 87a5cc789dff..42e9699f9541 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* BLAS level 1 routine to compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +* BLAS level 1 routine to compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. * * @module @stdlib/blas/base/dzasum * diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js index 73ca9246aacb..235d1050425a 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/lib/ndarray.js @@ -27,12 +27,12 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); // MAIN // /** -* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector. +* Computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array. * * @param {PositiveInteger} N - number of indexed elements * @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length -* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index * @returns {number} result * * @example diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js index 0ad9a1872407..bfefd7a1caca 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.dzasum.js @@ -65,7 +65,7 @@ tape( 'the function has an arity of 3', function test( t ) { t.end(); }); -tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector', function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array', function test( t ) { var expected; var actual; var x; @@ -177,7 +177,7 @@ tape( 'the function supports specifying a negative stride', function test( t ) { 0.5, // 2 0.0, // 2 6.0, // 1 - 9.0 // 1 + 9.0 // 1 ]); expected = 28.9; diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js index fa7c643dfb61..d3009e10153c 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dzasum/test/test.ndarray.js @@ -65,7 +65,7 @@ tape( 'the function has an arity of 4', function test( t ) { t.end(); }); -tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector', function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array', function test( t ) { var expected; var actual; var x; From 46ee2fdef7b6134805418705a123b18a6846a9c7 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 27 May 2026 01:22:35 -0700 Subject: [PATCH 23/24] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dzasum/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/package.json b/lib/node_modules/@stdlib/blas/base/dzasum/package.json index f32d1a9a3c20..8b570d5bc94b 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/package.json +++ b/lib/node_modules/@stdlib/blas/base/dzasum/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/dzasum", "version": "0.0.0", - "description": "Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point vector.", + "description": "Compute the sum of the absolute values of the real and imaginary components of a double-precision complex floating-point strided array.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From 877619b67c25ef626905f98bdfe5ed04522d7140 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 27 May 2026 01:24:18 -0700 Subject: [PATCH 24/24] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dzasum/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dzasum/README.md b/lib/node_modules/@stdlib/blas/base/dzasum/README.md index a3d10cd152da..63ca6c05d191 100644 --- a/lib/node_modules/@stdlib/blas/base/dzasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dzasum/README.md @@ -93,7 +93,7 @@ The function has the following additional parameters: - **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to start from the second index, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to start from the second element ```javascript var Complex128Array = require( '@stdlib/array/complex128' );