From 0133fc7fc465504c28bee2d2e797f8a5587a6b6e Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 22 Mar 2025 13:51:01 +0530 Subject: [PATCH 01/17] feat: add blas/base/wasm/scasum --- 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/blas/base/wasm/scasum/README.md | 303 +++++++++++ .../base/wasm/scasum/benchmark/benchmark.js | 107 ++++ .../wasm/scasum/benchmark/benchmark.module.js | 66 +++ .../scasum/benchmark/benchmark.module.main.js | 137 +++++ .../benchmark/benchmark.module.ndarray.js | 137 +++++ .../scasum/benchmark/benchmark.ndarray.js | 107 ++++ .../blas/base/wasm/scasum/docs/repl.txt | 499 ++++++++++++++++++ .../base/wasm/scasum/docs/types/index.d.ts | 317 +++++++++++ .../blas/base/wasm/scasum/docs/types/test.ts | 348 ++++++++++++ .../blas/base/wasm/scasum/examples/index.js | 43 ++ .../scasum/examples/little_endian_arrays.js | 65 +++ .../blas/base/wasm/scasum/examples/module.js | 63 +++ .../base/wasm/scasum/lib/binary.browser.js | 33 ++ .../blas/base/wasm/scasum/lib/binary.js | 34 ++ .../blas/base/wasm/scasum/lib/index.js | 99 ++++ .../@stdlib/blas/base/wasm/scasum/lib/main.js | 60 +++ .../blas/base/wasm/scasum/lib/module.js | 198 +++++++ .../blas/base/wasm/scasum/lib/routine.js | 166 ++++++ .../blas/base/wasm/scasum/manifest.json | 36 ++ .../blas/base/wasm/scasum/package.json | 80 +++ .../blas/base/wasm/scasum/scripts/build.js | 66 +++ .../base/wasm/scasum/scripts/template.txt | 33 ++ .../blas/base/wasm/scasum/src/Makefile | 243 +++++++++ .../blas/base/wasm/scasum/src/exports.json | 4 + .../blas/base/wasm/scasum/src/main.wasm | Bin 0 -> 249 bytes .../blas/base/wasm/scasum/src/main.wat | 93 ++++ .../blas/base/wasm/scasum/test/test.js | 53 ++ .../blas/base/wasm/scasum/test/test.main.js | 162 ++++++ .../blas/base/wasm/scasum/test/test.module.js | 154 ++++++ .../base/wasm/scasum/test/test.module.main.js | 162 ++++++ .../wasm/scasum/test/test.module.ndarray.js | 230 ++++++++ .../base/wasm/scasum/test/test.ndarray.js | 157 ++++++ .../base/wasm/scasum/test/test.routine.js | 71 +++ 33 files changed, 4326 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.browser.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/build.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/template.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/src/exports.json create mode 100755 lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wasm create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wat create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md new file mode 100644 index 000000000000..16018cfccb94 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -0,0 +1,303 @@ + + +# scasum + +> Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. + +
+ +## Usage + +```javascript +var scasum = require( '@stdlib/blas/base/wasm/scasum' ); +``` + +#### scasum.main( N, cx, stride ) + +Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); + +var sum = scasum.main( cx.length, cx, 1 ); +// returns 19.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **cx**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: index increment for `cx`. + +The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to compute the sum of every other value, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = scasum.main( 2, cx, 2 ); +// returns 7.0 +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +// Initial array: +var cx0 = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, 8.0 ] ); + +// Create a typed array view: +var cx1 = new Complex64Array( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var sum = scasum.main( 2, cx1, 2 ); +// returns 22.0 +``` + +#### scasum.ndarray( N, cx, strideX, offsetX ) + +Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +// returns 19.0 +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `cx`. + +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 compute the sum of last three elements, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + +var sum = scasum.ndarray( 2, cx, 1, cx.length-2 ); +// returns 8.0 + +// Using a negative stride to sum from the last element: +sum = scasum.ndarray( 4, cx, -1, cx.length-1 ); +// returns 19.0 +``` + +* * * + +### Module + +#### scasum.Module( memory ) + +Returns a new WebAssembly [module wrapper][@stdlib/wasm/module-wrapper] instance which uses the provided WebAssembly [memory][@stdlib/wasm/memory] instance as its underlying memory. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); + +// Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +var mem = new Memory({ + 'initial': 10, + 'maximum': 100 +}); + +// Create a BLAS routine: +var mod = new scasum.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); +``` + +#### scasum.Module.prototype.main( N, xp, sx ) + +Computes the sum of absolute values. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); + +// Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +var mem = new Memory({ + 'initial': 10, + 'maximum': 100 +}); + +// Create a BLAS routine: +var mod = new scasum.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex64'; + +// Specify a vector length: +var N = 4; + +// Define a pointer (i.e., byte offset) for storing the input vector: +var xptr = 0; + +// Write vector values to module memory: +mod.write( xptr, oneTo( N, dtype ) ); + +// Perform computation: +var sum = mod.main( N, xptr, 1 ); +// returns 10.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **xp**: input [`Complex64Array`][@stdlib/array/complex64] pointer (i.e., byte offset). +- **sx**: index increment for `cx`. + +#### scasum.Module.prototype.ndarray( N, xp, sx, ox ) + +Computes the sum of absolute values using alternative indexing semantics. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); + +// Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +var mem = new Memory({ + 'initial': 10, + 'maximum': 100 +}); + +// Create a BLAS routine: +var mod = new scasum.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex64'; + +// Specify a vector length: +var N = 4; + +// Define a pointer (i.e., byte offset) for storing the input vector: +var xptr = 0; + +// Write vector values to module memory: +mod.write( xptr, oneTo( N, dtype ) ); + +// Perform computation: +var sum = mod.ndarray( N, xptr, 1, 0 ); +// returns 10.0 +``` + +The function has the following additional parameters: + +- **ox**: starting index for `cx`. + +
+ + + +
+ +* * * + +## Notes + +- If `N <= 0`, both `main` and `ndarray` methods return `0.0`. +- This package implements routines using WebAssembly. When provided arrays which are not allocated on a `scasum` module memory instance, data must be explicitly copied to module memory prior to computation. Data movement may entail a performance cost, and, thus, if you are using arrays external to module memory, you should prefer using [`@stdlib/blas/base/scasum`][@stdlib/blas/base/scasum]. However, if working with arrays which are allocated and explicitly managed on module memory, you can achieve better performance when compared to the pure JavaScript implementations found in [`@stdlib/blas/base/scasum`][@stdlib/blas/base/scasum]. Beware that such performance gains may come at the cost of additional complexity when having to perform manual memory management. Choosing between implementations depends heavily on the particular needs and constraints of your application, with no one choice universally better than the other. +- `scasum()` corresponds to the [BLAS][blas] level 1 function [`scasum`][scasum]. + +
+ + + +
+ +* * * + +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var cx = filledarrayBy( 10, 'complex64', rand ); +console.log( cx.toString() ); + +var out = scasum( cx.length, cx, 1 ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js new file mode 100644 index 000000000000..96ac9372150a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +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 pkg = require( './../package.json' ).name; +var scasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var cx = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var sum; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + sum = scasum.main( cx.length, cx, 1 ); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js new file mode 100644 index 000000000000..6e1f4459d831 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var pkg = require( './../package.json' ).name; +var scasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; + + +// MAIN // + +bench( pkg+':Module:constructor', opts, function benchmark( b ) { + var values; + var o; + var v; + var i; + + o = { + 'initial': 0 + }; + values = [ + new Memory( o ), + new Memory( o ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = new scasum.Module( values[ i%values.length ] ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( typeof v !== 'object' ) { + b.fail( 'should return an object' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js new file mode 100644 index 000000000000..061f90eccb7b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -0,0 +1,137 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var scasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var xptr; + var mod; + var mem; + var sum; + var nb; + var cx; + var N; + var i; + + N = len * 2; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new scasum.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing one vector: + nb = bytesPerElement( options.dtype ); + mod.realloc( (N*nb)+nb ); + + // Define a pointer (i.e., byte offset) for storing the input vector: + xptr = 0; + + cx = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); + + // Write random values to module memory: + mod.write( xptr, cx ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + sum = mod.main( len, xptr, 1 ); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+'::module,pointers:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js new file mode 100644 index 000000000000..564d12ae36bd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js @@ -0,0 +1,137 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +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 pkg = require( './../package.json' ).name; +var scasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var xptr; + var mod; + var mem; + var sum; + var nb; + var cx; + var N; + var i; + + N = len * 2; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new scasum.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing one vector: + nb = bytesPerElement( options.dtype ); + mod.realloc( (N*nb)+nb ); + + // Define a pointer (i.e., byte offset) for storing the input vector: + xptr = 0; + + cx = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); + + // Write random values to module memory: + mod.write( xptr, cx ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + sum = mod.ndarray( len, xptr, 1, 0 ); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+'::module,pointers:ndarray:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..0dddfda89466 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +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 pkg = require( './../package.json' ).name; +var scasum = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var cx = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var sum; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + sum = scasum.ndarray( cx.length, cx, 1, 0 ); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( sum ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt new file mode 100644 index 000000000000..c97b1eb6e135 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt @@ -0,0 +1,499 @@ + +{{alias}}.main( N, cx, strideX ) + Computes the sum of the absolute values of the real and imaginary + components of a single-precision complex floating-point vector. + + 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 `0`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + cx: Complex64Array + Input array. + + strideX: integer + Index increment for `cx`. + + Returns + ------- + sum: number + Sum of absolute values. + + Examples + -------- + // Standard usage: + > var cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var s = {{alias}}.main( cx.length, cx, 1 ) + 15.0 + + // Using `N` and stride parameters: + > s = {{alias}}.main( 2, cx, 2 ) + 7.0 + + // Use view offset; e.g., starting at 2nd element: + > var cx0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); + > var cx1 = new {{alias:@stdlib/array/complex64}}( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); + > s = {{alias}}.main( 2, cx1, 2 ) + 22.0 + + +{{alias}}.ndarray( N, cx, strideX, offsetX ) + Computes the sum of the absolute values of the real and imaginary + components of a single-precision complex floating-point vector + using alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + N: integer + Number of indexed elements. + + cx: Complex64Array + Input array. + + strideX: integer + Index increment for `cx`. + + offsetX: integer + Starting index for `cx`. + + Returns + ------- + out: number + Sum of absolute values. + + Examples + -------- + // Standard usage: + > var cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var s = {{alias}}.ndarray( cx.length, cx, 1, 0 ) + 15.0 + + // Using offset parameter: + > cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > s = {{alias}}.ndarray( 3, cx, -1, cx.length-1 ) + 15.0 + + +{{alias}}.Module( memory ) + Returns a new WebAssembly module wrapper which uses the provided WebAssembly + memory instance as its underlying memory. + + Parameters + ---------- + memory: Memory + WebAssembly memory instance. + + Returns + ------- + mod: Module + WebAssembly module wrapper. + + Examples + -------- + // Create a new memory instance: + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + + // Create a new routine: + > var mod = new {{alias}}.Module( mem ); + + // Initialize the routine: + > mod.initializeSync(); + + +{{alias}}.Module.prototype.binary + Read-only property which returns WebAssembly binary code. + + Returns + ------- + out: Uint8Array + WebAssembly binary code. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.binary + + + +{{alias}}.Module.prototype.memory + Read-only property which returns WebAssembly memory. + + Returns + ------- + mem: Memory|null + WebAssembly memory. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.memory + + + +{{alias}}.Module.prototype.buffer + Read-only property which returns a WebAssembly memory buffer as a + Uint8Array. + + Returns + ------- + buf: Uint8Array|null + WebAssembly memory buffer. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.buffer + + + +{{alias}}.Module.prototype.view + Read-only property which returns a WebAsssembly memory buffer as a DataView. + + Returns + ------- + view: DataView|null + WebAssembly memory view. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.view + + + +{{alias}}.Module.prototype.exports + Read-only property which returns "raw" WebAssembly module exports. + + Returns + ------- + out: Object|null + WebAssembly module exports. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.exports + {...} + + +{{alias}}.Module.prototype.initialize() + Asynchronously initializes a WebAssembly module instance. + + Returns + ------- + p: Promise + Promise which resolves upon initializing a WebAssembly module instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initialize(); + + +{{alias}}.Module.prototype.initializeAsync( clbk ) + Asynchronously initializes a WebAssembly module instance. + + Parameters + ---------- + clbk: Function + Callback to invoke upon initializing a WebAssembly module instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > function clbk() { console.log( 'done' ) }; + > mod.initializeAsync( clbk ); + + +{{alias}}.Module.prototype.initializeSync() + Synchronously initializes a WebAssembly module instance. + + In web browsers, JavaScript engines may raise an exception when attempting + to synchronously compile large WebAssembly binaries due to concerns about + blocking the main thread. Hence, to initialize WebAssembly modules having + large binaries (e.g., >4KiB), consider using asynchronous initialization + methods in browser contexts. + + Returns + ------- + mod: Module + Module wrapper instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + + +{{alias}}.Module.prototype.realloc( nbytes ) + Reallocates the underlying WebAssembly memory instance to a specified number + of bytes. + + WebAssembly memory can only *grow*, not shrink. Hence, if provided a number + of bytes which is less than or equal to the size of the current memory, the + function does nothing. + + When non-shared memory is resized, the underlying the `ArrayBuffer` is + detached, consequently invalidating any associated typed array views. Before + resizing non-shared memory, ensure that associated typed array views no + longer need byte access and can be garbage collected. + + Parameters + ---------- + nbytes: integer + Memory size (in bytes). + + Returns + ------- + bool: boolean + Boolean indicating whether the resize operation was successful. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ) + + + +{{alias}}.Module.prototype.hasCapacity( byteOffset, values ) + Returns a boolean indicating whether the underlying WebAssembly memory + instance has the capacity to store a provided list of values starting from a + specified byte offset. + + Parameters + ---------- + byteOffset: integer + Byte offset at which to start writing values. + + values: ArrayLikeObject + Input array containing values to write. + + Returns + ------- + bool: boolean + Boolean indicating whether the underlying WebAssembly memory instance + has enough capacity. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ); + > mod.hasCapacity( 0, [ 1, 2, 3, 4 ] ) + true + + +{{alias}}.Module.prototype.isView( values ) + Returns a boolean indicating whether a provided list of values is a view of + the underlying memory of the WebAssembly module. + + Parameters + ---------- + values: ArrayLikeObject + Input array. + + Returns + ------- + bool: boolean + Boolean indicating whether the list is a memory view. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ); + > mod.isView( [ 1, 2, 3, 4 ] ) + false + + +{{alias}}.Module.prototype.write( byteOffset, values ) + Writes values to the underlying WebAssembly memory instance. + + The function infers element size (i.e., number of bytes per element) from + the data type of the input array. For example, if provided a Float32Array, + the function writes each element as a single-precision floating-point number + to the underlying WebAssembly memory instance. + + In order to write elements as a different data type, you need to perform an + explicit cast *before* calling this method. For example, in order to write + single-precision floating-point numbers contained in a Float32Array as + signed 32-bit integers, you must first convert the Float32Array to an + Int32Array before passing the values to this method. + + If provided an array having an unknown or "generic" data type, elements are + written as double-precision floating-point numbers. + + Parameters + ---------- + byteOffset: integer + Byte offset at which to start writing values. + + values: ArrayLikeObject + Input array containing values to write. + + Returns + ------- + mod: Module + Module wrapper instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ); + > mod.write( 0, [ 1, 2, 3, 4 ] ); + + +{{alias}}.Module.prototype.read( byteOffset, out ) + Reads values from the underlying WebAssembly memory instance. + + The function infers element size (i.e., number of bytes per element) from + the data type of the output array. For example, if provided a Float32Array, + the function reads each element as a single-precision floating-point number + from the underlying WebAssembly memory instance. + + In order to read elements as a different data type, you need to perform an + explicit cast *after* calling this method. For example, in order to read + single-precision floating-point numbers contained in a Float32Array as + signed 32-bit integers, you must convert the Float32Array to an Int32Array + after reading memory values using this method. + + If provided an output array having an unknown or "generic" data type, + elements are read as double-precision floating-point numbers. + + Parameters + ---------- + byteOffset: integer + Byte offset at which to start reading values. + + out: ArrayLikeObject + Output array for storing read values. + + Returns + ------- + mod: Module + Module wrapper instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ); + > mod.write( 0, [ 1, 2, 3, 4 ] ); + > var out = [ 0, 0, 0, 0 ]; + > mod.read( 0, out ); + > out + [ 1, 2, 3, 4 ] + + +{{alias}}.Module.prototype.main( N, xp, sx ) + Computes the sum of the absolute values of the real and imaginary + components of a single-precision complex floating-point vector. + + Parameters + ---------- + N: integer + Number of indexed elements. + + xp: integer + Input array pointer (i.e., byte offset). + + sx: integer + Index increment for `cx`. + + Returns + ------- + sum: number + Sum of absolute values. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 1 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + + // Define a "pointer" (i.e., byte offset) into module memory: + > var xptr = 0; + + // Write data to module memory: + > mod.write( xptr, {{alias:@stdlib/array/one-to}}( 4, 'complex64' ) ); + + // Perform computation: + > var s = mod.main( 4, xptr, 1 ) + 10.0 + + +{{alias}}.Module.prototype.ndarray( N, xp, sx, ox ) + Computes the sum of the absolute values of the real and imaginary + components of a single-precision complex floating-point vector + using alternative indexing semantics. + + Parameters + ---------- + N: integer + Number of indexed elements. + + xp: integer + Input array pointer (i.e., byte offset). + + sx: integer + Index increment for `cx`. + + ox: integer + Starting index for `cx`. + + Returns + ------- + sum: number + Sum of absolute values. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 1 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + + // Define a "pointer" (i.e., byte offset) into module memory: + > var xptr = 0; + + // Write data to module memory: + > mod.write( xptr, {{alias:@stdlib/array/one-to}}( 4, 'complex64' ) ); + + // Perform computation: + > var s = mod.ndarray( 4, xptr, 1, 0 ) + 10.0 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts new file mode 100644 index 000000000000..3c505b6dacf3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -0,0 +1,317 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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 { ModuleWrapper, Memory } from '@stdlib/types/wasm'; +import { Complex64Array } from '@stdlib/types/array'; + +/** +* Interface defining a module constructor which is both "newable" and "callable". +*/ +interface ModuleConstructor { + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * + * // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new scasum.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex64'; + * + * // Specify a vector length: + * var N = 4; + * + * // Define pointer (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * + * // Perform computation: + * var out = mod.main( N, xptr, 1 ); + * // returns 10.0 + */ + new( mem: Memory ): Module; // newable + + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * + * // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = scasum.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex64'; + * + * // Specify a vector length: + * var N = 4; + * + * // Define pointer (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * + * // Perform computation: + * var out = mod.main( N, xptr, 1 ); + * // returns 10.0 + */ + ( mem: Memory ): Module; // callable +} + +/** +* Interface describing a `scasum` WebAssembly module. +*/ +interface Module extends ModuleWrapper { + /** + * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. + * + * @param N - number of indexed elements + * @param xptr - input array pointer (i.e., byte offset) + * @param strideX - `cx` stride length + * @returns sum of absolute values + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * + * // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new scasum.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex64'; + * + * // Specify a vector length: + * var N = 4; + * + * // Define pointer (i.e., byte offsets) for storing the input vector: + * var xptr = 0; + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * + * // Perform computation: + * var out = mod.main( N, xptr, 1 ); + * // returns 10.0 + */ + main( N: number, xptr: number, strideX: number ): number; + + /** + * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param xptr - input array pointer (i.e., byte offset) + * @param strideX - `cx` stride length + * @param offsetX - starting index for `cx` + * @returns sum of absolute values + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * + * // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new scasum.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex64'; + * + * // Specify a vector length: + * var N = 4; + * + * // Define pointer (i.e., byte offsets) for storing the input vector: + * var xptr = 0; + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * + * // Perform computation: + * var out = mod.ndarray( N, xptr, 1, 0 ); + * // returns 10.0 + */ + ndarray( N: number, xptr: number, strideX: number, offsetX: number ): number; +} + +/** +* Interface describing `scasum`. +*/ +interface Routine extends ModuleWrapper { + /** + * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. + * + * @param N - number of indexed elements + * @param cx - input array + * @param strideX - `cx` stride length + * @returns sum of absolute values + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); + * + * var out = scasum.main( cx.length, 5.0, cx, 1, y, 1 ); + * // returns 19.0 + */ + main( N: number, cx: Complex64Array, strideX: number ): number; + + /** + * Computes the sum of absolute values using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param cx - input array + * @param strideX - `cx` stride length + * @param offsetX - starting index for `cx` + * @returns sum of absolute values + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); + * + * var out = scasum.ndarray( cx.length, cx, 1, 0 ); + * // returns 19.0 + */ + ndarray( N: number, cx: Complex64Array, strideX: number, offsetX: number ): number; + + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * + * // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new scasum.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex64'; + * + * // Specify a vector length: + * var N = 4; + * + * // Define pointer (i.e., byte offsets) for storing the input vector: + * var xptr = 0; + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * + * // Perform computation: + * var out = mod.main( N, xptr, 1 ); + * // returns 10.0 + */ + Module: ModuleConstructor; +} + +/** +* Computes the sum of absolute values. +* +* @param N - number of indexed elements +* @param cx - input array +* @param strideX - `cx` stride length +* @returns sum of absolute values +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* var out = scasum.main( cx.length, cx, 1 ); +* // returns 21.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* var out = scasum.ndarray( cx.length, cx, 1, 0 ); +* // returns 21.0 +*/ +declare var scasum: Routine; + + +// EXPORTS // + +export = scasum; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts new file mode 100644 index 000000000000..fbdea7f945a2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts @@ -0,0 +1,348 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable space-in-parens */ + +import Complex64Array = require( '@stdlib/array/complex64' ); +import Memory = require( '@stdlib/wasm/memory' ); +import scasum = require( './index' ); + + +// TESTS // + +// Attached to the main export is a `main` method which returns a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.main( cx.length, cx, 1 ); // $ExpectType number +} + +// The compiler throws an error if the `main` method is provided a first argument which is not a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.main( '10', cx, 1 ); // $ExpectError + scasum.main( true, cx, 1 ); // $ExpectError + scasum.main( false, cx, 1 ); // $ExpectError + scasum.main( null, cx, 1 ); // $ExpectError + scasum.main( undefined, cx, 1 ); // $ExpectError + scasum.main( [], cx, 1 ); // $ExpectError + scasum.main( {}, cx, 1 ); // $ExpectError + scasum.main( ( cx: number ): number => cx, cx, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a second argument which is not a Complex64Array... +{ + const cx = new Complex64Array( 10 ); + + scasum.main( cx.length, 10, 1 ); // $ExpectError + scasum.main( cx.length, '10', 1 ); // $ExpectError + scasum.main( cx.length, true, 1 ); // $ExpectError + scasum.main( cx.length, false, 1 ); // $ExpectError + scasum.main( cx.length, null, 1 ); // $ExpectError + scasum.main( cx.length, undefined, 1 ); // $ExpectError + scasum.main( cx.length, [], 1 ); // $ExpectError + scasum.main( cx.length, {}, 1 ); // $ExpectError + scasum.main( cx.length, ( cx: number ): number => cx, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a third argument which is not a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.main( cx.length, cx, '10' ); // $ExpectError + scasum.main( cx.length, cx, true ); // $ExpectError + scasum.main( cx.length, cx, false ); // $ExpectError + scasum.main( cx.length, cx, null ); // $ExpectError + scasum.main( cx.length, cx, undefined ); // $ExpectError + scasum.main( cx.length, cx, [] ); // $ExpectError + scasum.main( cx.length, cx, {} ); // $ExpectError + scasum.main( cx.length, cx, ( cx: number ): number => cx ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided an unsupported number of arguments... +{ + const cx = new Complex64Array( 10 ); + + scasum.main(); // $ExpectError + scasum.main( cx.length ); // $ExpectError + scasum.main( cx.length, cx ); // $ExpectError + scasum.main( cx.length, cx, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray( cx.length, cx, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray( '10', cx, 1, 0 ); // $ExpectError + scasum.ndarray( true, cx, 1, 0 ); // $ExpectError + scasum.ndarray( false, cx, 1, 0 ); // $ExpectError + scasum.ndarray( null, cx, 1, 0 ); // $ExpectError + scasum.ndarray( undefined, cx, 1, 0 ); // $ExpectError + scasum.ndarray( [], cx, 1, 0 ); // $ExpectError + scasum.ndarray( {}, cx, 1, 0 ); // $ExpectError + scasum.ndarray( ( cx: number ): number => cx, cx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex64Array... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray( cx.length, 10, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, '10', 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, true, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, false, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, null, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, undefined, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, [], 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, {}, 1, 0 ); // $ExpectError + scasum.ndarray( cx.length, ( cx: number ): number => cx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray( cx.length, cx, '10', 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, true, 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, false, 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, null, 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, undefined, 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, [], 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, {}, 0 ); // $ExpectError + scasum.ndarray( cx.length, cx, ( cx: number ): number => cx, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray( cx.length, cx, 1, '10' ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, true ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, false ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, null ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, undefined ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, [] ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, {} ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, ( cx: number ): number => cx ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const cx = new Complex64Array( 10 ); + + scasum.ndarray(); // $ExpectError + scasum.ndarray( cx.length ); // $ExpectError + scasum.ndarray( cx.length, cx ); // $ExpectError + scasum.ndarray( cx.length, cx, 1 ); // $ExpectError + scasum.ndarray( cx.length, cx, 1, 0, 10 ); // $ExpectError +} + +// Attached to the main export is a `Module` constructor which returns a module... +{ + const mem = new Memory({ + 'initial': 0 + }); + + scasum.Module( mem ); // $ExpectType Module +} + +// The compiler throws an error if the `Module` constructor is not provided a WebAssembly memory instance... +{ + scasum.Module( '10' ); // $ExpectError + scasum.Module( true ); // $ExpectError + scasum.Module( false ); // $ExpectError + scasum.Module( null ); // $ExpectError + scasum.Module( undefined ); // $ExpectError + scasum.Module( [] ); // $ExpectError + scasum.Module( {} ); // $ExpectError + scasum.Module( ( cx: number ): number => cx ); // $ExpectError +} + +// The `Module` constructor returns a module instance having a `main` method which returns a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.main( 10, 0, 1 ); // $ExpectType number +} + +// The compiler throws an error if the `main` method of a module instance is provided a first argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.main( '10', 0, 1 ); // $ExpectError + mod.main( true, 0, 1 ); // $ExpectError + mod.main( false, 0, 1 ); // $ExpectError + mod.main( null, 0, 1 ); // $ExpectError + mod.main( undefined, 0, 1 ); // $ExpectError + mod.main( [], 0, 1 ); // $ExpectError + mod.main( {}, 0, 1 ); // $ExpectError + mod.main( ( cx: number ): number => cx, 0, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided a second argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.main( 10, '10', 1 ); // $ExpectError + mod.main( 10, true, 1 ); // $ExpectError + mod.main( 10, false, 1 ); // $ExpectError + mod.main( 10, null, 1 ); // $ExpectError + mod.main( 10, undefined, 1 ); // $ExpectError + mod.main( 10, [], 1 ); // $ExpectError + mod.main( 10, {}, 1 ); // $ExpectError + mod.main( 10, ( cx: number ): number => cx, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided a third argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.main( 10, 0, '10' ); // $ExpectError + mod.main( 10, 0, true ); // $ExpectError + mod.main( 10, 0, false ); // $ExpectError + mod.main( 10, 0, null ); // $ExpectError + mod.main( 10, 0, undefined ); // $ExpectError + mod.main( 10, 0, [] ); // $ExpectError + mod.main( 10, 0, {} ); // $ExpectError + mod.main( 10, 0, ( cx: number ): number => cx ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided an unsupported number of arguments... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.main(); // $ExpectError + mod.main( 10 ); // $ExpectError + mod.main( 10, 0 ); // $ExpectError + mod.main( 10, 0, 1, 10 ); // $ExpectError +} + +// The `Module` constructor returns a module instance having an `ndarray` method which returns a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray( 10, 0, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a first argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray( '10', 0, 1, 0 ); // $ExpectError + mod.ndarray( true, 0, 1, 0 ); // $ExpectError + mod.ndarray( false, 0, 1, 0 ); // $ExpectError + mod.ndarray( null, 0, 1, 0 ); // $ExpectError + mod.ndarray( undefined, 0, 1, 0 ); // $ExpectError + mod.ndarray( [], 0, 1, 0 ); // $ExpectError + mod.ndarray( {}, 0, 1, 0 ); // $ExpectError + mod.ndarray( ( cx: number ): number => cx, 0, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a second argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray( 10, '10', 1, 0 ); // $ExpectError + mod.ndarray( 10, true, 1, 0 ); // $ExpectError + mod.ndarray( 10, false, 1, 0 ); // $ExpectError + mod.ndarray( 10, null, 1, 0 ); // $ExpectError + mod.ndarray( 10, undefined, 1, 0 ); // $ExpectError + mod.ndarray( 10, [], 1, 0 ); // $ExpectError + mod.ndarray( 10, {}, 1, 0 ); // $ExpectError + mod.ndarray( 10, ( cx: number ): number => cx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a third argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray( 10, 0, '10', 0 ); // $ExpectError + mod.ndarray( 10, 0, true, 0 ); // $ExpectError + mod.ndarray( 10, 0, false, 0 ); // $ExpectError + mod.ndarray( 10, 0, null, 0 ); // $ExpectError + mod.ndarray( 10, 0, undefined, 0 ); // $ExpectError + mod.ndarray( 10, 0, [], 0 ); // $ExpectError + mod.ndarray( 10, 0, {}, 0 ); // $ExpectError + mod.ndarray( 10, 0, ( cx: number ): number => cx, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a fourth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray( 10, 0, 1, '10' ); // $ExpectError + mod.ndarray( 10, 0, 1, true ); // $ExpectError + mod.ndarray( 10, 0, 1, false ); // $ExpectError + mod.ndarray( 10, 0, 1, null ); // $ExpectError + mod.ndarray( 10, 0, 1, undefined ); // $ExpectError + mod.ndarray( 10, 0, 1, [] ); // $ExpectError + mod.ndarray( 10, 0, 1, {} ); // $ExpectError + mod.ndarray( 10, 0, 1, ( cx: number ): number => cx ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided an unsupported number of arguments... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = scasum.Module( mem ); + + mod.ndarray(); // $ExpectError + mod.ndarray( 10 ); // $ExpectError + mod.ndarray( 10, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js new file mode 100644 index 000000000000..d09a661925ae --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var oneTo = require( '@stdlib/array/one-to' ); +var scasum = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Specify a vector length: + var N = 4; + + // Create an input array: + var cx = oneTo( N, 'complex64' ); + + // Perform computation: + var sum = scasum.ndarray( N, cx, 1, 0 ); + + // Print the result: + console.log( sum ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js new file mode 100644 index 000000000000..79fe94f35798 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var gfillBy = require( '@stdlib/blas/ext/base/gfill-by' ); +var Float32ArrayLE = require( '@stdlib/array/little-endian-float32' ); +var scasum = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + var mem = new Memory({ + 'initial': 10, + 'maximum': 100 + }); + + // Create a BLAS routine: + var mod = new scasum.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Specify a vector length: + var N = 4; + + // Define a pointer (i.e., byte offset) for storing the input vector: + var xptr = 0; + + // Create a typed array view over module memory: + var x = new Float32ArrayLE( mod.memory.buffer, xptr, N*2 ); + + // Write values to module memory: + gfillBy( N*2, x, 1, discreteUniform( -10.0, 10.0 ) ); + + // Perform computation: + var sum = mod.ndarray( N, xptr, 1, 0 ); + + // Print the result: + console.log( sum ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js new file mode 100644 index 000000000000..39121c7da466 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var scasum = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): + var mem = new Memory({ + 'initial': 10, + 'maximum': 100 + }); + + // Create a BLAS routine: + var mod = new scasum.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Define a vector data type: + var dtype = 'complex64'; + + // Specify a vector length: + var N = 4; + + // Define a pointer (i.e., byte offset) for storing the input vector: + var xptr = 0; + + // Write vector values to module memory: + mod.write( xptr, oneTo( N, dtype ) ); + + // Perform computation: + var sum = mod.ndarray( N, xptr, 1, 0 ); + + // Print the result: + console.log( sum ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.browser.js new file mode 100644 index 000000000000..ebc6fbb92d20 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.browser.js @@ -0,0 +1,33 @@ +/** +* @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 base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); + + +// MAIN // + +var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGADf39/AX1gBH9/f38BfQIPAQNlbnYGbWVtb3J5AgAAAwQDAAECBzMDEV9fd2FzbV9jYWxsX2N0b3JzAAAIY19zY2FzdW0AARBjX3NjYXN1bV9uZGFycmF5AAIKfQMDAAELGgAgACABIAJBASAAayACbEEAIAJBAEwbEAILXAIBfQJ/AkAgAEEATARADAELIANBAXQhBSACQQF0IQJBACEDA0AgACADRg0BIAQgASAFQQJ0aiIGKgIAiyAGKgIEi5KSIQQgA0EBaiEDIAIgBWohBQwACwALIAQL' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js new file mode 100644 index 000000000000..6f02393f96e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js @@ -0,0 +1,34 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 readWASM = require( '@stdlib/fs/read-wasm' ).sync; + + +// MAIN // + +var wasm = readWASM( resolve( __dirname, '..', 'src', 'main.wasm' ) ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js new file mode 100644 index 000000000000..2554991d9c9d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +/** +* WebAssembly routine to compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. +* +* @module @stdlib/blas/base/wasm/scasum +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var scasum = require( '@stdlib/blas/base/wasm/scasum' ); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* // Perform operation: +* var sum = scasum.main( cx.length, cx, 1 ); +* // returns 19.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var scasum = require( '@stdlib/blas/base/wasm/scasum' ); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* // Perform operation: +* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* // returns 19.0 +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var scasum = require( '@stdlib/blas/base/wasm/scasum' ); +* +* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var mod = new scasum.Module( mem ); +* // returns +* +* // Initialize the routine: +* mod.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex64'; +* +* // Specify a vector length: +* var N = 4; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Write vector values to module memory: +* mod.write( xptr, oneTo( N, dtype ) ); +* +* // Perform computation: +* var sum = mod.main( N, xptr, 1 ); +* // returns 10.0 +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var Module = require( './module.js' ); + + +// MAIN // + +setReadOnly( main, 'Module', Module ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "Module": "main.Module" } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js new file mode 100644 index 000000000000..a017839be61a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 Routine = require( './routine.js' ); + + +// MAIN // + +/** +* WebAssembly module compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. +* +* @name scasum +* @type {Routine} +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* // Perform operation: +* var sum = scasum.main( cx.length, cx, 1 ); +* // returns 19.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* +* // Perform operation: +* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* // returns 19.0 +*/ +var scasum = new Routine(); +scasum.initializeSync(); // eslint-disable-line node/no-sync + + +// EXPORTS // + +module.exports = scasum; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js new file mode 100644 index 000000000000..2de4ab292b37 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js @@ -0,0 +1,198 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var isWebAssemblyMemory = require( '@stdlib/assert/is-wasm-memory' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherits = require( '@stdlib/utils/inherit' ); +var WasmModule = require( '@stdlib/wasm/module-wrapper' ); +var format = require( '@stdlib/string/format' ); +var wasmBinary = require( './binary.js' ); + + +// MAIN // + +/** +* BLAS routine WebAssembly module wrapper constructor. +* +* @constructor +* @param {Object} memory - WebAssembly memory instance +* @throws {TypeError} must provide a WebAssembly memory instance +* @returns {Module} module instance +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* +* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var scasum = new Module( mem ); +* // returns +* +* // Initialize the routine: +* scasum.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex64'; +* +* // Specify a vector length: +* var N = 4; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Write vector values to module memory: +* scasum.write( xptr, oneTo( N, dtype ) ); +* +* // Perform computation: +* var sum = scasum.main( N, xptr, 1 ); +* // returns 10.0 +*/ +function Module( memory ) { + if ( !( this instanceof Module ) ) { + return new Module( memory ); + } + if ( !isWebAssemblyMemory( memory ) ) { + throw new TypeError( format( 'invalid argument. Must provide a WebAssembly memory instance. Value: `%s`.', memory ) ); + } + // Call the parent constructor: + WasmModule.call( this, wasmBinary, memory, { + 'env': { + 'memory': memory + } + }); + + return this; +} + +// Inherit from the parent constructor: +inherits( Module, WasmModule ); + +/** +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. +* +* @name main +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) +* @param {integer} strideX - `cx` stride length +* @returns {number} sum of absolute values +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* +* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var scasum = new Module( mem ); +* // returns +* +* // Initialize the routine: +* scasum.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex64'; +* +* // Specify a vector length: +* var N = 4; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Write vector values to module memory: +* scasum.write( xptr, oneTo( N, dtype ) ); +* +* // Perform computation: +* var sum = scasum.main( N, xptr, 1 ); +* // returns 10.0 +*/ +setReadOnly( Module.prototype, 'main', function scasum( N, xptr, strideX ) { + return this._instance.exports.c_scasum( N, xptr, strideX ); +}); + +/** +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. +* +* @name ndarray +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) +* @param {integer} strideX - `cx` stride length +* @param {NonNegativeInteger} offsetX - starting index for `cx` +* @returns {number} sum of absolute values +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* +* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var scasum = new Module( mem ); +* // returns +* +* // Initialize the routine: +* scasum.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex64'; +* +* // Specify a vector length: +* var N = 4; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Write vector values to module memory: +* scasum.write( xptr, oneTo( N, dtype ) ); +* +* // Perform computation: +* var sum = scasum.ndarray( N, xptr, 1, 0 ); +* // returns 10.0 +*/ +setReadOnly( Module.prototype, 'ndarray', function scasum( N, xptr, strideX, offsetX ) { + return this._instance.exports.c_scasum_ndarray( N, xptr, strideX, offsetX ); +}); + + +// EXPORTS // + +module.exports = Module; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js new file mode 100644 index 000000000000..0d6758fab59a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js @@ -0,0 +1,166 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherits = require( '@stdlib/utils/inherit' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var Memory = require( '@stdlib/wasm/memory' ); +var arrays2ptrs = require( '@stdlib/wasm/base/arrays2ptrs' ); +var strided2object = require( '@stdlib/wasm/base/strided2object' ); +var Module = require( './module.js' ); + + +// MAIN // + +/** +* Routine constructor. +* +* @private +* @constructor +* @returns {Routine} routine instance +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Create a new routine: +* var scasum = new Routine(); +* +* // Initialize the module: +* scasum.initializeSync(); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* +* // Perform operation: +* var sum = scasum.main( cx.length, cx, 1 ); +* // returns 19.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Create a new routine: +* var scasum = new Routine(); +* +* // Initialize the module: +* scasum.initializeSync(); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* +* // Perform operation: +* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* // returns 19.0 +*/ +function Routine() { + if ( !( this instanceof Routine ) ) { + return new Routine(); + } + Module.call( this, new Memory({ + 'initial': 0 + })); + return this; +} + +// Inherit from the parent constructor: +inherits( Routine, Module ); + +/** +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. +* +* @name main +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Float32Array} cx - input array +* @param {integer} strideX - `cx` stride length +* @returns {number} sum of absolute values +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Create a new routine: +* var scasum = new Routine(); +* +* // Initialize the module: +* scasum.initializeSync(); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* +* // Perform operation: +* var sum = scasum.main( cx.length, cx, 1 ); +* // returns 19.0 +*/ +setReadOnly( Routine.prototype, 'main', function scasum( N, cx, strideX ) { + return this.ndarray( N, cx, strideX, stride2offset( N, strideX ) ); +}); + +/** +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. +* +* @name ndarray +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Float32Array} cx - input array +* @param {integer} strideX - `cx` stride length +* @param {NonNegativeInteger} offsetX - starting `cx` index +* @returns {number} sum of absolute values +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* // Create a new routine: +* var scasum = new Routine(); +* +* // Initialize the module: +* scasum.initializeSync(); +* +* // Define a strided array: +* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* +* // Perform operation: +* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* // returns 19.0 +*/ +setReadOnly( Routine.prototype, 'ndarray', function scasum( N, cx, strideX, offsetX ) { + var ptrs; + var p0; + + // Convert the input arrays to "pointers" in the module's memory: + ptrs = arrays2ptrs( this, [ + strided2object( N, cx, strideX, offsetX ) + ]); + p0 = ptrs[ 0 ]; + + // Perform computation by calling the corresponding parent method: + return Module.prototype.ndarray.call( this, N, p0.ptr, p0.stride, p0.offset ); +}); + + +// EXPORTS // + +module.exports = Routine; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/manifest.json b/lib/node_modules/@stdlib/blas/base/wasm/scasum/manifest.json new file mode 100644 index 000000000000..9c41d69e8615 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/manifest.json @@ -0,0 +1,36 @@ +{ + "options": {}, + "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": [ + { + "src": [], + "include": [], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/scasum" + ] + } + ] + } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json b/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json new file mode 100644 index 000000000000..7d173114da88 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json @@ -0,0 +1,80 @@ +{ + "name": "@stdlib/blas/base/wasm/scasum", + "version": "0.0.0", + "description": "Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "browser": { + "./lib/binary.js": "./lib/binary.browser.js" + }, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "scripts": "./scripts", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "level 1", + "scasum", + "linear", + "algebra", + "subroutines", + "sum", + "vector", + "array", + "ndarray", + "float32", + "float", + "float32array", + "webassembly", + "wasm" + ], + "__stdlib__": { + "wasm": true + } + } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/build.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/build.js new file mode 100644 index 000000000000..66bf9650b6d6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/build.js @@ -0,0 +1,66 @@ +#!/usr/bin/env node + +/** +* @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 resolve = require( 'path' ).resolve; +var readFile = require( '@stdlib/fs/read-file' ).sync; +var writeFile = require( '@stdlib/fs/write-file' ).sync; +var replace = require( '@stdlib/string/replace' ); +var currentYear = require( '@stdlib/time/current-year' ); + + +// VARIABLES // + +var wpath = resolve( __dirname, '..', 'src', 'main.wasm' ); +var tpath = resolve( __dirname, 'template.txt' ); +var opath = resolve( __dirname, '..', 'lib', 'binary.browser.js' ); + +var opts = { + 'encoding': 'utf8' +}; + +var PLACEHOLDER = '{{WASM_BASE64}}'; +var YEAR = '{{YEAR}}'; + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var wasm; + var tmpl; + + wasm = readFile( wpath ); + tmpl = readFile( tpath, opts ); + + tmpl = replace( tmpl, YEAR, currentYear().toString() ); + tmpl = replace( tmpl, PLACEHOLDER, wasm.toString( 'base64' ) ); + + writeFile( opath, tmpl, opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/template.txt new file mode 100644 index 000000000000..f66cdb9735b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/scripts/template.txt @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) {{YEAR}} 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 base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); + + +// MAIN // + +var wasm = base64ToUint8Array( '{{WASM_BASE64}}' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile new file mode 100644 index 000000000000..eb51121eec4c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile @@ -0,0 +1,243 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 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. +#/ + +#/ +# To compile targets listed in this Makefile, use top-level project `make` +# commands rather than commands listed in this Makefile. The top-level project +# `make` commands will ensure that various environment variables and flags are +# appropriately set. +#/ + +# 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 to WebAssembly: +ifdef EMCC_COMPILER + EMCC := $(EMCC_COMPILER) +else + EMCC := emcc +endif + +# Define the program used for compiling WebAssembly files to the WebAssembly text format: +ifdef WASM2WAT + WASM_TO_WAT := $(WASM2WAT) +else + WASM_TO_WAT := wasm2wat +endif + +# Define the program used for compiling WebAssembly files to JavaScript: +ifdef WASM2JS + WASM_TO_JS := $(WASM2JS) +else + WASM_TO_JS := wasm2js +endif + +# Define the path to the Node.js executable: +ifdef NODE + NODEJS := $(NODE) +else + NODEJS := node +endif + +# Define the integer size: +ifdef CBLAS_INT + INT_TYPE := $(CBLAS_INT) +else + INT_TYPE := int32_t +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -flto \ + -Wall \ + -pedantic \ + -D CBLAS_INT=$(INT_TYPE) + +# Define the command-line options when compiling C files to WebAssembly and asm.js: +EMCCFLAGS ?= $(CFLAGS) + +# Define shared `emcc` flags: +EMCC_SHARED_FLAGS := \ + -Oz \ + -fwasm-exceptions \ + -s SUPPORT_LONGJMP=1 \ + -s SIDE_MODULE=2 \ + -s EXPORTED_FUNCTIONS="$(shell cat exports.json | tr -d ' \t\n' | sed s/\"/\'/g)" + +# Define WebAssembly `emcc` flags: +EMCC_WASM_FLAGS := $(EMCC_SHARED_FLAGS) \ + -s WASM=1 \ + -s WASM_BIGINT=0 + +# 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 WebAssembly targets: +wasm_targets := main.wasm + +# List of WebAssembly WAT targets: +wat_targets := main.wat + +# List of WebAssembly JavaScript targets: +wasm_js_targets := main.wasm.js + +# List of other JavaScript targets: +browser_js_targets := ./../lib/binary.browser.js + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [EMCC_COMPILER] - EMCC compiler (e.g., `emcc`) +# @param {string} [EMCCFLAGS] - EMCC compiler options +# @param {string} [WASM2WAT] - WebAssembly text format compiler (e.g., `wasm2wat`) +# @param {string} [WASM2JS] - WebAssembly JavaScript compiler (e.g., `wasm2js`) +# @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: wasm + +.PHONY: all + +#/ +# Compiles source files to WebAssembly. +# +# @param {string} [EMCC_COMPILER] - EMCC compiler (e.g., `emcc`) +# @param {string} [EMCCFLAGS] - EMCC compiler options +# @param {string} [WASM2WAT] - WebAssembly text format compiler (e.g., `wasm2wat`) +# @param {string} [WASM2JS] - WebAssembly JavaScript compiler (e.g., `wasm2js`) +# @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 wasm +#/ +wasm: $(wasm_targets) $(wat_targets) $(browser_js_targets) + +.PHONY: wasm + +#/ +# Compiles C source files to WebAssembly binaries. +# +# @private +# @param {string} EMCC - EMCC compiler (e.g., `emcc`) +# @param {string} EMCCFLAGS - EMCC compiler options +# @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`) +#/ +$(wasm_targets): + $(QUIET) $(EMCC) $(EMCCFLAGS) $(EMCC_WASM_FLAGS) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) $(LIBRARIES) + +#/ +# Compiles WebAssembly binary files to the WebAssembly text format. +# +# @private +# @param {string} WASM2WAT - WAT compiler (e.g., `wasm2wat`) +#/ +$(wat_targets): %.wat: %.wasm + $(QUIET) $(WASM_TO_WAT) -o $@ $(wasm_targets) + +#/ +# Compiles WebAssembly binary files to JavaScript. +# +# @private +# @param {string} WASM2JS - JavaScript compiler (e.g., `wasm2js`) +#/ +$(wasm_js_targets): %.wasm.js: %.wasm + $(QUIET) $(WASM_TO_JS) -o $@ $(wasm_targets) + +#/ +# Generates an inline WebAssembly build for use in bundlers. +# +# @private +# @param {string} NODE - Node.js executable +#/ +$(browser_js_targets): $(wasm_targets) + $(QUIET) $(NODEJS) ./../scripts/build.js + +#/ +# Removes generated WebAssembly files. +# +# @example +# make clean-wasm +#/ +clean-wasm: + $(QUIET) -rm -f *.wasm *.wat *.wasm.js $(browser_js_targets) + +.PHONY: clean-wasm + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-wasm + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/exports.json b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/exports.json new file mode 100644 index 000000000000..c796f6f74e68 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/exports.json @@ -0,0 +1,4 @@ +[ + "_c_scasum", + "_c_scasum_ndarray" + ] diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wasm b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wasm new file mode 100755 index 0000000000000000000000000000000000000000..716f07244ac7a7457f08202b134efd6e778d77a7 GIT binary patch literal 249 zcmXv{u};HK3_RN}rQ#K}6&oymj0^~gA7~aPJ^|_FDeXX-q*4+<8LE6hw|+6sfCt~% zzB?oJ4Z&)?+>iBFdwh8%H_vo01yIN|O>{1tfg!I+4(-pPIW(tkWI&vN_~uQvG5%Uq zEK^;_ayWH8uq>foou>WNHIPp$l z3%6U5SIKDz*{mLd$%2SoRo?GNouy9;?sB~bH=C*;%9>RnTfxJt^M4iG BFMt35 literal 0 HcmV?d00001 diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wat b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wat new file mode 100644 index 000000000000..17fd6c3301ac --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/main.wat @@ -0,0 +1,93 @@ +;; @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. + +(module + (type (;0;) (func)) + (type (;1;) (func (param i32 i32 i32) (result f32))) + (type (;2;) (func (param i32 i32 i32 i32) (result f32))) + (import "env" "memory" (memory (;0;) 0)) + (func (;0;) (type 0) + nop) + (func (;1;) (type 1) (param i32 i32 i32) (result f32) + local.get 0 + local.get 1 + local.get 2 + i32.const 1 + local.get 0 + i32.sub + local.get 2 + i32.mul + i32.const 0 + local.get 2 + i32.const 0 + i32.le_s + select + call 2) + (func (;2;) (type 2) (param i32 i32 i32 i32) (result f32) + (local f32 i32 i32) + block ;; label = @1 + local.get 0 + i32.const 0 + i32.le_s + if ;; label = @2 + br 1 (;@1;) + end + local.get 3 + i32.const 1 + i32.shl + local.set 5 + local.get 2 + i32.const 1 + i32.shl + local.set 2 + i32.const 0 + local.set 3 + loop ;; label = @2 + local.get 0 + local.get 3 + i32.eq + br_if 1 (;@1;) + local.get 4 + local.get 1 + local.get 5 + i32.const 2 + i32.shl + i32.add + local.tee 6 + f32.load + f32.abs + local.get 6 + f32.load offset=4 + f32.abs + f32.add + f32.add + local.set 4 + local.get 3 + i32.const 1 + i32.add + local.set 3 + local.get 2 + local.get 5 + i32.add + local.set 5 + br 0 (;@2;) + end + unreachable + end + local.get 4) + (export "__wasm_call_ctors" (func 0)) + (export "c_scasum" (func 1)) + (export "c_scasum_ndarray" (func 2))) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js new file mode 100644 index 000000000000..9a07107df589 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 scasum = require( './../lib' ); + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scasum, 'object', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is a `main` method', function test( t ) { + t.strictEqual( typeof scasum.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is an `ndarray` method', function test( t ) { + t.strictEqual( typeof scasum.ndarray, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is a `Module` constructor', function test( t ) { + t.strictEqual( typeof scasum.Module, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the main export is a `Module` instance', function test( t ) { + t.strictEqual( scasum instanceof scasum.Module, true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js new file mode 100644 index 000000000000..16a6f5c1e488 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -0,0 +1,162 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 Complex64Array = require( '@stdlib/array/complex64' ); +var scasum = require( './../lib' ); + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scasum, 'object', 'main export is an object' ); + t.end(); +}); + +tape( 'the `main` method has an arity of 3', function test( t ) { + t.strictEqual( scasum.main.length, 3, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { + var cx; + var y; + + cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + y = scasum.main( cx.length, cx, 1 ); + + t.strictEqual( y, 19.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method supports an `cx` stride', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + -2.0, // 0 + 1.0, // 0 + 3.0, + -5.0, + 4.0, // 1 + 0.0, // 1 + -1.0, + -3.0 + ]); + N = 2; + + y = scasum.main( N, cx, 2 ); + + t.strictEqual( y, 7.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns `0.0`', function test( t ) { + var cx; + var y; + + cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + + y = scasum.main( -1, cx, 1 ); + t.deepEqual( y, 0.0, 'returns expected value' ); + + y = scasum.main( 0, cx, 1 ); + t.deepEqual( y, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the `main` method supports negative strides', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + -2.0, // 1 + 1.0, // 1 + 3.0, + -5.0, + 4.0, // 0 + 0.0, // 0 + -1.0, + -3.0, + 7.0, + 8.0 + ]); + N = 2; + + y = scasum.main( N, cx, -2 ); + + t.strictEqual( y, 7.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method supports complex access patterns', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + N = 2; + + y = scasum.main( N, cx, 2 ); + + t.strictEqual( y, 14.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method supports view offsets', function test( t ) { + var cx0; + var cx1; + var y; + var N; + + // Initial array... + cx0 = new Complex64Array([ + 1.0, + -2.0, + 3.0, // 0 + -4.0, // 0 + 5.0, + -6.0, + 7.0, // 1 + -8.0 // 1 + ]); + + // Create an offset view... + cx1 = new Complex64Array( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + + N = 2; + y = scasum.main( N, cx1, 2 ); + + t.strictEqual( y, 22.0, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js new file mode 100644 index 000000000000..9adcb07e22fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 Memory = require( '@stdlib/wasm/memory' ); +var ModuleWrapper = require( '@stdlib/wasm/module-wrapper' ); +var Module = require( './../lib' ).Module; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor which does not require `new`', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = Module( mem ); // eslint-disable-line new-cap + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module constructor throws an error if provided a first argument which is not a WebAssembly memory instance (new)', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return new Module( value ); + }; + } +}); + +tape( 'the module constructor throws an error if provided a first argument which is not a WebAssembly memory instance (no new)', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return Module( value ); // eslint-disable-line new-cap + }; + } +}); + +tape( 'the module instance returned by the module constructor inherits from a module wrapper', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( mod instanceof ModuleWrapper, true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is a `main` method', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( typeof mod.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is an `ndarray` method', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( typeof mod.ndarray, 'function', 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js new file mode 100644 index 000000000000..baf5d84d80fc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js @@ -0,0 +1,162 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable node/no-sync, max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Memory = require( '@stdlib/wasm/memory' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Module = require( './../lib' ).Module; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'a module instance has a `main` method which has an arity of 3', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod.main.length, 3, 'returns expected value' ); + t.end(); +}); + +tape( 'a module instance has a `main` method which computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { + var mem; + var mod; + var cxp; + var y; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + + y = mod.main( 4, cxp, 1 ); + t.strictEqual( y, 19.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has a `main` method which supports an `cx` stride', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, // 0 + 1.0, // 0 + 3.0, + -5.0, + 4.0, // 1 + 0.0, // 1 + -1.0, + -3.0 + ])); + N = 2; + + y = mod.main( N, cxp, 2 ); + t.strictEqual( y, 7.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has a `main` method which returns `0.0`', function test( t ) { + var mem; + var mod; + var cxp; + var y; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + + y = mod.main( -1, cxp, 1 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + y = mod.main( 0, cxp, 1 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has a `main` method which supports negative strides', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, // 1 + 1.0, // 1 + 3.0, + -5.0, + 4.0, // 0 + 0.0, // 0 + -1.0, + -3.0 + ])); + N = 2; + + y = mod.main( N, cxp, -2 ); + t.strictEqual( y, 7.0, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js new file mode 100644 index 000000000000..4bb3796755dd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js @@ -0,0 +1,230 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable node/no-sync, max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Memory = require( '@stdlib/wasm/memory' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Module = require( './../lib' ).Module; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which has an arity of 4', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod.ndarray.length, 4, 'returns expected value' ); + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { + var mem; + var mod; + var cxp; + var y; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + + y = mod.ndarray( 4, cxp, 1, 0 ); + t.strictEqual( y, 19.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports an `cx` stride', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, // 0 + 1.0, // 0 + 3.0, + -5.0, + 4.0, // 1 + 0.0, // 1 + -1.0, + -3.0 + ])); + N = 2; + + y = mod.ndarray( N, cxp, 2, 0 ); + t.strictEqual( y, 7.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports an `cx` offset', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, + 1.0, + 3.0, + -5.0, + 4.0, // 0 + 0.0, // 0 + -1.0, // 1 + -3.0 // 1 + ])); + N = 2; + + y = mod.ndarray( N, cxp, 1, 2 ); + t.strictEqual( y, 8.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has an `ndarray` method which returns `0.0`', function test( t ) { + var mem; + var mod; + var cxp; + var y; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + + y = mod.ndarray( -1, 3.0, cxp, 1, 0 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + y = mod.ndarray( 0, 3.0, cxp, 1, 0 ); + t.strictEqual( y, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports negative strides', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, + 1.0, + 3.0, // 1 + -5.0, // 1 + 4.0, + 0.0, + -1.0, // 0 + -3.0 // 0 + ])); + N = 2; + + y = mod.ndarray( N, cxp, -2, 3 ); + t.strictEqual( y, 12.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports complex access patterns', function test( t ) { + var mem; + var mod; + var cxp; + var y; + var N; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + cxp = 0; + + mod.write( cxp, new Complex64Array([ + -2.0, + 1.0, + 3.0, // 1 + -5.0, // 1 + 4.0, + 0.0, + -1.0, // 0 + -3.0, // 0 + 7.0, + 8.0 + ])); + N = 2; + + y = mod.ndarray( N, cxp, -2, 3 ); + t.strictEqual( y, 12.0, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js new file mode 100644 index 000000000000..e3d40c0b87f8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js @@ -0,0 +1,157 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 Complex64Array = require( '@stdlib/array/complex64' ); +var scasum = require( './../lib' ); + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scasum, 'object', 'main export is an object' ); + t.end(); +}); + +tape( 'the `ndarray` method has an arity of 4', function test( t ) { + t.strictEqual( scasum.ndarray.length, 4, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { + var cx; + var y; + + cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + y = scasum.ndarray( cx.length, cx, 1, 0 ); + + t.strictEqual( y, 19.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method supports an `cx` stride', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + -2.0, // 0 + 1.0, // 0 + 3.0, + -5.0, + 4.0, // 1 + 0.0, // 1 + -1.0, + -3.0 + ]); + N = 2; + + y = scasum.ndarray( N, cx, 2, 0 ); + + t.strictEqual( y, 7.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `main` method supports an `cx` offset', function test( t ) { + var cx; + var y; + + cx = new Complex64Array([ + 1.0, + 2.0, + 3.0, // 1 + 4.0, // 1 + 5.0, // 2 + 6.0, // 2 + 7.0, // 3 + 8.0, // 3 + 9.0, + 10.0 + ]); + + y = scasum.ndarray( 3, cx, 1, 1 ); + + t.strictEqual( y, 33.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns `0.0`', function test( t ) { + var cx; + var y; + + cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + + y = scasum.ndarray( -1, cx, 1, 0 ); + t.deepEqual( y, 0.0, 'returns expected value' ); + + y = scasum.ndarray( 0, cx, 1, 0 ); + t.deepEqual( y, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the `main` method supports negative strides', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + -2.0, + 1.0, + 3.0, // 1 + -5.0, // 1 + 4.0, + 0.0, + -1.0, // 0 + -3.0 // 0 + ]); + N = 2; + + y = scasum.ndarray( N, cx, -2, 3 ); + + t.strictEqual( y, 12.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the `ndarray` method supports complex access patterns', function test( t ) { + var cx; + var y; + var N; + + cx = new Complex64Array([ + -2.0, // 1 + 1.0, // 1 + 3.0, + -5.0, + 4.0, // 0 + 0.0, // 0 + -1.0, + -3.0 + ]); + N = 2; + + y = scasum.ndarray( N, cx, -2, 2 ); + + t.strictEqual( y, 7.0, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js new file mode 100644 index 000000000000..56a4b67daaf0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 ModuleWrapper = require( '@stdlib/wasm/module-wrapper' ); +var Module = require( './../lib/module.js' ); +var Routine = require( './../lib/routine.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Routine, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof Routine, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor which does not require `new`', function test( t ) { + var mod = Routine(); // eslint-disable-line new-cap + t.strictEqual( mod instanceof Routine, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module instance returned by the constructor inherits from a module wrapper', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof ModuleWrapper, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module instance returned by the constructor inherits from a BLAS routine module', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is a `main` method', function test( t ) { + var mod = new Routine(); + t.strictEqual( typeof mod.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is an `ndarray` method', function test( t ) { + var mod = new Routine(); + t.strictEqual( typeof mod.ndarray, 'function', 'returns expected value' ); + t.end(); +}); From fc014dab2600a6fab9e25f8373c3f9bd2ce0ecb4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sat, 22 Mar 2025 09:48:17 +0000 Subject: [PATCH 02/17] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md | 2 +- .../@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js | 2 +- .../blas/base/wasm/scasum/benchmark/benchmark.module.main.js | 2 +- .../blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js | 2 +- .../blas/base/wasm/scasum/benchmark/benchmark.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts | 2 +- .../@stdlib/blas/base/wasm/scasum/docs/types/test.ts | 2 +- .../@stdlib/blas/base/wasm/scasum/examples/index.js | 2 +- .../blas/base/wasm/scasum/examples/little_endian_arrays.js | 2 +- .../@stdlib/blas/base/wasm/scasum/examples/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile | 2 +- lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.main.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.module.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.module.main.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/scasum/test/test.routine.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index 16018cfccb94..37ba076123c5 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 The Stdlib Authors. +Copyright (c) 2025 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js index 96ac9372150a..89b7374886ca 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js index 6e1f4459d831..897c82ecc971 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js index 061f90eccb7b..06c214ebdea8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js index 564d12ae36bd..4453c6134c48 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js index 0dddfda89466..9593d8a9a94f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts index 3c505b6dacf3..a740669872c8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts index fbdea7f945a2..8711cf7b9b73 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js index d09a661925ae..a464898bb666 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js index 79fe94f35798..109264d13034 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/little_endian_arrays.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js index 39121c7da466..79df3173e93e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js index 6f02393f96e5..2b83fe651780 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/binary.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js index 2554991d9c9d..297b5f7b9406 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js index a017839be61a..ce12da363d6f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js index 2de4ab292b37..cc48d295c4e4 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js index 0d6758fab59a..4be6701672e5 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile index eb51121eec4c..1b1f35347760 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js index 9a07107df589..9b51463c9c83 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js index 16a6f5c1e488..44413927a544 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js index 9adcb07e22fa..0cdcd97ef151 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js index baf5d84d80fc..37a7170d8310 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js index 4bb3796755dd..8187c312da37 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js index e3d40c0b87f8..fca67b388988 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js index 56a4b67daaf0..d90a5804a8e1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.routine.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From b689bd6b59c6570e756af4c8b1acc3cf5453b163 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 22 Mar 2025 15:26:44 +0530 Subject: [PATCH 03/17] fix: markdown example Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index 37ba076123c5..c814d3dcb0af 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -256,6 +256,7 @@ The function has the following additional parameters: var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var filledarrayBy = require( '@stdlib/array/filled-by' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var scasum = require( '@stdlib/blas/base/wasm/scasum' ); function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); @@ -264,7 +265,7 @@ function rand() { var cx = filledarrayBy( 10, 'complex64', rand ); console.log( cx.toString() ); -var out = scasum( cx.length, cx, 1 ); +var out = scasum.ndarray( cx.length, cx, 1 ); console.log( out ); ``` From 160d9f06de019a8085648025019d38f90137cb54 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 22 Mar 2025 15:34:23 +0530 Subject: [PATCH 04/17] fix: package.json lint errors --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/scasum/README.md | 2 +- .../blas/base/wasm/scasum/package.json | 150 +++++++++--------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index c814d3dcb0af..d3d10199f9ca 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -265,7 +265,7 @@ function rand() { var cx = filledarrayBy( 10, 'complex64', rand ); console.log( cx.toString() ); -var out = scasum.ndarray( cx.length, cx, 1 ); +var out = scasum.ndarray( cx.length, cx, 1, 0 ); console.log( out ); ``` diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json b/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json index 7d173114da88..0d13d788a833 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/package.json @@ -1,80 +1,80 @@ { - "name": "@stdlib/blas/base/wasm/scasum", - "version": "0.0.0", - "description": "Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector.", - "license": "Apache-2.0", - "author": { + "name": "@stdlib/blas/base/wasm/scasum", + "version": "0.0.0", + "description": "Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { "name": "The Stdlib Authors", "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "browser": { - "./lib/binary.js": "./lib/binary.browser.js" - }, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "scripts": "./scripts", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "blas", - "level 1", - "scasum", - "linear", - "algebra", - "subroutines", - "sum", - "vector", - "array", - "ndarray", - "float32", - "float", - "float32array", - "webassembly", - "wasm" - ], - "__stdlib__": { - "wasm": true } + ], + "main": "./lib", + "browser": { + "./lib/binary.js": "./lib/binary.browser.js" + }, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "scripts": "./scripts", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "level 1", + "scasum", + "linear", + "algebra", + "subroutines", + "sum", + "vector", + "array", + "ndarray", + "complex64", + "complex", + "complex64array", + "webassembly", + "wasm" + ], + "__stdlib__": { + "wasm": true } +} From f26444e9d8df1eaa38a3d383ddcbe7156af97432 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 20 Jun 2025 17:42:36 +0530 Subject: [PATCH 05/17] chore: change variable naming --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: 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: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/scasum/README.md | 44 ++--- .../base/wasm/scasum/benchmark/benchmark.js | 4 +- .../scasum/benchmark/benchmark.module.main.js | 6 +- .../benchmark/benchmark.module.ndarray.js | 6 +- .../scasum/benchmark/benchmark.ndarray.js | 4 +- .../blas/base/wasm/scasum/docs/repl.txt | 40 ++-- .../base/wasm/scasum/docs/types/index.d.ts | 40 ++-- .../blas/base/wasm/scasum/docs/types/test.ts | 186 +++++++++--------- .../blas/base/wasm/scasum/examples/index.js | 4 +- .../blas/base/wasm/scasum/lib/index.js | 8 +- .../@stdlib/blas/base/wasm/scasum/lib/main.js | 8 +- .../blas/base/wasm/scasum/lib/module.js | 6 +- .../blas/base/wasm/scasum/lib/routine.js | 34 ++-- .../blas/base/wasm/scasum/test/test.main.js | 44 ++--- .../base/wasm/scasum/test/test.module.main.js | 36 ++-- .../wasm/scasum/test/test.module.ndarray.js | 54 ++--- .../base/wasm/scasum/test/test.ndarray.js | 42 ++-- 17 files changed, 283 insertions(+), 283 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index d3d10199f9ca..c34f3c0ff411 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -30,33 +30,33 @@ limitations under the License. var scasum = require( '@stdlib/blas/base/wasm/scasum' ); ``` -#### scasum.main( N, cx, stride ) +#### scasum.main( N, x, strideX ) Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); -var sum = scasum.main( cx.length, cx, 1 ); +var sum = scasum.main( x.length, x, 1 ); // returns 19.0 ``` The function has the following parameters: - **N**: number of indexed elements. -- **cx**: input [`Complex64Array`][@stdlib/array/complex64]. -- **strideX**: index increment for `cx`. +- **x**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: index increment for `x`. The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to compute the sum of every other value, ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = scasum.main( 2, cx, 2 ); +var sum = scasum.main( 2, x, 2 ); // returns 7.0 ``` @@ -68,44 +68,44 @@ Note that indexing is relative to the first index. To introduce an offset, use [ var Complex64Array = require( '@stdlib/array/complex64' ); // Initial array: -var cx0 = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, 8.0 ] ); +var x0 = new Complex64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, 8.0 ] ); // Create a typed array view: -var cx1 = new Complex64Array( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var sum = scasum.main( 2, cx1, 2 ); +var sum = scasum.main( 2, x1, 2 ); // returns 22.0 ``` -#### scasum.ndarray( N, cx, strideX, offsetX ) +#### scasum.ndarray( N, x, strideX, offsetX ) Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +var sum = scasum.ndarray( x.length, x, 1, 0 ); // returns 19.0 ``` The function has the following additional parameters: -- **offsetX**: starting index for `cx`. +- **offsetX**: starting index for `x`. 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 compute the sum of last three elements, ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); +var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = scasum.ndarray( 2, cx, 1, cx.length-2 ); +var sum = scasum.ndarray( 2, x, 1, x.length-2 ); // returns 8.0 // Using a negative stride to sum from the last element: -sum = scasum.ndarray( 4, cx, -1, cx.length-1 ); +sum = scasum.ndarray( 4, x, -1, x.length-1 ); // returns 19.0 ``` @@ -180,7 +180,7 @@ The function has the following parameters: - **N**: number of indexed elements. - **xp**: input [`Complex64Array`][@stdlib/array/complex64] pointer (i.e., byte offset). -- **sx**: index increment for `cx`. +- **sx**: index increment for `x`. #### scasum.Module.prototype.ndarray( N, xp, sx, ox ) @@ -224,7 +224,7 @@ var sum = mod.ndarray( N, xptr, 1, 0 ); The function has the following additional parameters: -- **ox**: starting index for `cx`. +- **ox**: starting index for `x`. @@ -262,10 +262,10 @@ function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -var cx = filledarrayBy( 10, 'complex64', rand ); -console.log( cx.toString() ); +var x = filledarrayBy( 10, 'complex64', rand ); +console.log( x.toString() ); -var out = scasum.ndarray( cx.length, cx, 1, 0 ); +var out = scasum.ndarray( x.length, x, 1, 0 ); console.log( out ); ``` diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js index 89b7374886ca..35801f5e00f1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.js @@ -50,7 +50,7 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var cx = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); + var x = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); return benchmark; /** @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - sum = scasum.main( cx.length, cx, 1 ); + sum = scasum.main( x.length, x, 1 ); if ( isnanf( sum ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js index 06c214ebdea8..8e76ef09c1be 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -66,7 +66,7 @@ function createBenchmark( len ) { var mem; var sum; var nb; - var cx; + var x; var N; var i; @@ -88,10 +88,10 @@ function createBenchmark( len ) { // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; - cx = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); + x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); // Write random values to module memory: - mod.write( xptr, cx ); + mod.write( xptr, x ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js index 4453c6134c48..993359229f3e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js @@ -66,7 +66,7 @@ function createBenchmark( len ) { var mem; var sum; var nb; - var cx; + var x; var N; var i; @@ -88,10 +88,10 @@ function createBenchmark( len ) { // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; - cx = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); + x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); // Write random values to module memory: - mod.write( xptr, cx ); + mod.write( xptr, x ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js index 9593d8a9a94f..cd77c51dd6ce 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.ndarray.js @@ -50,7 +50,7 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var cx = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); + var x = new Complex64Array( uniform( len*2, -10.0, 10.0, options ) ); return benchmark; /** @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - sum = scasum.ndarray( cx.length, cx, 1, 0 ); + sum = scasum.ndarray( x.length, x, 1, 0 ); if ( isnanf( sum ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt index c97b1eb6e135..b6fa5a7bbd6e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}.main( N, cx, strideX ) +{{alias}}.main( N, x, strideX ) Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. @@ -16,11 +16,11 @@ N: integer Number of indexed elements. - cx: Complex64Array + x: Complex64Array Input array. strideX: integer - Index increment for `cx`. + Index increment for `x`. Returns ------- @@ -30,22 +30,22 @@ Examples -------- // Standard usage: - > var cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); - > var s = {{alias}}.main( cx.length, cx, 1 ) + > var x = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var s = {{alias}}.main( x.length, x, 1 ) 15.0 // Using `N` and stride parameters: - > s = {{alias}}.main( 2, cx, 2 ) + > s = {{alias}}.main( 2, x, 2 ) 7.0 // Use view offset; e.g., starting at 2nd element: - > var cx0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); - > var cx1 = new {{alias:@stdlib/array/complex64}}( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); - > s = {{alias}}.main( 2, cx1, 2 ) + > var x0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); + > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > s = {{alias}}.main( 2, x1, 2 ) 22.0 -{{alias}}.ndarray( N, cx, strideX, offsetX ) +{{alias}}.ndarray( N, x, strideX, offsetX ) Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. @@ -59,14 +59,14 @@ N: integer Number of indexed elements. - cx: Complex64Array + x: Complex64Array Input array. strideX: integer - Index increment for `cx`. + Index increment for `x`. offsetX: integer - Starting index for `cx`. + Starting index for `x`. Returns ------- @@ -76,13 +76,13 @@ Examples -------- // Standard usage: - > var cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); - > var s = {{alias}}.ndarray( cx.length, cx, 1, 0 ) + > var x = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > var s = {{alias}}.ndarray( x.length, x, 1, 0 ) 15.0 // Using offset parameter: - > cx = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); - > s = {{alias}}.ndarray( 3, cx, -1, cx.length-1 ) + > x = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); + > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) 15.0 @@ -430,7 +430,7 @@ Input array pointer (i.e., byte offset). sx: integer - Index increment for `cx`. + Index increment for `x`. Returns ------- @@ -468,10 +468,10 @@ Input array pointer (i.e., byte offset). sx: integer - Index increment for `cx`. + Index increment for `x`. ox: integer - Starting index for `cx`. + Starting index for `x`. Returns ------- diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts index a740669872c8..872894ff23ae 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -119,7 +119,7 @@ interface Module extends ModuleWrapper { * * @param N - number of indexed elements * @param xptr - input array pointer (i.e., byte offset) - * @param strideX - `cx` stride length + * @param strideX - `x` stride length * @returns sum of absolute values * * @example @@ -162,8 +162,8 @@ interface Module extends ModuleWrapper { * * @param N - number of indexed elements * @param xptr - input array pointer (i.e., byte offset) - * @param strideX - `cx` stride length - * @param offsetX - starting index for `cx` + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` * @returns sum of absolute values * * @example @@ -210,38 +210,38 @@ interface Routine extends ModuleWrapper { * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. * * @param N - number of indexed elements - * @param cx - input array - * @param strideX - `cx` stride length + * @param x - input array + * @param strideX - `x` stride length * @returns sum of absolute values * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * - * var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); + * var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * - * var out = scasum.main( cx.length, 5.0, cx, 1, y, 1 ); + * var out = scasum.main( x.length, 5.0, x, 1, y, 1 ); * // returns 19.0 */ - main( N: number, cx: Complex64Array, strideX: number ): number; + main( N: number, x: Complex64Array, strideX: number ): number; /** * Computes the sum of absolute values using alternative indexing semantics. * * @param N - number of indexed elements - * @param cx - input array - * @param strideX - `cx` stride length - * @param offsetX - starting index for `cx` + * @param x - input array + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` * @returns sum of absolute values * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * - * var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); + * var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * - * var out = scasum.ndarray( cx.length, cx, 1, 0 ); + * var out = scasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ - ndarray( N: number, cx: Complex64Array, strideX: number, offsetX: number ): number; + ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number ): number; /** * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. @@ -289,24 +289,24 @@ interface Routine extends ModuleWrapper { * Computes the sum of absolute values. * * @param N - number of indexed elements -* @param cx - input array -* @param strideX - `cx` stride length +* @param x - input array +* @param strideX - `x` stride length * @returns sum of absolute values * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * -* var out = scasum.main( cx.length, cx, 1 ); +* var out = scasum.main( x.length, x, 1 ); * // returns 21.0 * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * -* var out = scasum.ndarray( cx.length, cx, 1, 0 ); +* var out = scasum.ndarray( x.length, x, 1, 0 ); * // returns 21.0 */ declare var scasum: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts index 8711cf7b9b73..ac139bb993b3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/test.ts @@ -27,137 +27,137 @@ import scasum = require( './index' ); // Attached to the main export is a `main` method which returns a number... { - const cx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); - scasum.main( cx.length, cx, 1 ); // $ExpectType number + scasum.main( x.length, x, 1 ); // $ExpectType number } // The compiler throws an error if the `main` method is provided a first argument which is not a number... { - const cx = new Complex64Array( 10 ); - - scasum.main( '10', cx, 1 ); // $ExpectError - scasum.main( true, cx, 1 ); // $ExpectError - scasum.main( false, cx, 1 ); // $ExpectError - scasum.main( null, cx, 1 ); // $ExpectError - scasum.main( undefined, cx, 1 ); // $ExpectError - scasum.main( [], cx, 1 ); // $ExpectError - scasum.main( {}, cx, 1 ); // $ExpectError - scasum.main( ( cx: number ): number => cx, cx, 1 ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.main( '10', x, 1 ); // $ExpectError + scasum.main( true, x, 1 ); // $ExpectError + scasum.main( false, x, 1 ); // $ExpectError + scasum.main( null, x, 1 ); // $ExpectError + scasum.main( undefined, x, 1 ); // $ExpectError + scasum.main( [], x, 1 ); // $ExpectError + scasum.main( {}, x, 1 ); // $ExpectError + scasum.main( ( x: number ): number => x, x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method is provided a second argument which is not a Complex64Array... { - const cx = new Complex64Array( 10 ); - - scasum.main( cx.length, 10, 1 ); // $ExpectError - scasum.main( cx.length, '10', 1 ); // $ExpectError - scasum.main( cx.length, true, 1 ); // $ExpectError - scasum.main( cx.length, false, 1 ); // $ExpectError - scasum.main( cx.length, null, 1 ); // $ExpectError - scasum.main( cx.length, undefined, 1 ); // $ExpectError - scasum.main( cx.length, [], 1 ); // $ExpectError - scasum.main( cx.length, {}, 1 ); // $ExpectError - scasum.main( cx.length, ( cx: number ): number => cx, 1 ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.main( x.length, 10, 1 ); // $ExpectError + scasum.main( x.length, '10', 1 ); // $ExpectError + scasum.main( x.length, true, 1 ); // $ExpectError + scasum.main( x.length, false, 1 ); // $ExpectError + scasum.main( x.length, null, 1 ); // $ExpectError + scasum.main( x.length, undefined, 1 ); // $ExpectError + scasum.main( x.length, [], 1 ); // $ExpectError + scasum.main( x.length, {}, 1 ); // $ExpectError + scasum.main( x.length, ( x: number ): number => x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method is provided a third argument which is not a number... { - const cx = new Complex64Array( 10 ); - - scasum.main( cx.length, cx, '10' ); // $ExpectError - scasum.main( cx.length, cx, true ); // $ExpectError - scasum.main( cx.length, cx, false ); // $ExpectError - scasum.main( cx.length, cx, null ); // $ExpectError - scasum.main( cx.length, cx, undefined ); // $ExpectError - scasum.main( cx.length, cx, [] ); // $ExpectError - scasum.main( cx.length, cx, {} ); // $ExpectError - scasum.main( cx.length, cx, ( cx: number ): number => cx ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.main( x.length, x, '10' ); // $ExpectError + scasum.main( x.length, x, true ); // $ExpectError + scasum.main( x.length, x, false ); // $ExpectError + scasum.main( x.length, x, null ); // $ExpectError + scasum.main( x.length, x, undefined ); // $ExpectError + scasum.main( x.length, x, [] ); // $ExpectError + scasum.main( x.length, x, {} ); // $ExpectError + scasum.main( x.length, x, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `main` method is provided an unsupported number of arguments... { - const cx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); scasum.main(); // $ExpectError - scasum.main( cx.length ); // $ExpectError - scasum.main( cx.length, cx ); // $ExpectError - scasum.main( cx.length, cx, 1, 10 ); // $ExpectError + scasum.main( x.length ); // $ExpectError + scasum.main( x.length, x ); // $ExpectError + scasum.main( x.length, x, 1, 10 ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a number... { - const cx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); - scasum.ndarray( cx.length, cx, 1, 0 ); // $ExpectType number + scasum.ndarray( x.length, x, 1, 0 ); // $ExpectType number } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... { - const cx = new Complex64Array( 10 ); - - scasum.ndarray( '10', cx, 1, 0 ); // $ExpectError - scasum.ndarray( true, cx, 1, 0 ); // $ExpectError - scasum.ndarray( false, cx, 1, 0 ); // $ExpectError - scasum.ndarray( null, cx, 1, 0 ); // $ExpectError - scasum.ndarray( undefined, cx, 1, 0 ); // $ExpectError - scasum.ndarray( [], cx, 1, 0 ); // $ExpectError - scasum.ndarray( {}, cx, 1, 0 ); // $ExpectError - scasum.ndarray( ( cx: number ): number => cx, cx, 1, 0 ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.ndarray( '10', x, 1, 0 ); // $ExpectError + scasum.ndarray( true, x, 1, 0 ); // $ExpectError + scasum.ndarray( false, x, 1, 0 ); // $ExpectError + scasum.ndarray( null, x, 1, 0 ); // $ExpectError + scasum.ndarray( undefined, x, 1, 0 ); // $ExpectError + scasum.ndarray( [], x, 1, 0 ); // $ExpectError + scasum.ndarray( {}, x, 1, 0 ); // $ExpectError + scasum.ndarray( ( x: number ): number => x, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex64Array... { - const cx = new Complex64Array( 10 ); - - scasum.ndarray( cx.length, 10, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, '10', 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, true, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, false, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, null, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, undefined, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, [], 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, {}, 1, 0 ); // $ExpectError - scasum.ndarray( cx.length, ( cx: number ): number => cx, 1, 0 ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.ndarray( x.length, 10, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, '10', 1, 0 ); // $ExpectError + scasum.ndarray( x.length, true, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, false, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, null, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, undefined, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, [], 1, 0 ); // $ExpectError + scasum.ndarray( x.length, {}, 1, 0 ); // $ExpectError + scasum.ndarray( x.length, ( x: number ): number => x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... { - const cx = new Complex64Array( 10 ); - - scasum.ndarray( cx.length, cx, '10', 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, true, 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, false, 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, null, 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, undefined, 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, [], 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, {}, 0 ); // $ExpectError - scasum.ndarray( cx.length, cx, ( cx: number ): number => cx, 0 ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.ndarray( x.length, x, '10', 0 ); // $ExpectError + scasum.ndarray( x.length, x, true, 0 ); // $ExpectError + scasum.ndarray( x.length, x, false, 0 ); // $ExpectError + scasum.ndarray( x.length, x, null, 0 ); // $ExpectError + scasum.ndarray( x.length, x, undefined, 0 ); // $ExpectError + scasum.ndarray( x.length, x, [], 0 ); // $ExpectError + scasum.ndarray( x.length, x, {}, 0 ); // $ExpectError + scasum.ndarray( x.length, x, ( x: number ): number => x, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... { - const cx = new Complex64Array( 10 ); - - scasum.ndarray( cx.length, cx, 1, '10' ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, true ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, false ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, null ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, undefined ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, [] ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, {} ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, ( cx: number ): number => cx ); // $ExpectError + const x = new Complex64Array( 10 ); + + scasum.ndarray( x.length, x, 1, '10' ); // $ExpectError + scasum.ndarray( x.length, x, 1, true ); // $ExpectError + scasum.ndarray( x.length, x, 1, false ); // $ExpectError + scasum.ndarray( x.length, x, 1, null ); // $ExpectError + scasum.ndarray( x.length, x, 1, undefined ); // $ExpectError + scasum.ndarray( x.length, x, 1, [] ); // $ExpectError + scasum.ndarray( x.length, x, 1, {} ); // $ExpectError + scasum.ndarray( x.length, x, 1, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... { - const cx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); scasum.ndarray(); // $ExpectError - scasum.ndarray( cx.length ); // $ExpectError - scasum.ndarray( cx.length, cx ); // $ExpectError - scasum.ndarray( cx.length, cx, 1 ); // $ExpectError - scasum.ndarray( cx.length, cx, 1, 0, 10 ); // $ExpectError + scasum.ndarray( x.length ); // $ExpectError + scasum.ndarray( x.length, x ); // $ExpectError + scasum.ndarray( x.length, x, 1 ); // $ExpectError + scasum.ndarray( x.length, x, 1, 0, 10 ); // $ExpectError } // Attached to the main export is a `Module` constructor which returns a module... @@ -178,7 +178,7 @@ import scasum = require( './index' ); scasum.Module( undefined ); // $ExpectError scasum.Module( [] ); // $ExpectError scasum.Module( {} ); // $ExpectError - scasum.Module( ( cx: number ): number => cx ); // $ExpectError + scasum.Module( ( x: number ): number => x ); // $ExpectError } // The `Module` constructor returns a module instance having a `main` method which returns a number... @@ -205,7 +205,7 @@ import scasum = require( './index' ); mod.main( undefined, 0, 1 ); // $ExpectError mod.main( [], 0, 1 ); // $ExpectError mod.main( {}, 0, 1 ); // $ExpectError - mod.main( ( cx: number ): number => cx, 0, 1 ); // $ExpectError + mod.main( ( x: number ): number => x, 0, 1 ); // $ExpectError } // The compiler throws an error if the `main` method of a module instance is provided a second argument which is not a number... @@ -222,7 +222,7 @@ import scasum = require( './index' ); mod.main( 10, undefined, 1 ); // $ExpectError mod.main( 10, [], 1 ); // $ExpectError mod.main( 10, {}, 1 ); // $ExpectError - mod.main( 10, ( cx: number ): number => cx, 1 ); // $ExpectError + mod.main( 10, ( x: number ): number => x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method of a module instance is provided a third argument which is not a number... @@ -239,7 +239,7 @@ import scasum = require( './index' ); mod.main( 10, 0, undefined ); // $ExpectError mod.main( 10, 0, [] ); // $ExpectError mod.main( 10, 0, {} ); // $ExpectError - mod.main( 10, 0, ( cx: number ): number => cx ); // $ExpectError + mod.main( 10, 0, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `main` method of a module instance is provided an unsupported number of arguments... @@ -279,7 +279,7 @@ import scasum = require( './index' ); mod.ndarray( undefined, 0, 1, 0 ); // $ExpectError mod.ndarray( [], 0, 1, 0 ); // $ExpectError mod.ndarray( {}, 0, 1, 0 ); // $ExpectError - mod.ndarray( ( cx: number ): number => cx, 0, 1, 0 ); // $ExpectError + mod.ndarray( ( x: number ): number => x, 0, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method of a module instance is provided a second argument which is not a number... @@ -296,7 +296,7 @@ import scasum = require( './index' ); mod.ndarray( 10, undefined, 1, 0 ); // $ExpectError mod.ndarray( 10, [], 1, 0 ); // $ExpectError mod.ndarray( 10, {}, 1, 0 ); // $ExpectError - mod.ndarray( 10, ( cx: number ): number => cx, 1, 0 ); // $ExpectError + mod.ndarray( 10, ( x: number ): number => x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method of a module instance is provided a third argument which is not a number... @@ -313,7 +313,7 @@ import scasum = require( './index' ); mod.ndarray( 10, 0, undefined, 0 ); // $ExpectError mod.ndarray( 10, 0, [], 0 ); // $ExpectError mod.ndarray( 10, 0, {}, 0 ); // $ExpectError - mod.ndarray( 10, 0, ( cx: number ): number => cx, 0 ); // $ExpectError + mod.ndarray( 10, 0, ( x: number ): number => x, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method of a module instance is provided a fourth argument which is not a number... @@ -330,7 +330,7 @@ import scasum = require( './index' ); mod.ndarray( 10, 0, 1, undefined ); // $ExpectError mod.ndarray( 10, 0, 1, [] ); // $ExpectError mod.ndarray( 10, 0, 1, {} ); // $ExpectError - mod.ndarray( 10, 0, 1, ( cx: number ): number => cx ); // $ExpectError + mod.ndarray( 10, 0, 1, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `ndarray` method of a module instance is provided an unsupported number of arguments... diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js index a464898bb666..407e143caa99 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/examples/index.js @@ -31,10 +31,10 @@ function main() { var N = 4; // Create an input array: - var cx = oneTo( N, 'complex64' ); + var x = oneTo( N, 'complex64' ); // Perform computation: - var sum = scasum.ndarray( N, cx, 1, 0 ); + var sum = scasum.ndarray( N, x, 1, 0 ); // Print the result: console.log( sum ); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js index 297b5f7b9406..1983babffb38 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/index.js @@ -28,10 +28,10 @@ * var scasum = require( '@stdlib/blas/base/wasm/scasum' ); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * * // Perform operation: -* var sum = scasum.main( cx.length, cx, 1 ); +* var sum = scasum.main( x.length, x, 1 ); * // returns 19.0 * * @example @@ -39,10 +39,10 @@ * var scasum = require( '@stdlib/blas/base/wasm/scasum' ); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * * // Perform operation: -* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* var sum = scasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 * * @example diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js index ce12da363d6f..dbaebbbfe3e7 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/main.js @@ -35,20 +35,20 @@ var Routine = require( './routine.js' ); * var Complex64Array = require( '@stdlib/array/complex64' ); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * * // Perform operation: -* var sum = scasum.main( cx.length, cx, 1 ); +* var sum = scasum.main( x.length, x, 1 ); * // returns 19.0 * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ] ); * * // Perform operation: -* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* var sum = scasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ var scasum = new Routine(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js index cc48d295c4e4..10b429f57f85 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/module.js @@ -102,7 +102,7 @@ inherits( Module, WasmModule ); * @type {Function} * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) -* @param {integer} strideX - `cx` stride length +* @param {integer} strideX - `x` stride length * @returns {number} sum of absolute values * * @example @@ -151,8 +151,8 @@ setReadOnly( Module.prototype, 'main', function scasum( N, xptr, strideX ) { * @type {Function} * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) -* @param {integer} strideX - `cx` stride length -* @param {NonNegativeInteger} offsetX - starting index for `cx` +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` * @returns {number} sum of absolute values * * @example diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js index 4be6701672e5..635b925279be 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/lib/routine.js @@ -50,10 +50,10 @@ var Module = require( './module.js' ); * scasum.initializeSync(); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); * * // Perform operation: -* var sum = scasum.main( cx.length, cx, 1 ); +* var sum = scasum.main( x.length, x, 1 ); * // returns 19.0 * * @example @@ -66,10 +66,10 @@ var Module = require( './module.js' ); * scasum.initializeSync(); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); * * // Perform operation: -* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* var sum = scasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ function Routine() { @@ -93,8 +93,8 @@ inherits( Routine, Module ); * @readonly * @type {Function} * @param {PositiveInteger} N - number of indexed elements -* @param {Float32Array} cx - input array -* @param {integer} strideX - `cx` stride length +* @param {Float32Array} x - input array +* @param {integer} strideX - `x` stride length * @returns {number} sum of absolute values * * @example @@ -107,14 +107,14 @@ inherits( Routine, Module ); * scasum.initializeSync(); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); * * // Perform operation: -* var sum = scasum.main( cx.length, cx, 1 ); +* var sum = scasum.main( x.length, x, 1 ); * // returns 19.0 */ -setReadOnly( Routine.prototype, 'main', function scasum( N, cx, strideX ) { - return this.ndarray( N, cx, strideX, stride2offset( N, strideX ) ); +setReadOnly( Routine.prototype, 'main', function scasum( N, x, strideX ) { + return this.ndarray( N, x, strideX, stride2offset( N, strideX ) ); }); /** @@ -125,9 +125,9 @@ setReadOnly( Routine.prototype, 'main', function scasum( N, cx, strideX ) { * @readonly * @type {Function} * @param {PositiveInteger} N - number of indexed elements -* @param {Float32Array} cx - input array -* @param {integer} strideX - `cx` stride length -* @param {NonNegativeInteger} offsetX - starting `cx` index +* @param {Float32Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index * @returns {number} sum of absolute values * * @example @@ -140,19 +140,19 @@ setReadOnly( Routine.prototype, 'main', function scasum( N, cx, strideX ) { * scasum.initializeSync(); * * // Define a strided array: -* var cx = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); +* var x = new Complex64Array( [ 2.0, 1.0, 3.0, 5.0, 4.0, 0.0, 1.0, 3.0 ]); * * // Perform operation: -* var sum = scasum.ndarray( cx.length, cx, 1, 0 ); +* var sum = scasum.ndarray( x.length, x, 1, 0 ); * // returns 19.0 */ -setReadOnly( Routine.prototype, 'ndarray', function scasum( N, cx, strideX, offsetX ) { +setReadOnly( Routine.prototype, 'ndarray', function scasum( N, x, strideX, offsetX ) { var ptrs; var p0; // Convert the input arrays to "pointers" in the module's memory: ptrs = arrays2ptrs( this, [ - strided2object( N, cx, strideX, offsetX ) + strided2object( N, x, strideX, offsetX ) ]); p0 = ptrs[ 0 ]; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js index 44413927a544..aad557ece588 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -39,22 +39,22 @@ tape( 'the `main` method has an arity of 3', function test( t ) { }); tape( 'the `main` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { - var cx; + var x; var y; - cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); - y = scasum.main( cx.length, cx, 1 ); + x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + y = scasum.main( x.length, x, 1 ); t.strictEqual( y, 19.0, 'returns expected value' ); t.end(); }); -tape( 'the `main` method supports an `cx` stride', function test( t ) { - var cx; +tape( 'the `main` method supports an `x` stride', function test( t ) { + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ -2.0, // 0 1.0, // 0 3.0, @@ -66,33 +66,33 @@ tape( 'the `main` method supports an `cx` stride', function test( t ) { ]); N = 2; - y = scasum.main( N, cx, 2 ); + y = scasum.main( N, x, 2 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns `0.0`', function test( t ) { - var cx; + var x; var y; - cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); - y = scasum.main( -1, cx, 1 ); + y = scasum.main( -1, x, 1 ); t.deepEqual( y, 0.0, 'returns expected value' ); - y = scasum.main( 0, cx, 1 ); + y = scasum.main( 0, x, 1 ); t.deepEqual( y, 0.0, 'returns expected value' ); t.end(); }); tape( 'the `main` method supports negative strides', function test( t ) { - var cx; + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ -2.0, // 1 1.0, // 1 3.0, @@ -106,18 +106,18 @@ tape( 'the `main` method supports negative strides', function test( t ) { ]); N = 2; - y = scasum.main( N, cx, -2 ); + y = scasum.main( N, x, -2 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); }); tape( 'the `main` method supports complex access patterns', function test( t ) { - var cx; + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 0 2.0, // 0 3.0, @@ -127,20 +127,20 @@ tape( 'the `main` method supports complex access patterns', function test( t ) { ]); N = 2; - y = scasum.main( N, cx, 2 ); + y = scasum.main( N, x, 2 ); t.strictEqual( y, 14.0, 'returns expected value' ); t.end(); }); tape( 'the `main` method supports view offsets', function test( t ) { - var cx0; - var cx1; + var x0; + var x1; var y; var N; // Initial array... - cx0 = new Complex64Array([ + x0 = new Complex64Array([ 1.0, -2.0, 3.0, // 0 @@ -152,10 +152,10 @@ tape( 'the `main` method supports view offsets', function test( t ) { ]); // Create an offset view... - cx1 = new Complex64Array( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element N = 2; - y = scasum.main( N, cx1, 2 ); + y = scasum.main( N, x1, 2 ); t.strictEqual( y, 22.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js index 37a7170d8310..88861246d752 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js @@ -51,7 +51,7 @@ tape( 'a module instance has a `main` method which has an arity of 3', function tape( 'a module instance has a `main` method which computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; mem = new Memory({ @@ -60,20 +60,20 @@ tape( 'a module instance has a `main` method which computes the sum of the absol mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + mod.write( xp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); - y = mod.main( 4, cxp, 1 ); + y = mod.main( 4, xp, 1 ); t.strictEqual( y, 19.0, 'returns expected value' ); t.end(); }); -tape( 'a module instance has a `main` method which supports an `cx` stride', function test( t ) { +tape( 'a module instance has a `main` method which supports an `x` stride', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -83,9 +83,9 @@ tape( 'a module instance has a `main` method which supports an `cx` stride', fun mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, // 0 1.0, // 0 3.0, @@ -97,7 +97,7 @@ tape( 'a module instance has a `main` method which supports an `cx` stride', fun ])); N = 2; - y = mod.main( N, cxp, 2 ); + y = mod.main( N, xp, 2 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); @@ -106,7 +106,7 @@ tape( 'a module instance has a `main` method which supports an `cx` stride', fun tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has a `main` method which returns `0.0`', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; mem = new Memory({ @@ -115,14 +115,14 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + mod.write( xp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); - y = mod.main( -1, cxp, 1 ); + y = mod.main( -1, xp, 1 ); t.strictEqual( y, 0.0, 'returns expected value' ); - y = mod.main( 0, cxp, 1 ); + y = mod.main( 0, xp, 1 ); t.strictEqual( y, 0.0, 'returns expected value' ); t.end(); @@ -131,7 +131,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance tape( 'a module instance has a `main` method which supports negative strides', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -141,9 +141,9 @@ tape( 'a module instance has a `main` method which supports negative strides', f mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, // 1 1.0, // 1 3.0, @@ -155,7 +155,7 @@ tape( 'a module instance has a `main` method which supports negative strides', f ])); N = 2; - y = mod.main( N, cxp, -2 ); + y = mod.main( N, xp, -2 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js index 8187c312da37..02077a30866d 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js @@ -51,7 +51,7 @@ tape( 'a module instance has an `ndarray` method which has an arity of 4', funct tape( 'a module instance has an `ndarray` method which computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; mem = new Memory({ @@ -60,20 +60,20 @@ tape( 'a module instance has an `ndarray` method which computes the sum of the a mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + mod.write( xp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); - y = mod.ndarray( 4, cxp, 1, 0 ); + y = mod.ndarray( 4, xp, 1, 0 ); t.strictEqual( y, 19.0, 'returns expected value' ); t.end(); }); -tape( 'a module instance has an `ndarray` method which supports an `cx` stride', function test( t ) { +tape( 'a module instance has an `ndarray` method which supports an `x` stride', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -83,9 +83,9 @@ tape( 'a module instance has an `ndarray` method which supports an `cx` stride', mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, // 0 1.0, // 0 3.0, @@ -97,16 +97,16 @@ tape( 'a module instance has an `ndarray` method which supports an `cx` stride', ])); N = 2; - y = mod.ndarray( N, cxp, 2, 0 ); + y = mod.ndarray( N, xp, 2, 0 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); }); -tape( 'a module instance has an `ndarray` method which supports an `cx` offset', function test( t ) { +tape( 'a module instance has an `ndarray` method which supports an `x` offset', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -116,9 +116,9 @@ tape( 'a module instance has an `ndarray` method which supports an `cx` offset', mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, 1.0, 3.0, @@ -130,7 +130,7 @@ tape( 'a module instance has an `ndarray` method which supports an `cx` offset', ])); N = 2; - y = mod.ndarray( N, cxp, 1, 2 ); + y = mod.ndarray( N, xp, 1, 2 ); t.strictEqual( y, 8.0, 'returns expected value' ); t.end(); @@ -139,7 +139,7 @@ tape( 'a module instance has an `ndarray` method which supports an `cx` offset', tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has an `ndarray` method which returns `0.0`', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; mem = new Memory({ @@ -148,14 +148,14 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); + mod.write( xp, new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); - y = mod.ndarray( -1, 3.0, cxp, 1, 0 ); + y = mod.ndarray( -1, 3.0, xp, 1, 0 ); t.strictEqual( y, 0.0, 'returns expected value' ); - y = mod.ndarray( 0, 3.0, cxp, 1, 0 ); + y = mod.ndarray( 0, 3.0, xp, 1, 0 ); t.strictEqual( y, 0.0, 'returns expected value' ); t.end(); @@ -164,7 +164,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance tape( 'a module instance has an `ndarray` method which supports negative strides', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -174,9 +174,9 @@ tape( 'a module instance has an `ndarray` method which supports negative strides mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, 1.0, 3.0, // 1 @@ -188,7 +188,7 @@ tape( 'a module instance has an `ndarray` method which supports negative strides ])); N = 2; - y = mod.ndarray( N, cxp, -2, 3 ); + y = mod.ndarray( N, xp, -2, 3 ); t.strictEqual( y, 12.0, 'returns expected value' ); t.end(); @@ -197,7 +197,7 @@ tape( 'a module instance has an `ndarray` method which supports negative strides tape( 'a module instance has an `ndarray` method which supports complex access patterns', function test( t ) { var mem; var mod; - var cxp; + var xp; var y; var N; @@ -207,9 +207,9 @@ tape( 'a module instance has an `ndarray` method which supports complex access p mod = new Module( mem ); mod.initializeSync(); - cxp = 0; + xp = 0; - mod.write( cxp, new Complex64Array([ + mod.write( xp, new Complex64Array([ -2.0, 1.0, 3.0, // 1 @@ -223,7 +223,7 @@ tape( 'a module instance has an `ndarray` method which supports complex access p ])); N = 2; - y = mod.ndarray( N, cxp, -2, 3 ); + y = mod.ndarray( N, xp, -2, 3 ); t.strictEqual( y, 12.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js index fca67b388988..f09472538937 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js @@ -39,22 +39,22 @@ tape( 'the `ndarray` method has an arity of 4', function test( t ) { }); tape( 'the `main` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { - var cx; + var x; var y; - cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); - y = scasum.ndarray( cx.length, cx, 1, 0 ); + x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + y = scasum.ndarray( x.length, x, 1, 0 ); t.strictEqual( y, 19.0, 'returns expected value' ); t.end(); }); -tape( 'the `main` method supports an `cx` stride', function test( t ) { - var cx; +tape( 'the `main` method supports an `x` stride', function test( t ) { + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ -2.0, // 0 1.0, // 0 3.0, @@ -66,17 +66,17 @@ tape( 'the `main` method supports an `cx` stride', function test( t ) { ]); N = 2; - y = scasum.ndarray( N, cx, 2, 0 ); + y = scasum.ndarray( N, x, 2, 0 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); }); -tape( 'the `main` method supports an `cx` offset', function test( t ) { - var cx; +tape( 'the `main` method supports an `x` offset', function test( t ) { + var x; var y; - cx = new Complex64Array([ + x = new Complex64Array([ 1.0, 2.0, 3.0, // 1 @@ -89,33 +89,33 @@ tape( 'the `main` method supports an `cx` offset', function test( t ) { 10.0 ]); - y = scasum.ndarray( 3, cx, 1, 1 ); + y = scasum.ndarray( 3, x, 1, 1 ); t.strictEqual( y, 33.0, 'returns expected value' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns `0.0`', function test( t ) { - var cx; + var x; var y; - cx = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); - y = scasum.ndarray( -1, cx, 1, 0 ); + y = scasum.ndarray( -1, x, 1, 0 ); t.deepEqual( y, 0.0, 'returns expected value' ); - y = scasum.ndarray( 0, cx, 1, 0 ); + y = scasum.ndarray( 0, x, 1, 0 ); t.deepEqual( y, 0.0, 'returns expected value' ); t.end(); }); tape( 'the `main` method supports negative strides', function test( t ) { - var cx; + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ -2.0, 1.0, 3.0, // 1 @@ -127,18 +127,18 @@ tape( 'the `main` method supports negative strides', function test( t ) { ]); N = 2; - y = scasum.ndarray( N, cx, -2, 3 ); + y = scasum.ndarray( N, x, -2, 3 ); t.strictEqual( y, 12.0, 'returns expected value' ); t.end(); }); tape( 'the `ndarray` method supports complex access patterns', function test( t ) { - var cx; + var x; var y; var N; - cx = new Complex64Array([ + x = new Complex64Array([ -2.0, // 1 1.0, // 1 3.0, @@ -150,7 +150,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t ]); N = 2; - y = scasum.ndarray( N, cx, -2, 2 ); + y = scasum.ndarray( N, x, -2, 2 ); t.strictEqual( y, 7.0, 'returns expected value' ); t.end(); From 19d447b00e45bbefff871866b6667998cce8e12a Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:15:18 -0700 Subject: [PATCH 06/17] docs: fix missing word Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index c34f3c0ff411..aec522f27253 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -94,7 +94,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. -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 compute the sum of last three elements, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to compute the sum of the last three elements, ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); From 4046601712e271d0d5568c19036f3237fb706985 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:16:14 -0700 Subject: [PATCH 07/17] docs: update example Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index aec522f27253..8fb0915b98ff 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -103,10 +103,6 @@ var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); var sum = scasum.ndarray( 2, x, 1, x.length-2 ); // returns 8.0 - -// Using a negative stride to sum from the last element: -sum = scasum.ndarray( 4, x, -1, x.length-1 ); -// returns 19.0 ``` * * * From aa42d595647a11931f898af5a521b3c8704a44ab Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:17:18 -0700 Subject: [PATCH 08/17] docs: update example to match docs Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index 8fb0915b98ff..f0f03a1a883e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -101,8 +101,8 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = scasum.ndarray( 2, x, 1, x.length-2 ); -// returns 8.0 +var sum = scasum.ndarray( 3, x, 1, x.length-2 ); +// returns 16.0 ``` * * * From b7b286d2fa729304c44e57c762dc64755aba20b8 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 22 Jun 2025 13:30:07 +0530 Subject: [PATCH 09/17] chore: clean-up --- 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: na - 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: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/scasum/README.md | 8 ++++---- .../wasm/scasum/benchmark/benchmark.module.main.js | 3 ++- .../scasum/benchmark/benchmark.module.ndarray.js | 3 ++- .../@stdlib/blas/base/wasm/scasum/docs/repl.txt | 14 +++++++------- .../blas/base/wasm/scasum/docs/types/index.d.ts | 10 +++++----- .../blas/base/wasm/scasum/test/test.main.js | 2 +- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md index f0f03a1a883e..9c143a6bd390 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/README.md @@ -101,7 +101,7 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var x = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var sum = scasum.ndarray( 3, x, 1, x.length-2 ); +var sum = scasum.ndarray( 3, x, 1, x.length-3 ); // returns 16.0 ``` @@ -134,7 +134,7 @@ mod.initializeSync(); #### scasum.Module.prototype.main( N, xp, sx ) -Computes the sum of absolute values. +Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. @@ -180,7 +180,7 @@ The function has the following parameters: #### scasum.Module.prototype.ndarray( N, xp, sx, ox ) -Computes the sum of absolute values using alternative indexing semantics. +Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics. @@ -283,7 +283,7 @@ console.log( out ); [blas]: http://www.netlib.org/blas -[scasum]: https://www.netlib.org/lapack/explore-html/d5/d72/group__asum_ga5fb1932fad7d47868a711867e4f2c804.html#ga5fb1932fad7d47868a711867e4f2c804 +[scasum]: https://www.netlib.org/lapack/explore-html-3.6.1/df/d28/group__single__blas__level1_gadd7d12f994e4868ca9998b054707d934.html [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js index 8e76ef09c1be..9c23527c9b7c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -83,11 +83,12 @@ function createBenchmark( len ) { // Reallocate the underlying memory to allow storing one vector: nb = bytesPerElement( options.dtype ); - mod.realloc( (N*nb)+nb ); + mod.realloc( N*nb ); // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; + // Generate an array of random complex numbers: x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); // Write random values to module memory: diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js index 993359229f3e..96ef18866120 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.ndarray.js @@ -83,11 +83,12 @@ function createBenchmark( len ) { // Reallocate the underlying memory to allow storing one vector: nb = bytesPerElement( options.dtype ); - mod.realloc( (N*nb)+nb ); + mod.realloc( N*nb ); // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; + // Generate an array of random complex numbers: x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); // Write random values to module memory: diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt index b6fa5a7bbd6e..dd9a838b699c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt @@ -41,14 +41,14 @@ // Use view offset; e.g., starting at 2nd element: > var x0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > s = {{alias}}.main( 2, x1, 2 ) - 22.0 + > s = {{alias}}.main( 2, x1, 1 ) + 18.0 {{alias}}.ndarray( N, x, strideX, offsetX ) Computes the sum of the absolute values of the real and imaginary - components of a single-precision complex floating-point vector - using alternative indexing semantics. + components of a single-precision complex floating-point vector using + alternative indexing semantics. While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting @@ -80,7 +80,7 @@ > var s = {{alias}}.ndarray( x.length, x, 1, 0 ) 15.0 - // Using offset parameter: + // Advanced indexing: > x = new {{alias:@stdlib/array/complex64}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) 15.0 @@ -456,8 +456,8 @@ {{alias}}.Module.prototype.ndarray( N, xp, sx, ox ) Computes the sum of the absolute values of the real and imaginary - components of a single-precision complex floating-point vector - using alternative indexing semantics. + components of a single-precision complex floating-point vector using + alternative indexing semantics. Parameters ---------- diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts index 872894ff23ae..216ff4a3c5d3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -56,7 +56,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define pointer (i.e., byte offsets) for storing two vectors: + * // Define a pointer (i.e., byte offset) for storing one vectors: * var xptr = 0; * * // Write vector values to module memory: @@ -97,7 +97,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define pointer (i.e., byte offsets) for storing two vectors: + * // Define a pointer (i.e., byte offset) for storing one vectors: * var xptr = 0; * * // Write vector values to module memory: @@ -145,7 +145,7 @@ interface Module extends ModuleWrapper { * // Specify a vector length: * var N = 4; * - * // Define pointer (i.e., byte offsets) for storing the input vector: + * // Define a pointer (i.e., byte offset) for storing the input vector: * var xptr = 0; * * // Write vector values to module memory: @@ -189,7 +189,7 @@ interface Module extends ModuleWrapper { * // Specify a vector length: * var N = 4; * - * // Define pointer (i.e., byte offsets) for storing the input vector: + * // Define a pointer (i.e., byte offset) for storing the input vector: * var xptr = 0; * * // Write vector values to module memory: @@ -272,7 +272,7 @@ interface Routine extends ModuleWrapper { * // Specify a vector length: * var N = 4; * - * // Define pointer (i.e., byte offsets) for storing the input vector: + * // Define a pointer (i.e., byte offset) for storing the input vector: * var xptr = 0; * * // Write vector values to module memory: diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js index aad557ece588..50817877a691 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -133,7 +133,7 @@ tape( 'the `main` method supports complex access patterns', function test( t ) { t.end(); }); -tape( 'the `main` method supports view offsets', function test( t ) { +tape( 'the `main` method supports view offset', function test( t ) { var x0; var x1; var y; From 4b23656eda56e399c1216846d7ef721d3c32b3ce Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 22 Jun 2025 13:33:33 +0530 Subject: [PATCH 10/17] chore: minor clean-up Co-authored-by: Athan Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../blas/base/wasm/scasum/benchmark/benchmark.module.main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js index 9c23527c9b7c..1215ff12efcd 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -88,6 +88,7 @@ function createBenchmark( len ) { // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; + // Generate an array of random complex numbers: // Generate an array of random complex numbers: x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); From 84fc1b6aeaa06170d3ce36cde57897cbbc4616fe Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 22 Jun 2025 13:34:59 +0530 Subject: [PATCH 11/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../blas/base/wasm/scasum/benchmark/benchmark.module.main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js index 1215ff12efcd..9c23527c9b7c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/benchmark/benchmark.module.main.js @@ -88,7 +88,6 @@ function createBenchmark( len ) { // Define a pointer (i.e., byte offset) for storing the input vector: xptr = 0; - // Generate an array of random complex numbers: // Generate an array of random complex numbers: x = new Complex64Array( uniform( N, -10.0, 10.0, options ) ); From 92b0678ca6cb5e26b6063d70c8ccf101baca9de4 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 22 Jun 2025 13:41:33 +0530 Subject: [PATCH 12/17] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt index dd9a838b699c..cea1af016ebf 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt @@ -38,7 +38,7 @@ > s = {{alias}}.main( 2, x, 2 ) 7.0 - // Use view offset; e.g., starting at 2nd element: + // Using typed array views: > var x0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > s = {{alias}}.main( 2, x1, 1 ) From 7cc2ead7c2a4bac0d3202c59b21ca037f681c3b5 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 22 Jun 2025 01:58:05 -0700 Subject: [PATCH 13/17] style: adjust spacing Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt index cea1af016ebf..02dca8447164 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/repl.txt @@ -39,7 +39,7 @@ 7.0 // Using typed array views: - > var x0 = new {{alias:@stdlib/array/complex64}}([1.0,-2.0,3.0,-4.0,5.0,-6.0,7.0,-8.0 ]); + > var x0 = new {{alias:@stdlib/array/complex64}}( [1.0,2.0,3.0,-4.0,5.0,-6.0,7.0,8.0] ); > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > s = {{alias}}.main( 2, x1, 1 ) 18.0 From eb678f7acd9fbac2b73cd849e25d2629767ef1b0 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 22 Jun 2025 02:01:12 -0700 Subject: [PATCH 14/17] Apply suggestions from code review Signed-off-by: Athan --- .../@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts index 216ff4a3c5d3..b1d1d0267d0e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -56,7 +56,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define a pointer (i.e., byte offset) for storing one vectors: + * // Define a pointer (i.e., byte offset) for storing one vector: * var xptr = 0; * * // Write vector values to module memory: @@ -97,7 +97,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define a pointer (i.e., byte offset) for storing one vectors: + * // Define a pointer (i.e., byte offset) for storing one vector: * var xptr = 0; * * // Write vector values to module memory: From ba7b43aa026829ddc1fe3851f09c434aae0d598d Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 22 Jun 2025 02:02:47 -0700 Subject: [PATCH 15/17] Apply suggestions from code review Signed-off-by: Athan --- .../@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts index b1d1d0267d0e..c698c2a3ea7e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/docs/types/index.d.ts @@ -56,7 +56,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define a pointer (i.e., byte offset) for storing one vector: + * // Define a pointer (i.e., byte offset) for storing the input vector: * var xptr = 0; * * // Write vector values to module memory: @@ -97,7 +97,7 @@ interface ModuleConstructor { * // Specify a vector length: * var N = 4; * - * // Define a pointer (i.e., byte offset) for storing one vector: + * // Define a pointer (i.e., byte offset) for storing the input vector: * var xptr = 0; * * // Write vector values to module memory: From 2822b1cbee3afb2259412fea556709092c07f021 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 23 Jun 2025 10:16:39 +0530 Subject: [PATCH 16/17] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/wasm/scasum/test/test.main.js | 12 ++++++------ .../base/wasm/scasum/test/test.module.main.js | 4 ++-- .../wasm/scasum/test/test.module.ndarray.js | 16 ++++++++-------- .../blas/base/wasm/scasum/test/test.ndarray.js | 18 +++++++++--------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js index 50817877a691..09944ffb5431 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -55,7 +55,7 @@ tape( 'the `main` method supports an `x` stride', function test( t ) { var N; x = new Complex64Array([ - -2.0, // 0 + -2.0, // 0 1.0, // 0 3.0, -5.0, @@ -93,7 +93,7 @@ tape( 'the `main` method supports negative strides', function test( t ) { var N; x = new Complex64Array([ - -2.0, // 1 + -2.0, // 1 1.0, // 1 3.0, -5.0, @@ -118,11 +118,11 @@ tape( 'the `main` method supports complex access patterns', function test( t ) { var N; x = new Complex64Array([ - 1.0, // 0 - 2.0, // 0 + 1.0, // 0 + 2.0, // 0 3.0, 4.0, - 5.0, // 1 + 5.0, // 1 6.0 // 1 ]); N = 2; @@ -144,7 +144,7 @@ tape( 'the `main` method supports view offset', function test( t ) { 1.0, -2.0, 3.0, // 0 - -4.0, // 0 + -4.0, // 0 5.0, -6.0, 7.0, // 1 diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js index 88861246d752..9923e922a51c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.main.js @@ -86,7 +86,7 @@ tape( 'a module instance has a `main` method which supports an `x` stride', func xp = 0; mod.write( xp, new Complex64Array([ - -2.0, // 0 + -2.0, // 0 1.0, // 0 3.0, -5.0, @@ -144,7 +144,7 @@ tape( 'a module instance has a `main` method which supports negative strides', f xp = 0; mod.write( xp, new Complex64Array([ - -2.0, // 1 + -2.0, // 1 1.0, // 1 3.0, -5.0, diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js index 02077a30866d..ee65218c9002 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.module.ndarray.js @@ -86,12 +86,12 @@ tape( 'a module instance has an `ndarray` method which supports an `x` stride', xp = 0; mod.write( xp, new Complex64Array([ - -2.0, // 0 + -2.0, // 0 1.0, // 0 3.0, -5.0, 4.0, // 1 - 0.0, // 1 + 0.0, // 1 -1.0, -3.0 ])); @@ -125,7 +125,7 @@ tape( 'a module instance has an `ndarray` method which supports an `x` offset', -5.0, 4.0, // 0 0.0, // 0 - -1.0, // 1 + -1.0, // 1 -3.0 // 1 ])); N = 2; @@ -180,10 +180,10 @@ tape( 'a module instance has an `ndarray` method which supports negative strides -2.0, 1.0, 3.0, // 1 - -5.0, // 1 + -5.0, // 1 4.0, 0.0, - -1.0, // 0 + -1.0, // 0 -3.0 // 0 ])); N = 2; @@ -213,11 +213,11 @@ tape( 'a module instance has an `ndarray` method which supports complex access p -2.0, 1.0, 3.0, // 1 - -5.0, // 1 + -5.0, // 1 4.0, 0.0, - -1.0, // 0 - -3.0, // 0 + -1.0, // 0 + -3.0, // 0 7.0, 8.0 ])); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js index f09472538937..05b367492026 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.ndarray.js @@ -38,7 +38,7 @@ tape( 'the `ndarray` method has an arity of 4', function test( t ) { t.end(); }); -tape( 'the `main` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { +tape( 'the `ndarray` method computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector', function test( t ) { var x; var y; @@ -49,13 +49,13 @@ tape( 'the `main` method computes the sum of the absolute values of the real and t.end(); }); -tape( 'the `main` method supports an `x` stride', function test( t ) { +tape( 'the `ndarray` method supports an `x` stride', function test( t ) { var x; var y; var N; x = new Complex64Array([ - -2.0, // 0 + -2.0, // 0 1.0, // 0 3.0, -5.0, @@ -72,7 +72,7 @@ tape( 'the `main` method supports an `x` stride', function test( t ) { t.end(); }); -tape( 'the `main` method supports an `x` offset', function test( t ) { +tape( 'the `ndarray` method supports an `x` offset', function test( t ) { var x; var y; @@ -95,7 +95,7 @@ tape( 'the `main` method supports an `x` offset', function test( t ) { t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns `0.0`', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` method returns `0.0`', function test( t ) { var x; var y; @@ -110,7 +110,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method t.end(); }); -tape( 'the `main` method supports negative strides', function test( t ) { +tape( 'the `ndarray` method supports negative strides', function test( t ) { var x; var y; var N; @@ -119,10 +119,10 @@ tape( 'the `main` method supports negative strides', function test( t ) { -2.0, 1.0, 3.0, // 1 - -5.0, // 1 + -5.0, // 1 4.0, 0.0, - -1.0, // 0 + -1.0, // 0 -3.0 // 0 ]); N = 2; @@ -139,7 +139,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t var N; x = new Complex64Array([ - -2.0, // 1 + -2.0, // 1 1.0, // 1 3.0, -5.0, From 21699637b7f6ed3f205141faba5e4e4a52112ed0 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 25 Jun 2025 04:42:04 -0700 Subject: [PATCH 17/17] test: fix description Signed-off-by: Athan --- .../@stdlib/blas/base/wasm/scasum/test/test.main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js index 09944ffb5431..32d58ad229db 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/scasum/test/test.main.js @@ -133,7 +133,7 @@ tape( 'the `main` method supports complex access patterns', function test( t ) { t.end(); }); -tape( 'the `main` method supports view offset', function test( t ) { +tape( 'the `main` method supports view offsets', function test( t ) { var x0; var x1; var y;