From 21290f0cbb4bbf062689b2f36d9f4518373e5559 Mon Sep 17 00:00:00 2001 From: iampratik13 Date: Mon, 18 May 2026 00:28:00 +0530 Subject: [PATCH 1/8] feat: add lapack/base/dlaisnan --- 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: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dlaisnan/README.md | 182 ++++++++++++++++++ .../base/dlaisnan/benchmark/benchmark.js | 56 ++++++ .../lapack/base/dlaisnan/docs/repl.txt | 29 +++ .../base/dlaisnan/docs/types/index.d.ts | 41 ++++ .../lapack/base/dlaisnan/docs/types/test.ts | 56 ++++++ .../lapack/base/dlaisnan/examples/index.js | 31 +++ .../@stdlib/lapack/base/dlaisnan/lib/index.js | 43 +++++ .../@stdlib/lapack/base/dlaisnan/lib/main.js | 53 +++++ .../@stdlib/lapack/base/dlaisnan/package.json | 69 +++++++ .../@stdlib/lapack/base/dlaisnan/test/test.js | 112 +++++++++++ 10 files changed, 672 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md new file mode 100644 index 000000000000..393748872f67 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md @@ -0,0 +1,182 @@ + + +# dlaisnan + +> LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. + +
+ +## Usage + +```javascript +var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); +``` + +#### dlaisnan( DIN1, DIN2 ) + +Tests whether two double-precision floating-point arguments are unequal and thus at least one is NaN. + +```javascript +var bool = dlaisnan( NaN, NaN ); +// returns true + +bool = dlaisnan( NaN, 5.0 ); +// returns true + +bool = dlaisnan( 5.0, 5.0 ); +// returns false +``` + +The function has the following parameters: + +- **DIN1**: first number to compare. +- **DIN2**: second number to compare. + +
+ + + +
+ +## Notes + +- `dlaisnan()` corresponds to the [LAPACK][LAPACK] auxiliary routine [`dlaisnan`][lapack-dlaisnan]. +- This routine is not for general use. It exists solely to avoid over-optimization in `disnan`. +- `dlaisnan` checks for NaNs by comparing its two arguments for inequality. `NaN` is the only floating-point value where `NaN != NaN` returns `true`. To check for NaNs, pass the same variable as both arguments (i.e., `dlaisnan( x, x )`). +- The function returns `true` whenever the two arguments are unequal, not only when one is NaN. This matches the Fortran reference implementation which simply returns `DIN1.NE.DIN2`. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); + +var opts = { + 'dtype': 'float64' +}; +var x = discreteUniform( 100, -50, 50, opts ); +var y = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js new file mode 100644 index 000000000000..139e57cbce9e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js @@ -0,0 +1,56 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var pkg = require( './../package.json' ).name; +var dlaisnan = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var len; + var x; + var y; + var z; + var i; + + len = 100; + x = uniform( len, -50, 50 ); + y = uniform( len, -50, 50 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dlaisnan( x[ i % len ], y[ i % len ] ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt new file mode 100644 index 000000000000..1439c27f77f5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( DIN1, DIN2 ) + Tests whether two double-precision floating-point arguments are unequal + and thus at least one is NaN. + + Parameters + ---------- + DIN1: number + First number to compare. + + DIN2: number + Second number to compare. + + Returns + ------- + bool: boolean + Boolean indicating whether the arguments are unequal. + + Examples + -------- + > var bool = {{alias}}( NaN, NaN ) + true + > bool = {{alias}}( NaN, 5.0 ) + true + > bool = {{alias}}( 5.0, 5.0 ) + false + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts new file mode 100644 index 000000000000..37e6ce02c48b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @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 + +/** +* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. +* +* @param DIN1 - first number to compare +* @param DIN2 - second number to compare +* @returns boolean indicating whether the arguments are unequal +* +* @example +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* @example +* var bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ +declare function dlaisnan( DIN1: number, DIN2: number ): boolean; + + +// EXPORTS // + +export = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts new file mode 100644 index 000000000000..cd6aeeaf8a13 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts @@ -0,0 +1,56 @@ +/* +* @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. +*/ + +import dlaisnan = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + dlaisnan( 8, 2 ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided values other than two numbers... +{ + dlaisnan( true, 3 ); // $ExpectError + dlaisnan( false, 2 ); // $ExpectError + dlaisnan( '5', 1 ); // $ExpectError + dlaisnan( [], 1 ); // $ExpectError + dlaisnan( {}, 2 ); // $ExpectError + dlaisnan( ( x: number ): number => x, 2 ); // $ExpectError + + dlaisnan( 9, true ); // $ExpectError + dlaisnan( 9, false ); // $ExpectError + dlaisnan( 5, '5' ); // $ExpectError + dlaisnan( 8, [] ); // $ExpectError + dlaisnan( 9, {} ); // $ExpectError + dlaisnan( 8, ( x: number ): number => x ); // $ExpectError + + dlaisnan( [], true ); // $ExpectError + dlaisnan( {}, false ); // $ExpectError + dlaisnan( false, '5' ); // $ExpectError + dlaisnan( {}, [] ); // $ExpectError + dlaisnan( '5', ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + dlaisnan(); // $ExpectError + dlaisnan( 3 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js new file mode 100644 index 000000000000..c3a8f779cb97 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js @@ -0,0 +1,31 @@ +/** +* @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/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dlaisnan = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var x = discreteUniform( 100, -50, 50, opts ); +var y = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js new file mode 100644 index 000000000000..b1c3e7475eb7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js @@ -0,0 +1,43 @@ +/** +* @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'; + +/** +* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. +* +* @module @stdlib/lapack/base/dlaisnan +* +* @example +* var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); +* +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js new file mode 100644 index 000000000000..c769bf0e928b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.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'; + +// MAIN // + +/** +* Tests whether two double-precision floating-point arguments are unequal and thus at least one is NaN. +* +* ## Notes +* +* - This routine exists solely to avoid over-optimization in DISNAN. +* +* @param {number} DIN1 - first number to compare +* @param {number} DIN2 - second number to compare +* @returns {boolean} boolean indicating whether the arguments are unequal +* +* @example +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* @example +* var bool = dlaisnan( NaN, 5.0 ); +* // returns true +* +* @example +* var bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ +function dlaisnan( DIN1, DIN2 ) { + return ( DIN1 !== DIN2 ); +} + + +// EXPORTS // + +module.exports = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json new file mode 100644 index 000000000000..a68cc4f91474 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dlaisnan", + "version": "0.0.0", + "description": "LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dlaisnan", + "nan", + "isnan", + "test", + "inequality", + "linear", + "algebra", + "subroutines", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js new file mode 100644 index 000000000000..9bab475e82d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js @@ -0,0 +1,112 @@ +/** +* @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 PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var dlaisnan = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlaisnan, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 2', function test( t ) { + t.strictEqual( dlaisnan.length, 2, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `true` when either argument is NaN', function test( t ) { + var bool; + + bool = dlaisnan( NaN, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, 5.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 5.0, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, 0.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 0.0, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, PINF ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NINF, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` when both arguments are equal non-NaN values', function test( t ) { + var bool; + + bool = dlaisnan( 5.0, 5.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( 0.0, 0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -0.0, -0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -0.0, 0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( PINF, PINF ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( NINF, NINF ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -3.14, -3.14 ); + t.strictEqual( bool, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `true` when both arguments are unequal non-NaN values', function test( t ) { + var bool; + + bool = dlaisnan( 1.0, 2.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( -1.0, 1.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( PINF, NINF ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 0.0, 1.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + t.end(); +}); From 4f70f76a6dae6d266c79057d1fecca0402b6e84e Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sun, 17 May 2026 19:09:37 +0000 Subject: [PATCH 2/8] chore: update copyright years --- lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md | 2 +- .../@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js | 2 +- .../@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts | 2 +- .../@stdlib/lapack/base/dlaisnan/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js | 2 +- lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js | 2 +- lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js | 2 +- lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md index 393748872f67..7cfc45537702 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js index 139e57cbce9e..bb1b9da587ef 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts index 37e6ce02c48b..6467c096498c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts index cd6aeeaf8a13..8115794c5bfa 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js index c3a8f779cb97..92e8b0037ed0 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js index b1c3e7475eb7..07197a771143 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js index c769bf0e928b..48fd6c7ccd20 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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/lapack/base/dlaisnan/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js index 9bab475e82d0..08c9d58bbf96 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/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. From 9e4bf55db67bc86212f3fb71d8606d67dd1cf3b5 Mon Sep 17 00:00:00 2001 From: iampratik13 Date: Tue, 19 May 2026 19:44:55 +0530 Subject: [PATCH 3/8] chore: suggested 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 status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - 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/lapack/base/dlaisnan/README.md | 16 ++++++----- .../base/dlaisnan/benchmark/benchmark.js | 10 +++---- .../lapack/base/dlaisnan/docs/repl.txt | 8 +++--- .../base/dlaisnan/docs/types/index.d.ts | 4 +-- .../@stdlib/lapack/base/dlaisnan/lib/main.js | 8 +++--- .../@stdlib/lapack/base/dlaisnan/test/test.js | 27 +++++++++++++++++++ 6 files changed, 51 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md index 7cfc45537702..a32875fbc032 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md @@ -32,7 +32,7 @@ var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); #### dlaisnan( DIN1, DIN2 ) -Tests whether two double-precision floating-point arguments are unequal and thus at least one is NaN. +Tests input for NaN by comparing two double-precision floating-point arguments for inequality. ```javascript var bool = dlaisnan( NaN, NaN ); @@ -47,8 +47,8 @@ bool = dlaisnan( 5.0, 5.0 ); The function has the following parameters: -- **DIN1**: first number to compare. -- **DIN2**: second number to compare. +- **DIN1**: first input number. +- **DIN2**: second input number. @@ -58,10 +58,10 @@ The function has the following parameters: ## Notes -- `dlaisnan()` corresponds to the [LAPACK][LAPACK] auxiliary routine [`dlaisnan`][lapack-dlaisnan]. -- This routine is not for general use. It exists solely to avoid over-optimization in `disnan`. -- `dlaisnan` checks for NaNs by comparing its two arguments for inequality. `NaN` is the only floating-point value where `NaN != NaN` returns `true`. To check for NaNs, pass the same variable as both arguments (i.e., `dlaisnan( x, x )`). -- The function returns `true` whenever the two arguments are unequal, not only when one is NaN. This matches the Fortran reference implementation which simply returns `DIN1.NE.DIN2`. +- `dlaisnan()` corresponds to the [LAPACK][lapack] auxiliary routine [`dlaisnan`][lapack-dlaisnan]. +- This routine is not for general use. It exists solely to avoid over-optimization in [`disnan`][lapack-disnan]. +- `dlaisnan` checks for NaNs by comparing its two arguments for inequality. `NaN` is the only floating-point value where `NaN !== NaN` returns `true`. To check for NaNs, pass the same variable as both arguments (i.e., `dlaisnan( x, x )`). +- The function returns `true` whenever the two arguments are unequal, not only when one is `NaN`. This matches the Fortran reference implementation which simply returns `DIN1.NE.DIN2`. @@ -177,6 +177,8 @@ TODO [lapack-dlaisnan]: https://www.netlib.org/lapack/explore-html/d3/d22/group__laisnan_gad49d1fe3d6890e9c4f60e0429abab3c9.html +[lapack-disnan]: https://www.netlib.org/lapack/explore-html/d0/d4c/group__isnan_ga7aa3164d5df8d883754b0a70e9c7209c.html + diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js index bb1b9da587ef..5e2eb4b29344 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js @@ -21,8 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); var uniform = require( '@stdlib/random/array/uniform' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pkg = require( './../package.json' ).name; var dlaisnan = require( './../lib' ); @@ -43,13 +43,13 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { z = dlaisnan( x[ i % len ], y[ i % len ] ); - if ( isnan( z ) ) { - b.fail( 'should not return NaN' ); + if ( typeof z !== 'boolean' ) { + b.fail( 'should return a boolean' ); } } b.toc(); - if ( isnan( z ) ) { - b.fail( 'should not return NaN' ); + if ( !isBoolean( z ) ) { + b.fail( 'should return a boolean' ); } b.pass( 'benchmark finished' ); b.end(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt index 1439c27f77f5..5553849e3739 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt @@ -1,15 +1,15 @@ {{alias}}( DIN1, DIN2 ) - Tests whether two double-precision floating-point arguments are unequal - and thus at least one is NaN. + Tests input for NaN by comparing two double-precision floating-point + arguments for inequality. Parameters ---------- DIN1: number - First number to compare. + First input number. DIN2: number - Second number to compare. + Second input number. Returns ------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts index 6467c096498c..def43c8a45da 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts @@ -21,8 +21,8 @@ /** * LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. * -* @param DIN1 - first number to compare -* @param DIN2 - second number to compare +* @param DIN1 - first input number +* @param DIN2 - second input number * @returns boolean indicating whether the arguments are unequal * * @example diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js index 48fd6c7ccd20..6ecbad7ad343 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js @@ -21,14 +21,14 @@ // MAIN // /** -* Tests whether two double-precision floating-point arguments are unequal and thus at least one is NaN. +* Tests input for NaN by comparing two double-precision floating-point arguments for inequality. * * ## Notes * -* - This routine exists solely to avoid over-optimization in DISNAN. +* - This routine exists solely to avoid over-optimization in `disnan`. * -* @param {number} DIN1 - first number to compare -* @param {number} DIN2 - second number to compare +* @param {number} DIN1 - first input number +* @param {number} DIN2 - second input number * @returns {boolean} boolean indicating whether the arguments are unequal * * @example diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js index 08c9d58bbf96..d63c400ae447 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js @@ -110,3 +110,30 @@ tape( 'the function returns `true` when both arguments are unequal non-NaN value t.end(); }); + +tape( 'the function returns expected values when passed the same variable as both arguments', function test( t ) { + var bool; + var x; + + x = NaN; + bool = dlaisnan( x, x ); + t.strictEqual( bool, true, 'returns expected value' ); + + x = 5.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = 0.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = -0.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = PINF; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + t.end(); +}); From f579524cb908190f402766573ddf8a2519d00a06 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 20 May 2026 07:39:06 -0700 Subject: [PATCH 4/8] chore: remove redundant keyword --- 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/lapack/base/dlaisnan/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json index a68cc4f91474..bec346c5109f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json @@ -63,7 +63,6 @@ "algebra", "subroutines", "float64", - "double", - "float64array" + "double" ] } From 8fac49a1047357368e30c85f7c5b36fc5cafe1a5 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 20 May 2026 07:49:07 -0700 Subject: [PATCH 5/8] docs: keep consistent examples across 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts | 4 ++++ lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts index def43c8a45da..a42bafe5bfe6 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts @@ -30,6 +30,10 @@ * // returns true * * @example +* var bool = dlaisnan( NaN, 5.0 ); +* // returns true +* +* @example * var bool = dlaisnan( 5.0, 5.0 ); * // returns false */ diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js index 07197a771143..ba21fca5cdb5 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js @@ -29,6 +29,9 @@ * var bool = dlaisnan( NaN, NaN ); * // returns true * +* bool = dlaisnan( NaN, 5.0 ); +* // returns true +* * bool = dlaisnan( 5.0, 5.0 ); * // returns false */ From 63f316be2244c9a9111ddb942e7eed13af320fed Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 21 May 2026 23:26:03 -0700 Subject: [PATCH 6/8] feat: add `blas/ext/base/capx` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - 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/ext/base/capx/README.md | 322 ++++++++++++++++++ .../blas/ext/base/capx/benchmark/benchmark.js | 112 ++++++ .../base/capx/benchmark/benchmark.native.js | 117 +++++++ .../base/capx/benchmark/benchmark.ndarray.js | 112 ++++++ .../benchmark/benchmark.ndarray.native.js | 117 +++++++ .../blas/ext/base/capx/benchmark/c/Makefile | 146 ++++++++ .../base/capx/benchmark/c/benchmark.length.c | 204 +++++++++++ .../@stdlib/blas/ext/base/capx/binding.gyp | 170 +++++++++ .../@stdlib/blas/ext/base/capx/docs/repl.txt | 110 ++++++ .../blas/ext/base/capx/docs/types/index.d.ts | 112 ++++++ .../blas/ext/base/capx/docs/types/test.ts | 202 +++++++++++ .../blas/ext/base/capx/examples/c/Makefile | 146 ++++++++ .../blas/ext/base/capx/examples/c/example.c | 50 +++ .../blas/ext/base/capx/examples/index.js | 33 ++ .../@stdlib/blas/ext/base/capx/include.gypi | 53 +++ .../capx/include/stdlib/blas/ext/base/capx.h | 46 +++ .../@stdlib/blas/ext/base/capx/lib/capx.js | 56 +++ .../blas/ext/base/capx/lib/capx.native.js | 58 ++++ .../@stdlib/blas/ext/base/capx/lib/index.js | 74 ++++ .../@stdlib/blas/ext/base/capx/lib/main.js | 35 ++ .../@stdlib/blas/ext/base/capx/lib/native.js | 35 ++ .../@stdlib/blas/ext/base/capx/lib/ndarray.js | 118 +++++++ .../blas/ext/base/capx/lib/ndarray.native.js | 59 ++++ .../@stdlib/blas/ext/base/capx/manifest.json | 91 +++++ .../@stdlib/blas/ext/base/capx/package.json | 78 +++++ .../@stdlib/blas/ext/base/capx/src/Makefile | 70 ++++ .../@stdlib/blas/ext/base/capx/src/addon.c | 64 ++++ .../@stdlib/blas/ext/base/capx/src/main.c | 102 ++++++ .../blas/ext/base/capx/test/test.capx.js | 261 ++++++++++++++ .../ext/base/capx/test/test.capx.native.js | 270 +++++++++++++++ .../@stdlib/blas/ext/base/capx/test/test.js | 82 +++++ .../blas/ext/base/capx/test/test.ndarray.js | 266 +++++++++++++++ .../ext/base/capx/test/test.ndarray.native.js | 275 +++++++++++++++ 33 files changed, 4046 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/include/stdlib/blas/ext/base/capx.h create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/capx.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/capx.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/README.md b/lib/node_modules/@stdlib/blas/ext/base/capx/README.md new file mode 100644 index 000000000000..924154d960b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/README.md @@ -0,0 +1,322 @@ + + +# capx + +> Add a scalar constant to each element in a single-precision complex floating-point strided array. + +
+ +## Usage + +```javascript +var capx = require( '@stdlib/blas/ext/base/capx' ); +``` + +#### capx( N, alpha, x, strideX ) + +Adds a scalar constant to each element in a single-precision complex floating-point strided array. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var alpha = new Complex64( 5.0, 0.0 ); + +capx( x.length, alpha, x, 1 ); +// x => [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **alpha**: scalar constant. +- **x**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: stride length. + +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element: + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var alpha = new Complex64( 5.0, 0.0 ); + +capx( 3, alpha, x, 2 ); +// x => [ 3.0, 1.0, 3.0, -5.0, 9.0, 0.0, -1.0, -3.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +// Initial array: +var x0 = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + +// Create an offset view: +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Define a scalar constant: +var alpha = new Complex64( 5.0, 0.0 ); + +// Add a constant to every other element: +capx( 2, alpha, x1, 2 ); +// x0 => [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] +``` + +#### capx.ndarray( N, alpha, x, strideX, offsetX ) + +Adds a scalar constant to each element in a single-precision complex floating-point strided array using alternative indexing semantics. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var alpha = new Complex64( 5.0, 0.0 ); + +capx.ndarray( x.length, alpha, x, 1, 0 ); +// x => [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] +``` + +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 access only the last two elements of the strided array: + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var x = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + +var alpha = new Complex64( 5.0, 0.0 ); + +capx.ndarray( 3, alpha, x, 2, 1 ); +// x => [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return the strided array unchanged. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var capx = require( '@stdlib/blas/ext/base/capx' ); + +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float32' +}); +var x = new Complex64Array( xbuf.buffer ); +var alpha = new Complex64( 10.0, 10.0 ); + +capx( x.length, alpha, x, 1 ); +console.log( x.get( 0 ).toString() ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/capx.h" +``` + +#### stdlib_strided_capx( N, alpha, \*X, strideX ) + +Adds a scalar constant to each element in a single-precision complex floating-point strided array. + +```c +#include "stdlib/complex/float32/ctor.h" + +float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; +const stdlib_complex64_t alpha = stdlib_complex64( 5.0f, 0.0f ); + +stdlib_strided_capx( 2, alpha, (stdlib_complex64_t *)x, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stdlib_complex64_t` scalar constant. +- **X**: `[inout] stdlib_complex64_t*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. + +```c +void stdlib_strided_capx( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX ); +``` + +#### stdlib_strided_capx_ndarray( N, alpha, \*X, strideX, offsetX ) + +Adds a scalar constant to each element in a single-precision complex floating-point strided array using alternative indexing semantics. + +```c +#include "stdlib/complex/float32/ctor.h" + +float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; +const stdlib_complex64_t alpha = stdlib_complex64( 5.0f, 0.0f ); + +stdlib_strided_capx_ndarray( 4, alpha, (stdlib_complex64_t *)x, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stdlib_complex64_t` scalar constant. +- **X**: `[inout] stdlib_complex64_t*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +void stdlib_strided_capx_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/capx.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include + +int main( void ) { + // Create a strided array: + stdlib_complex64_t x[] = { + stdlib_complex64( 1.0f, -2.0f ), + stdlib_complex64( 3.0f, -4.0f ), + stdlib_complex64( 5.0f, -6.0f ), + stdlib_complex64( 7.0f, -8.0f ) + }; + + // Specify the number of indexed elements: + const int N = 4; + + // Specify a stride: + const int strideX = 1; + + // Scalar constant: + stdlib_complex64_t alpha = stdlib_complex64( 5.0f, 0.0f ); + + // Add a constant to each element: + stdlib_strided_capx( N, alpha, x, strideX ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "x[ %i ] = %f + %fi\n", i, stdlib_complex64_real( x[ i ] ), stdlib_complex64_imag( x[ i ] ) ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.js new file mode 100644 index 000000000000..b26a48153aa7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var capx = require( './../lib/capx.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var x; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + + alpha = new Complex64( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + capx( x.length, alpha, x, 1 ); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + 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( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.native.js new file mode 100644 index 000000000000..6e9afa28e18c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.native.js @@ -0,0 +1,117 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var capx = tryRequire( resolve( __dirname, './../lib/capx.native.js' ) ); +var opts = { + 'skip': ( capx instanceof Error ) +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var x; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + + alpha = new Complex64( 1.01, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + capx( x.length, alpha, x, 1 ); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + 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( format( '%s::native:len=%d', pkg, len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..3782f2a1cf6a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var capx = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var x; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + + alpha = new Complex64( 1.01, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + capx( x.length, alpha, x, 1, 0 ); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + 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( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..b82f5b22586f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,117 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var capx = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( capx instanceof Error ) +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var x; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + + alpha = new Complex64( 1.01, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + capx( x.length, alpha, x, 1, 0 ); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( xbuf[ i%(len*2) ] ) ) { + 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( format( '%s::native:ndarray:len=%d', pkg, len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/Makefile new file mode 100644 index 000000000000..0756dc7da20a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..01546e32de78 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/benchmark/c/benchmark.length.c @@ -0,0 +1,204 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/capx.h" +#include "stdlib/complex/float32/ctor.h" +#include +#include +#include +#include +#include + +#define NAME "capx" +#define ITERATIONS 10000000 +#define REPEATS 3 +#define MIN 1 +#define MAX 6 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param iterations number of iterations +* @param elapsed elapsed time in seconds +*/ +static void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", iterations ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [min,max). +* +* @param min minimum value (inclusive) +* @param max maximum value (exclusive) +* @return random number +*/ +static float random_uniform( const float min, const float max ) { + float v = (float)rand() / ( (float)RAND_MAX + 1.0f ); + return min + ( v*(max-min) ); +} + +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark1( int iterations, int len ) { + stdlib_complex64_t alpha; + double elapsed; + double t; + float *x; + int i; + + x = (float *)malloc( len * 2 * sizeof( float ) ); + + alpha = stdlib_complex64( 1.0f, 0.0f ); + for ( i = 0; i < len*2; i += 2 ) { + x[ i ] = random_uniform( -1.0f, 1.0f ); + x[ i+1 ] = random_uniform( -1.0f, 1.0f ); + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + stdlib_strided_capx( len, alpha, (stdlib_complex64_t *)x, 1 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + } + free( x ); + return elapsed; +} + +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark2( int iterations, int len ) { + stdlib_complex64_t alpha; + double elapsed; + double t; + float *x; + int i; + + x = (float *)malloc( len * 2 * sizeof( float ) ); + + alpha = stdlib_complex64( 1.0f, 0.0f ); + for ( i = 0; i < len*2; i += 2 ) { + x[ i ] = random_uniform( -1.0f, 1.0f ); + x[ i+1 ] = random_uniform( -1.0f, 1.0f ); + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + stdlib_strided_capx_ndarray( len, alpha, (stdlib_complex64_t *)x, 1, 0 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + } + free( x ); + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int count; + int iter; + int len; + int i; + int j; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + count = 0; + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:len=%d\n", NAME, len ); + elapsed = benchmark1( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + elapsed = benchmark2( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + print_summary( count, count ); +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/binding.gyp b/lib/node_modules/@stdlib/blas/ext/base/capx/binding.gyp new file mode 100644 index 000000000000..0d6508a12e99 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/repl.txt new file mode 100644 index 000000000000..14a1b017127f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/repl.txt @@ -0,0 +1,110 @@ + +{{alias}}( N, alpha, x, strideX ) + Adds a scalar constant to each element in a single-precision complex + floating-point strided array. + + 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 <= 0`, the function returns `x` unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + alpha: Complex64 + Scalar constant. + + x: Complex64Array + Input array. + + strideX: integer + Stride length. + + Returns + ------- + x: Complex64Array + Input array. + + Examples + -------- + // Standard Usage: + > var buf = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ]; + > var x = new {{alias:@stdlib/array/complex64}}( buf ); + > var alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 0.0 ); + > {{alias}}( x.length, alpha, x, 1 ); + > x + [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] + + // Using `N` and stride parameters: + > x = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 0.0 ); + > {{alias}}( 3, alpha, x, 2 ); + > x + [ 3.0, 1.0, 3.0, -5.0, 9.0, 0.0, -1.0, -3.0 ] + + // Using view offsets: + > var buf0 = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ]; + > var x0 = new {{alias:@stdlib/array/complex64}}( buf0 ); + > var offset = x0.BYTES_PER_ELEMENT * 1; + > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, offset ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 0.0 ); + > {{alias}}( 2, alpha, x1, 2 ); + > x0 + [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] + + +{{alias}}.ndarray( N, alpha, x, strideX, offsetX ) + Adds a scalar constant to each element in a single-precision complex + floating-point strided array 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. + + alpha: Complex64 + Scalar constant. + + x: Complex64Array + Input array. + + strideX: integer + Stride length. + + offsetX: integer + Starting index. + + Returns + ------- + x: Complex64Array + Input array. + + Examples + -------- + // Standard Usage: + > var buf = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ]; + > var x = new {{alias:@stdlib/array/complex64}}( buf ); + > var alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 0.0 ); + > {{alias}}.ndarray( x.length, alpha, x, 1, 0 ); + > x + [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] + + // Using an index offset: + > var buf0 = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ]; + > x = new {{alias:@stdlib/array/complex64}}( buf0 ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 0.0 ); + > {{alias}}.ndarray( 3, alpha, x, 2, 1 ); + > x + [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/index.d.ts new file mode 100644 index 000000000000..fa856a5e409d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/index.d.ts @@ -0,0 +1,112 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex64Array } from '@stdlib/types/array'; +import { Complex64 } from '@stdlib/types/complex'; + +/** +* Interface describing `capx`. +*/ +interface Routine { + /** + * Adds a scalar constant to each element in a single-precision complex floating-point strided array. + * + * @param N - number of indexed elements + * @param alpha - scalar constant + * @param x - input array + * @param strideX - stride length + * @returns input array + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * + * var alpha = new Complex64( 10.0, 10.0 ); + * + * capx( x.length, alpha, x, 1 ); + * // x => [ 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0 ] + */ + ( N: number, alpha: Complex64, x: Complex64Array, strideX: number ): Complex64Array; + + /** + * Adds a scalar constant to each element in a single-precision complex floating-point strided array using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param alpha - scalar constant + * @param x - input array + * @param strideX - stride length + * @param offsetX - starting index + * @returns input array + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * + * var alpha = new Complex64( 10.0, 10.0 ); + * + * capx.ndarray( x.length, alpha, x, 1, 0 ); + * // x => [ 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0 ] + */ + ndarray( N: number, alpha: Complex64, x: Complex64Array, strideX: number, offsetX: number ): Complex64Array; +} + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @param N - number of indexed elements +* @param alpha - scalar constant +* @param x - input array +* @param strideX - stride length +* @returns input array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* var alpha = new Complex64( 10.0, 10.0 ); +* +* capx( x.length, alpha, x, 1 ); +* // x => [ 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* var alpha = new Complex64( 10.0, 10.0 ); +* +* capx.ndarray( x.length, alpha, x, 1, 0 ); +* // x => [ 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0 ] +*/ +declare var capx: Routine; + + +// EXPORTS // + +export = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/test.ts new file mode 100644 index 000000000000..81855bb0eca0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/docs/types/test.ts @@ -0,0 +1,202 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex64Array = require( '@stdlib/array/complex64' ); +import Complex64 = require( '@stdlib/complex/float32/ctor' ); +import capx = require( './index' ); + + +// TESTS // + +// The function returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx( x.length, alpha, x, 1 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx( '10', alpha, x, 1 ); // $ExpectError + capx( true, alpha, x, 1 ); // $ExpectError + capx( false, alpha, x, 1 ); // $ExpectError + capx( null, alpha, x, 1 ); // $ExpectError + capx( undefined, alpha, x, 1 ); // $ExpectError + capx( [], alpha, x, 1 ); // $ExpectError + capx( {}, alpha, x, 1 ); // $ExpectError + capx( ( x: number ): number => x, alpha, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not complex-like... +{ + const x = new Complex64Array( 10 ); + + capx( x.length, 10, x, 1 ); // $ExpectError + capx( x.length, '10', x, 1 ); // $ExpectError + capx( x.length, true, x, 1 ); // $ExpectError + capx( x.length, false, x, 1 ); // $ExpectError + capx( x.length, null, x, 1 ); // $ExpectError + capx( x.length, undefined, x, 1 ); // $ExpectError + capx( x.length, [ '1' ], x, 1 ); // $ExpectError + capx( x.length, {}, x, 1 ); // $ExpectError + capx( x.length, ( x: number ): number => x, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx( x.length, alpha, 10, 1 ); // $ExpectError + capx( x.length, alpha, '10', 1 ); // $ExpectError + capx( x.length, alpha, true, 1 ); // $ExpectError + capx( x.length, alpha, false, 1 ); // $ExpectError + capx( x.length, alpha, null, 1 ); // $ExpectError + capx( x.length, alpha, undefined, 1 ); // $ExpectError + capx( x.length, alpha, [ '1' ], 1 ); // $ExpectError + capx( x.length, alpha, {}, 1 ); // $ExpectError + capx( x.length, alpha, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx( x.length, alpha, x, '10' ); // $ExpectError + capx( x.length, alpha, x, true ); // $ExpectError + capx( x.length, alpha, x, false ); // $ExpectError + capx( x.length, alpha, x, null ); // $ExpectError + capx( x.length, alpha, x, undefined ); // $ExpectError + capx( x.length, alpha, x, [] ); // $ExpectError + capx( x.length, alpha, x, {} ); // $ExpectError + capx( x.length, alpha, x, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx(); // $ExpectError + capx( x.length ); // $ExpectError + capx( x.length, alpha ); // $ExpectError + capx( x.length, alpha, x ); // $ExpectError + capx( x.length, alpha, x, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray( x.length, alpha, x, 1, 0 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray( '10', alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( true, alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( false, alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( null, alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( undefined, alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( [], alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( {}, alpha, x, 1, 0 ); // $ExpectError + capx.ndarray( ( x: number ): number => x, alpha, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not complex-like... +{ + const x = new Complex64Array( 10 ); + + capx.ndarray( x.length, 10, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, true, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, false, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, null, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, [ '1' ], x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError + capx.ndarray( x.length, ( x: number ): number => x, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray( x.length, alpha, 10, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, '10', 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, true, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, false, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, null, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, undefined, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, [ '1' ], 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, {}, 1, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray( x.length, alpha, x, '10', 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, true, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, false, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, null, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, undefined, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, [], 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, {}, 0 ); // $ExpectError + capx.ndarray( x.length, alpha, x, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray( x.length, alpha, x, 1, '10' ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, true ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, false ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, null ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, undefined ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, [] ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, {} ); // $ExpectError + capx.ndarray( x.length, alpha, 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 Complex64Array( 10 ); + const alpha = new Complex64( 2.0, 2.0 ); + + capx.ndarray(); // $ExpectError + capx.ndarray( x.length ); // $ExpectError + capx.ndarray( x.length, alpha ); // $ExpectError + capx.ndarray( x.length, alpha, x ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1 ); // $ExpectError + capx.ndarray( x.length, alpha, x, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/example.c new file mode 100644 index 000000000000..e4a5bf58a80c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/c/example.c @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/capx.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include + +int main( void ) { + // Create a strided array: + stdlib_complex64_t x[] = { + stdlib_complex64( 1.0f, -2.0f ), + stdlib_complex64( 3.0f, -4.0f ), + stdlib_complex64( 5.0f, -6.0f ), + stdlib_complex64( 7.0f, -8.0f ) + }; + + // Specify the number of indexed elements: + const int N = 4; + + // Specify a stride: + const int strideX = 1; + + // Scalar constant: + stdlib_complex64_t alpha = stdlib_complex64( 5.0f, 0.0f ); + + // Add a constant to each element: + stdlib_strided_capx( N, alpha, x, strideX ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "x[ %i ] = %f + %fi\n", i, stdlib_complex64_real( x[ i ] ), stdlib_complex64_imag( x[ i ] ) ); + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/index.js new file mode 100644 index 000000000000..564233434bfc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/examples/index.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var capx = require( './../lib' ); + +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float32' +}); +var x = new Complex64Array( xbuf.buffer ); +var alpha = new Complex64( 10.0, 10.0 ); + +capx( x.length, alpha, x, 1 ); +console.log( x.get( 0 ).toString() ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/capx/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + ' [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] +*/ +function capx( N, alpha, x, strideX ) { + return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) ); +} + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/capx.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/capx.native.js new file mode 100644 index 000000000000..73940b86861f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/capx.native.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - input array +* @param {integer} strideX - stride length +* @returns {Complex64Array} input array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var alpha = new Complex64( 5.0, 0.0 ); +* +* capx( x.length, alpha, x, 1 ); +* // x => [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] +*/ +function capx( N, alpha, x, strideX ) { + var view = reinterpret( x, 0 ); + addon( N, alpha, view, strideX ); + return x; +} + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/index.js new file mode 100644 index 000000000000..054795199f70 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/index.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Add a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @module @stdlib/blas/ext/base/capx +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var capx = require( '@stdlib/blas/ext/base/capx' ); +* +* var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var alpha = new Complex64( 5.0, 0.0 ); +* +* capx( x.length, alpha, x, 1 ); +* // x => [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var capx = require( '@stdlib/blas/ext/base/capx' ); +* +* var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +* +* var alpha = new Complex64( 5.0, 0.0 ); +* +* capx.ndarray( x.length, alpha, x, 1, 0 ); +* // x => [ 3.0, 1.0, 8.0, -5.0, 9.0, 0.0, 4.0, -3.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 capx; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + capx = main; +} else { + capx = tmp; +} + + +// EXPORTS // + +module.exports = capx; + +// exports: { "ndarray": "capx.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/main.js new file mode 100644 index 000000000000..51981280fd0e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var capx = require( './capx.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( capx, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/native.js new file mode 100644 index 000000000000..60c3e268e2d1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var capx = require( './capx.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( capx, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.js new file mode 100644 index 000000000000..0ef66cab56b4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.js @@ -0,0 +1,118 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var add = require( '@stdlib/complex/float32/base/add' ).assign; + + +// VARIABLES // + +var M = 5; + + +// MAIN // + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - input array +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @returns {Complex64Array} input array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var x = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); +* +* var alpha = new Complex64( 5.0, 0.0 ); +* +* capx( 2, alpha, x, 2, 1 ); +* // x => [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] +*/ +function capx( N, alpha, x, strideX, offsetX ) { + var view; + var re; + var im; + var ix; + var sx; + var m; + var i; + + if ( N <= 0 ) { + return x; + } + + // Decompose the constant into its real and imaginary components: + re = realf( alpha ); + im = imagf( alpha ); + if ( re === 0.0 && im === 0.0 ) { + return x; + } + + // Reinterpret the complex input array as a real-valued array: + view = reinterpret( x, 0 ); + + // Adjust the stride and offset according to the real-valued array: + ix = offsetX * 2; + sx = strideX * 2; + + // Use loop unrolling if the stride is equal to `1`... + if ( strideX === 1 ) { + m = N % M; + + // If we have a remainder, run a clean-up loop... + if ( m > 0 ) { + for ( i = 0; i < m; i++ ) { + add( view[ ix ], view[ ix+1 ], re, im, view, 1, ix ); + ix += sx; + } + } + if ( N < M ) { + return x; + } + for ( i = m; i < N; i += M ) { + add( view[ ix ], view[ ix+1 ], re, im, view, 1, ix ); + add( view[ ix+2 ], view[ ix+3 ], re, im, view, 1, ix+2 ); + add( view[ ix+4 ], view[ ix+5 ], re, im, view, 1, ix+4 ); + add( view[ ix+6 ], view[ ix+7 ], re, im, view, 1, ix+6 ); + add( view[ ix+8 ], view[ ix+9 ], re, im, view, 1, ix+8 ); + ix += M * 2; + } + return x; + } + for ( i = 0; i < N; i++ ) { + add( view[ ix ], view[ ix+1 ], re, im, view, 1, ix ); + ix += sx; + } + return x; +} + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.native.js new file mode 100644 index 000000000000..15f7326e43f0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/lib/ndarray.native.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - input array +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @returns {Complex64Array} input array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var x = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); +* +* var alpha = new Complex64( 5.0, 0.0 ); +* +* capx( 2, alpha, x, 2, 1 ); +* // x => [ 1.0, -2.0, 8.0, -4.0, 5.0, -6.0 ] +*/ +function capx( N, alpha, x, strideX, offsetX ) { + var view = reinterpret( x, 0 ); + addon.ndarray( N, alpha, view, strideX, offsetX ); + return x; +} + + +// EXPORTS // + +module.exports = capx; diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/capx/manifest.json new file mode 100644 index 000000000000..29b50649b868 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/manifest.json @@ -0,0 +1,91 @@ +{ + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag", + "@stdlib/strided/base/stride2offset", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/complex/float32/ctor" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/package.json b/lib/node_modules/@stdlib/blas/ext/base/capx/package.json new file mode 100644 index 000000000000..f515ac13db08 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/package.json @@ -0,0 +1,78 @@ +{ + "name": "@stdlib/blas/ext/base/capx", + "version": "0.0.0", + "description": "Add a scalar constant to each element in a single-precision complex floating-point strided array.", + "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", + "extended", + "add", + "addition", + "scale", + "translate", + "strided", + "array", + "ndarray", + "capx", + "complex", + "complex64", + "complex64array", + "float32" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/src/Makefile b/lib/node_modules/@stdlib/blas/ext/base/capx/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/capx/src/addon.c new file mode 100644 index 000000000000..60cbad0f0b91 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/src/addon.c @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/capx.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_complex64.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_strided_complex64array.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 4 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_COMPLEX64( env, alpha, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 2 ); + API_SUFFIX(stdlib_strided_capx)( N, alpha, (stdlib_complex64_t *)X, strideX ); + return NULL; +} + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_COMPLEX64( env, alpha, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 2 ); + API_SUFFIX(stdlib_strided_capx_ndarray)( N, alpha, (stdlib_complex64_t *)X, strideX, offsetX ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c new file mode 100644 index 000000000000..5590b3ad2f28 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/capx.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include "stdlib/complex/float32/base/add.h" +#include "stdlib/strided/base/stride2offset.h" + +static const CBLAS_INT M = 5; + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array. +* +* @param N number of indexed elements +* @param alpha scalar constant +* @param X input array +* @param strideX stride length +*/ +void API_SUFFIX(stdlib_strided_capx)( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + API_SUFFIX(stdlib_strided_capx_ndarray)( N, alpha, X, strideX, ox ); +} + +/** +* Adds a scalar constant to each element in a single-precision complex floating-point strided array using alternative indexing semantics. +* +* @param N number of indexed elements +* @param alpha scalar constant +* @param X input array +* @param strideX stride length +* @param offsetX starting index +*/ +void API_SUFFIX(stdlib_strided_capx_ndarray)( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex64_t re; + stdlib_complex64_t im; + stdlib_complex64_t z; + CBLAS_INT ix; + CBLAS_INT m; + CBLAS_INT i; + + re = stdlib_complex64_real( alpha ); + im = stdlib_complex64_imag( alpha ); + if ( N <= 0 || ( re == 0.0f && im == 0.0f ) ) { + return; + } + ix = offsetX; + + // Use loop unrolling if the stride is equal to `1`... + if ( strideX == 1 ) { + m = N % M; + + // If we have a remainder, run a clean-up loop... + if ( m > 0 ) { + for ( i = 0; i < m; i++ ) { + z = X[ ix ]; + X[ ix ] = stdlib_base_complex64_add( z, alpha ); + ix += strideX; + } + } + if ( N < M ) { + return; + } + for ( i = m; i < N; i += M ) { + z = X[ ix ]; + X[ ix ] = stdlib_base_complex64_add( z, alpha ); + z = X[ ix+1 ]; + X[ ix+1 ] = stdlib_base_complex64_add( z, alpha ); + z = X[ ix+2 ]; + X[ ix+2 ] = stdlib_base_complex64_add( z, alpha ); + z = X[ ix+3 ]; + X[ ix+3 ] = stdlib_base_complex64_add( z, alpha ); + z = X[ ix+4 ]; + X[ ix+4 ] = stdlib_base_complex64_add( z, alpha ); + ix += M; + } + return; + } + for ( i = 0; i < N; i++ ) { + z = X[ ix ]; + X[ ix ] = stdlib_base_complex64_add( z, alpha ); + ix += strideX; + } + return; +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.js b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.js new file mode 100644 index 000000000000..147e5722c87a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.js @@ -0,0 +1,261 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var caddf = require( '@stdlib/complex/float32/base/add' ); +var capx = require( './../lib/capx.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof capx, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 4', function test( t ) { + t.strictEqual( capx.length, 4, 'has expected arity' ); + t.end(); +}); + +tape( 'the function adds a constant to each strided array element', function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 5.0, 0.0 ); + + x = new Complex64Array([ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = x.get( i ); + expected.set( caddf( z, alpha ), i ); + } + + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', function test( t ) { + var alpha; + var out; + var x; + + alpha = new Complex64( 3.0, 3.0 ); + x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + out = capx( x.length, alpha, x, 1 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 10.0, 10.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( 0, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + capx( -4, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a zero constant, the function returns the input array unchanged', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + 0.0, + 0.0, + -5.0, // 1 + 7.0, // 1 + 0.0, + 0.0, + 6.0, // 2 + -8.0 // 2 + ]); + expected = new Complex64Array([ + 7.0, // 0 + -8.0, // 0 + 0.0, + 0.0, + 0.0, // 1 + 2.0, // 1 + 0.0, + 0.0, + 11.0, // 2 + -13.0 // 2 + ]); + + capx( 3, alpha, x, 2 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 0.0, // 2 + 0.0, // 2 + -5.0, + 7.0, + 0.0, // 1 + 0.0, // 1 + 6.0, + -8.0, + 0.0, // 0 + 0.0, // 0 + 2.0, + -3.0 + ]); + expected = new Complex64Array([ + 5.0, // 2 + -5.0, // 2 + -5.0, + 7.0, + 5.0, // 1 + -5.0, // 1 + 6.0, + -8.0, + 5.0, // 0 + -5.0, // 0 + 2.0, + -3.0 + ]); + + capx( 3, alpha, x, -2 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var expected; + var alpha; + var x0; + var x1; + + alpha = new Complex64( 5.0, -5.0 ); + x0 = new Complex64Array([ + 1.0, + -2.0, + 3.0, // 0 + -4.0, // 0 + 6.0, + -8.0, + 10.0, // 1 + -12.0 // 1 + ]); + expected = new Complex64Array([ + 1.0, + -2.0, + 8.0, // 0 + -9.0, // 0 + 6.0, + -8.0, + 15.0, // 1 + -17.0 // 1 + ]); + + x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + + capx( 2, alpha, x1, 2 ); + t.strictEqual( isSameComplex64Array( x0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `stride` is equal to `1`, the function efficiently adds a constant to each element of a strided array', function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 3.0, -1.0 ); + x = new Complex64Array( 100 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + x = new Complex64Array( 240 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.native.js new file mode 100644 index 000000000000..95018eb2e67f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.capx.native.js @@ -0,0 +1,270 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var caddf = require( '@stdlib/complex/float32/base/add' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var capx = tryRequire( resolve( __dirname, './../lib/capx.native.js' ) ); +var opts = { + 'skip': ( capx instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof capx, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 4', opts, function test( t ) { + t.strictEqual( capx.length, 4, 'has expected arity' ); + t.end(); +}); + +tape( 'the function adds a constant to each strided array element', opts, function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 5.0, 0.0 ); + + x = new Complex64Array([ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = x.get( i ); + expected.set( caddf( z, alpha ), i ); + } + + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', opts, function test( t ) { + var alpha; + var out; + var x; + + alpha = new Complex64( 3.0, 3.0 ); + x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + out = capx( x.length, alpha, x, 1 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 10.0, 10.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( 0, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + capx( -4, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a zero constant, the function returns the input array unchanged', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + 0.0, + 0.0, + -5.0, // 1 + 7.0, // 1 + 0.0, + 0.0, + 6.0, // 2 + -8.0 // 2 + ]); + expected = new Complex64Array([ + 7.0, // 0 + -8.0, // 0 + 0.0, + 0.0, + 0.0, // 1 + 2.0, // 1 + 0.0, + 0.0, + 11.0, // 2 + -13.0 // 2 + ]); + + capx( 3, alpha, x, 2 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 0.0, // 2 + 0.0, // 2 + -5.0, + 7.0, + 0.0, // 1 + 0.0, // 1 + 6.0, + -8.0, + 0.0, // 0 + 0.0, // 0 + 2.0, + -3.0 + ]); + expected = new Complex64Array([ + 5.0, // 2 + -5.0, // 2 + -5.0, + 7.0, + 5.0, // 1 + -5.0, // 1 + 6.0, + -8.0, + 5.0, // 0 + -5.0, // 0 + 2.0, + -3.0 + ]); + + capx( 3, alpha, x, -2 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', opts, function test( t ) { + var expected; + var alpha; + var x0; + var x1; + + alpha = new Complex64( 5.0, -5.0 ); + x0 = new Complex64Array([ + 1.0, + -2.0, + 3.0, // 0 + -4.0, // 0 + 6.0, + -8.0, + 10.0, // 1 + -12.0 // 1 + ]); + expected = new Complex64Array([ + 1.0, + -2.0, + 8.0, // 0 + -9.0, // 0 + 6.0, + -8.0, + 15.0, // 1 + -17.0 // 1 + ]); + + x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + + capx( 2, alpha, x1, 2 ); + t.strictEqual( isSameComplex64Array( x0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `stride` is equal to `1`, the function efficiently adds a constant to each element of a strided array', opts, function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 3.0, -1.0 ); + x = new Complex64Array( 100 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + x = new Complex64Array( 240 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.js new file mode 100644 index 000000000000..a7aeff2f1080 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var capx = 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 capx, '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 capx.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 capx = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( capx, mock, 'returns native implementation' ); + 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 capx; + var main; + + main = require( './../lib/capx.js' ); + + capx = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( capx, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.js new file mode 100644 index 000000000000..b9db812d4c12 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.js @@ -0,0 +1,266 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var caddf = require( '@stdlib/complex/float32/base/add' ); +var capx = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof capx, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.strictEqual( capx.length, 5, 'has expected arity' ); + t.end(); +}); + +tape( 'the function adds a constant to each strided array element', function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 5.0, 0.0 ); + + x = new Complex64Array([ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = x.get( i ); + expected.set( caddf( z, alpha ), i ); + } + + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', function test( t ) { + var alpha; + var out; + var x; + + alpha = new Complex64( 3.0, 3.0 ); + x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + out = capx( x.length, alpha, x, 1, 0 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 10.0, 10.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( 0, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + capx( -4, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a zero constant, the function returns the input array unchanged', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + 0.0, + 0.0, + -5.0, // 1 + 7.0, // 1 + 0.0, + 0.0, + 6.0, // 2 + -8.0 // 2 + ]); + expected = new Complex64Array([ + 7.0, // 0 + -8.0, // 0 + 0.0, + 0.0, + 0.0, // 1 + 2.0, // 1 + 0.0, + 0.0, + 11.0, // 2 + -13.0 // 2 + ]); + + capx( 3, alpha, x, 2, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 0.0, + 0.0, + -5.0, // 2 + 7.0, // 2 + 0.0, + 0.0, + 6.0, // 1 + -8.0, // 1 + 0.0, + 0.0, + 2.0, // 0 + -3.0 // 0 + ]); + expected = new Complex64Array([ + 0.0, + 0.0, + 0.0, // 2 + 2.0, // 2 + 0.0, + 0.0, + 11.0, // 1 + -13.0, // 1 + 0.0, + 0.0, + 7.0, // 0 + -8.0 // 0 + ]); + + capx( 3, alpha, x, -2, x.length-1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an offset parameter', function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 1.0, + -2.0, + 3.0, // 0 + -4.0, // 0 + 0.0, + 0.0, + 5.0, // 1 + 6.0, // 1 + 0.0, + 0.0, + 0.0, + 0.0 + ]); + expected = new Complex64Array([ + 1.0, + -2.0, + 8.0, // 0 + -9.0, // 0 + 5.0, + -5.0, + 5.0, // 1 + 6.0, // 1 + 0.0, + 0.0, + 0.0, + 0.0 + ]); + + capx( 2, alpha, x, 1, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `stride` is equal to `1`, the function efficiently adds a constant to each element', function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 3.0, -1.0 ); + x = new Complex64Array( 100 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + x = new Complex64Array( 240 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.native.js new file mode 100644 index 000000000000..fe1b88f974be --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/test/test.ndarray.native.js @@ -0,0 +1,275 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var caddf = require( '@stdlib/complex/float32/base/add' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var capx = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( capx instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof capx, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', opts, function test( t ) { + t.strictEqual( capx.length, 5, 'has expected arity' ); + t.end(); +}); + +tape( 'the function adds a constant to each strided array element', opts, function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 5.0, 0.0 ); + + x = new Complex64Array([ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = x.get( i ); + expected.set( caddf( z, alpha ), i ); + } + + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', opts, function test( t ) { + var alpha; + var out; + var x; + + alpha = new Complex64( 3.0, 3.0 ); + x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + out = capx( x.length, alpha, x, 1, 0 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 10.0, 10.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( 0, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + capx( -4, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a zero constant, the function returns the input array unchanged', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + expected = new Complex64Array( [ 3.0, -4.0, 1.0, -2.0 ] ); + + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + 0.0, + 0.0, + -5.0, // 1 + 7.0, // 1 + 0.0, + 0.0, + 6.0, // 2 + -8.0 // 2 + ]); + expected = new Complex64Array([ + 7.0, // 0 + -8.0, // 0 + 0.0, + 0.0, + 0.0, // 1 + 2.0, // 1 + 0.0, + 0.0, + 11.0, // 2 + -13.0 // 2 + ]); + + capx( 3, alpha, x, 2, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 0.0, + 0.0, + -5.0, // 2 + 7.0, // 2 + 0.0, + 0.0, + 6.0, // 1 + -8.0, // 1 + 0.0, + 0.0, + 2.0, // 0 + -3.0 // 0 + ]); + expected = new Complex64Array([ + 0.0, + 0.0, + 0.0, // 2 + 2.0, // 2 + 0.0, + 0.0, + 11.0, // 1 + -13.0, // 1 + 0.0, + 0.0, + 7.0, // 0 + -8.0 // 0 + ]); + + capx( 3, alpha, x, -2, x.length-1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an offset parameter', opts, function test( t ) { + var expected; + var alpha; + var x; + + alpha = new Complex64( 5.0, -5.0 ); + x = new Complex64Array([ + 1.0, + -2.0, + 3.0, // 0 + -4.0, // 0 + 0.0, + 0.0, + 5.0, // 1 + 6.0, // 1 + 0.0, + 0.0, + 0.0, + 0.0 + ]); + expected = new Complex64Array([ + 1.0, + -2.0, + 8.0, // 0 + -9.0, // 0 + 5.0, + -5.0, + 5.0, // 1 + 6.0, // 1 + 0.0, + 0.0, + 0.0, + 0.0 + ]); + + capx( 2, alpha, x, 1, 1 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `stride` is equal to `1`, the function efficiently adds a constant to each element', opts, function test( t ) { + var expected; + var alpha; + var x; + var z; + var i; + + alpha = new Complex64( 3.0, -1.0 ); + x = new Complex64Array( 100 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + x = new Complex64Array( 240 ); + expected = new Complex64Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + z = new Complex64( i, 0.0 ); + x.set( z, i ); + expected.set( caddf( z, alpha ), i ); + } + capx( x.length, alpha, x, 1, 0 ); + t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); + + t.end(); +}); From 07b7213f7e348b73c1e3490c9eb19d36d5bdc044 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 21 May 2026 23:31:26 -0700 Subject: [PATCH 7/8] chore: remove other implementation --- .../@stdlib/lapack/base/dlaisnan/README.md | 184 ------------------ .../base/dlaisnan/benchmark/benchmark.js | 56 ------ .../lapack/base/dlaisnan/docs/repl.txt | 29 --- .../base/dlaisnan/docs/types/index.d.ts | 45 ----- .../lapack/base/dlaisnan/docs/types/test.ts | 56 ------ .../lapack/base/dlaisnan/examples/index.js | 31 --- .../@stdlib/lapack/base/dlaisnan/lib/index.js | 46 ----- .../@stdlib/lapack/base/dlaisnan/lib/main.js | 53 ----- .../@stdlib/lapack/base/dlaisnan/package.json | 68 ------- .../@stdlib/lapack/base/dlaisnan/test/test.js | 139 ------------- 10 files changed, 707 deletions(-) delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json delete mode 100644 lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md deleted file mode 100644 index a32875fbc032..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md +++ /dev/null @@ -1,184 +0,0 @@ - - -# dlaisnan - -> LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. - -
- -## Usage - -```javascript -var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); -``` - -#### dlaisnan( DIN1, DIN2 ) - -Tests input for NaN by comparing two double-precision floating-point arguments for inequality. - -```javascript -var bool = dlaisnan( NaN, NaN ); -// returns true - -bool = dlaisnan( NaN, 5.0 ); -// returns true - -bool = dlaisnan( 5.0, 5.0 ); -// returns false -``` - -The function has the following parameters: - -- **DIN1**: first input number. -- **DIN2**: second input number. - -
- - - -
- -## Notes - -- `dlaisnan()` corresponds to the [LAPACK][lapack] auxiliary routine [`dlaisnan`][lapack-dlaisnan]. -- This routine is not for general use. It exists solely to avoid over-optimization in [`disnan`][lapack-disnan]. -- `dlaisnan` checks for NaNs by comparing its two arguments for inequality. `NaN` is the only floating-point value where `NaN !== NaN` returns `true`. To check for NaNs, pass the same variable as both arguments (i.e., `dlaisnan( x, x )`). -- The function returns `true` whenever the two arguments are unequal, not only when one is `NaN`. This matches the Fortran reference implementation which simply returns `DIN1.NE.DIN2`. - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var logEachMap = require( '@stdlib/console/log-each-map' ); -var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); - -var opts = { - 'dtype': 'float64' -}; -var x = discreteUniform( 100, -50, 50, opts ); -var y = discreteUniform( 100, -50, 50, opts ); - -logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -TODO -``` - -#### TODO - -TODO. - -```c -TODO -``` - -TODO - -```c -TODO -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -TODO -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js deleted file mode 100644 index 5e2eb4b29344..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var dlaisnan = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var len; - var x; - var y; - var z; - var i; - - len = 100; - x = uniform( len, -50, 50 ); - y = uniform( len, -50, 50 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = dlaisnan( x[ i % len ], y[ i % len ] ); - if ( typeof z !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( z ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt deleted file mode 100644 index 5553849e3739..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( DIN1, DIN2 ) - Tests input for NaN by comparing two double-precision floating-point - arguments for inequality. - - Parameters - ---------- - DIN1: number - First input number. - - DIN2: number - Second input number. - - Returns - ------- - bool: boolean - Boolean indicating whether the arguments are unequal. - - Examples - -------- - > var bool = {{alias}}( NaN, NaN ) - true - > bool = {{alias}}( NaN, 5.0 ) - true - > bool = {{alias}}( 5.0, 5.0 ) - false - - See Also - -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts deleted file mode 100644 index a42bafe5bfe6..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. -* -* @param DIN1 - first input number -* @param DIN2 - second input number -* @returns boolean indicating whether the arguments are unequal -* -* @example -* var bool = dlaisnan( NaN, NaN ); -* // returns true -* -* @example -* var bool = dlaisnan( NaN, 5.0 ); -* // returns true -* -* @example -* var bool = dlaisnan( 5.0, 5.0 ); -* // returns false -*/ -declare function dlaisnan( DIN1: number, DIN2: number ): boolean; - - -// EXPORTS // - -export = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts deleted file mode 100644 index 8115794c5bfa..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import dlaisnan = require( './index' ); - - -// TESTS // - -// The function returns a boolean... -{ - dlaisnan( 8, 2 ); // $ExpectType boolean -} - -// The compiler throws an error if the function is provided values other than two numbers... -{ - dlaisnan( true, 3 ); // $ExpectError - dlaisnan( false, 2 ); // $ExpectError - dlaisnan( '5', 1 ); // $ExpectError - dlaisnan( [], 1 ); // $ExpectError - dlaisnan( {}, 2 ); // $ExpectError - dlaisnan( ( x: number ): number => x, 2 ); // $ExpectError - - dlaisnan( 9, true ); // $ExpectError - dlaisnan( 9, false ); // $ExpectError - dlaisnan( 5, '5' ); // $ExpectError - dlaisnan( 8, [] ); // $ExpectError - dlaisnan( 9, {} ); // $ExpectError - dlaisnan( 8, ( x: number ): number => x ); // $ExpectError - - dlaisnan( [], true ); // $ExpectError - dlaisnan( {}, false ); // $ExpectError - dlaisnan( false, '5' ); // $ExpectError - dlaisnan( {}, [] ); // $ExpectError - dlaisnan( '5', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - dlaisnan(); // $ExpectError - dlaisnan( 3 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js deleted file mode 100644 index 92e8b0037ed0..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var logEachMap = require( '@stdlib/console/log-each-map' ); -var dlaisnan = require( './../lib' ); - -var opts = { - 'dtype': 'float64' -}; -var x = discreteUniform( 100, -50, 50, opts ); -var y = discreteUniform( 100, -50, 50, opts ); - -logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js deleted file mode 100644 index ba21fca5cdb5..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. -* -* @module @stdlib/lapack/base/dlaisnan -* -* @example -* var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); -* -* var bool = dlaisnan( NaN, NaN ); -* // returns true -* -* bool = dlaisnan( NaN, 5.0 ); -* // returns true -* -* bool = dlaisnan( 5.0, 5.0 ); -* // returns false -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js deleted file mode 100644 index 6ecbad7ad343..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Tests input for NaN by comparing two double-precision floating-point arguments for inequality. -* -* ## Notes -* -* - This routine exists solely to avoid over-optimization in `disnan`. -* -* @param {number} DIN1 - first input number -* @param {number} DIN2 - second input number -* @returns {boolean} boolean indicating whether the arguments are unequal -* -* @example -* var bool = dlaisnan( NaN, NaN ); -* // returns true -* -* @example -* var bool = dlaisnan( NaN, 5.0 ); -* // returns true -* -* @example -* var bool = dlaisnan( 5.0, 5.0 ); -* // returns false -*/ -function dlaisnan( DIN1, DIN2 ) { - return ( DIN1 !== DIN2 ); -} - - -// EXPORTS // - -module.exports = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json deleted file mode 100644 index bec346c5109f..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/lapack/base/dlaisnan", - "version": "0.0.0", - "description": "LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "lapack", - "dlaisnan", - "nan", - "isnan", - "test", - "inequality", - "linear", - "algebra", - "subroutines", - "float64", - "double" - ] -} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js deleted file mode 100644 index d63c400ae447..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var dlaisnan = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof dlaisnan, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 2', function test( t ) { - t.strictEqual( dlaisnan.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` when either argument is NaN', function test( t ) { - var bool; - - bool = dlaisnan( NaN, NaN ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( NaN, 5.0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( 5.0, NaN ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( NaN, 0.0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( 0.0, NaN ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( NaN, PINF ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( NINF, NaN ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` when both arguments are equal non-NaN values', function test( t ) { - var bool; - - bool = dlaisnan( 5.0, 5.0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( 0.0, 0.0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( -0.0, -0.0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( -0.0, 0.0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( PINF, PINF ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( NINF, NINF ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = dlaisnan( -3.14, -3.14 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `true` when both arguments are unequal non-NaN values', function test( t ) { - var bool; - - bool = dlaisnan( 1.0, 2.0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( -1.0, 1.0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( PINF, NINF ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = dlaisnan( 0.0, 1.0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns expected values when passed the same variable as both arguments', function test( t ) { - var bool; - var x; - - x = NaN; - bool = dlaisnan( x, x ); - t.strictEqual( bool, true, 'returns expected value' ); - - x = 5.0; - bool = dlaisnan( x, x ); - t.strictEqual( bool, false, 'returns expected value' ); - - x = 0.0; - bool = dlaisnan( x, x ); - t.strictEqual( bool, false, 'returns expected value' ); - - x = -0.0; - bool = dlaisnan( x, x ); - t.strictEqual( bool, false, 'returns expected value' ); - - x = PINF; - bool = dlaisnan( x, x ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); From e0a5bf2c81381359d367ba08f8bb39da28eb3443 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 21 May 2026 23:38:12 -0700 Subject: [PATCH 8/8] fix: variable type --- lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c index 5590b3ad2f28..3669d628b27b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/capx/src/main.c @@ -49,12 +49,12 @@ void API_SUFFIX(stdlib_strided_capx)( const CBLAS_INT N, const stdlib_complex64_ * @param offsetX starting index */ void API_SUFFIX(stdlib_strided_capx_ndarray)( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { - stdlib_complex64_t re; - stdlib_complex64_t im; stdlib_complex64_t z; CBLAS_INT ix; CBLAS_INT m; CBLAS_INT i; + float re; + float im; re = stdlib_complex64_real( alpha ); im = stdlib_complex64_imag( alpha );