From c1395e3a0b39c1c191a7b69b8f5050b0c8d75ac2 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Mon, 21 Apr 2025 12:37:02 +0530 Subject: [PATCH 01/12] feat: add blas/base/wasm/sdsdot --- 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/sdsdot/README.md | 326 ++++++++++ .../base/wasm/sdsdot/benchmark/benchmark.js | 107 ++++ .../wasm/sdsdot/benchmark/benchmark.module.js | 66 ++ .../sdsdot/benchmark/benchmark.module.main.js | 133 ++++ .../benchmark/benchmark.module.ndarray.js | 133 ++++ .../sdsdot/benchmark/benchmark.ndarray.js | 107 ++++ .../blas/base/wasm/sdsdot/docs/repl.txt | 557 +++++++++++++++++ .../base/wasm/sdsdot/docs/types/index.d.ts | 362 +++++++++++ .../blas/base/wasm/sdsdot/docs/types/test.ts | 577 ++++++++++++++++++ .../blas/base/wasm/sdsdot/examples/index.js | 45 ++ .../sdsdot/examples/little_endian_arrays.js | 73 +++ .../blas/base/wasm/sdsdot/examples/module.js | 67 ++ .../base/wasm/sdsdot/lib/binary.browser.js | 33 + .../blas/base/wasm/sdsdot/lib/binary.js | 34 ++ .../blas/base/wasm/sdsdot/lib/index.js | 108 ++++ .../@stdlib/blas/base/wasm/sdsdot/lib/main.js | 62 ++ .../blas/base/wasm/sdsdot/lib/module.js | 220 +++++++ .../blas/base/wasm/sdsdot/lib/routine.js | 180 ++++++ .../blas/base/wasm/sdsdot/manifest.json | 36 ++ .../blas/base/wasm/sdsdot/package.json | 80 +++ .../blas/base/wasm/sdsdot/scripts/build.js | 66 ++ .../base/wasm/sdsdot/scripts/template.txt | 33 + .../blas/base/wasm/sdsdot/src/Makefile | 243 ++++++++ .../blas/base/wasm/sdsdot/src/exports.json | 4 + .../blas/base/wasm/sdsdot/src/main.wasm | Bin 0 -> 502 bytes .../blas/base/wasm/sdsdot/src/main.wat | 239 ++++++++ .../blas/base/wasm/sdsdot/test/test.js | 53 ++ .../blas/base/wasm/sdsdot/test/test.main.js | 229 +++++++ .../blas/base/wasm/sdsdot/test/test.module.js | 154 +++++ .../base/wasm/sdsdot/test/test.module.main.js | 283 +++++++++ .../wasm/sdsdot/test/test.module.ndarray.js | 360 +++++++++++ .../base/wasm/sdsdot/test/test.ndarray.js | 251 ++++++++ .../base/wasm/sdsdot/test/test.routine.js | 71 +++ 33 files changed, 5292 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.browser.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/scripts/build.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/scripts/template.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/exports.json create mode 100755 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wasm create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wat create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.routine.js diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md new file mode 100644 index 000000000000..918b794a21ec --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md @@ -0,0 +1,326 @@ + + +# sdsdot + +> Compute the dot product of two single-precision floating-point vectors with extended accumulation. + +
+ +## Usage + +```javascript +var sdsdot = require( '@stdlib/blas/base/wasm/sdsdot' ); +``` + +#### sdsdot.main( N, scalar, x, strideX, y, strideY ) + +Computes the dot product of two single-precision floating-point vectors with extended accumulation. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ); +var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ); + +var z = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +// returns -5.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **scalar**: scalar constant to add to dot product +- **x**: first input [`Float32Array`][@stdlib/array/float32]. +- **strideX**: index increment for `x`. +- **y**: second input [`Float32Array`][@stdlib/array/float32]. +- **strideY**: index increment for `y`. + +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other value in `x` and the first `N` elements of `y` in reverse order, + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + +var z = sdsdot.main( 3, 0.0, x, 2, y, -1 ); +// returns 9.0 +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +// Initial arrays... +var x0 = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y0 = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + +// Create offset views... +var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element + +var z = sdsdot.main( 3, 0.0, x1, -2, y1, 1 ); +// returns 128.0 +``` + +#### sdsdot.ndarray( N, scalar, x, strideX, offsetX, y, strideY, offsetY ) + +Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ); +var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ); + +var z = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +// returns -5.0 +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetY**: starting index for `y`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the dot product of every other value in `x` starting from the second value with the last 3 elements in `y` in reverse order + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + +var z = sdsdot.ndarray( 3, 0.0, x, 2, 1, y, -1, y.length-1 ); +// returns 128.0 +``` + +* * * + +### Module + +#### sdsdot.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 sdsdot.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); +``` + +#### sdsdot.Module.prototype.main( N, scalar, xp, sx, yp, sy ) + +Computes the dot product of two single-precision floating-point vectors with extended accumulation. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ones = require( '@stdlib/array/ones' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + +// 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 sdsdot.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'float32'; + +// Specify a vector length: +var N = 5; + +// Define pointers (i.e., byte offsets) for storing two vectors: +var xptr = 0; +var yptr = N * bytesPerElement( dtype ); + +// Write vector values to module memory: +mod.write( xptr, oneTo( N, dtype ) ); +mod.write( yptr, ones( N, dtype ) ); + +// Perform computation: +var z = mod.main( N, 0.0, xptr, 1, yptr, 1 ); + +console.log( z ); +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **scalar**: scalar constant to add to dot product +- **xp**: first input [`Float32Array`][@stdlib/array/float32] pointer (i.e., byte offset). +- **sx**: index increment for `x`. +- **yp**: second input [`Float32Array`][@stdlib/array/float32] pointer (i.e., byte offset). +- **sy**: index increment for `y`. + +#### sdsdot.Module.prototype.ndarray( N, scalar, xp, sx, ox, yp, sy, oy ) + +Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ones = require( '@stdlib/array/ones' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + +// 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 sdsdot.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'float32'; + +// Specify a vector length: +var N = 5; + +// Define pointers (i.e., byte offsets) for storing two vectors: +var xptr = 0; +var yptr = N * bytesPerElement( dtype ); + +// Write vector values to module memory: +mod.write( xptr, oneTo( N, dtype ) ); +mod.write( yptr, ones( N, dtype ) ); + +// Perform computation: +var z = mod.ndarray( N, 0.0, xptr, 1, 0, yptr, 1, 0 ); + +console.log( z ); +``` + +The function has the following additional parameters: + +- **ox**: starting index for `x`. +- **oy**: starting index for `y`. + +
+ + + +
+ +* * * + +## 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 `sdsdot` 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/sdsdot`][@stdlib/blas/base/sdsdot]. 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/sdsdot`][@stdlib/blas/base/sdsdot]. 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. +- `sdsdot()` corresponds to the [BLAS][blas] level 1 function [`sdsdot`][sdsdot]. + +
+ + + +
+ +* * * + +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var sdsdot = require( '@stdlib/blas/base/wasm/sdsdot' ); + +var opts = { + 'dtype': 'float32' +}; +var x = discreteUniform( 10, 0, 100, opts ); +console.log( x ); + +var y = discreteUniform( x.length, 0, 10, opts ); +console.log( y ); + +var z = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, -1, y.length-1 ); +console.log( z ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js new file mode 100644 index 000000000000..3f2919fd7b45 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var sdsdot = 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 x = uniform( len, -100.0, 100.0, options ); + var y = uniform( len, -100.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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/sdsdot/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.js new file mode 100644 index 000000000000..03df30b91676 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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 sdsdot = 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 sdsdot.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/sdsdot/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js new file mode 100644 index 000000000000..1080c401f9c0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js @@ -0,0 +1,133 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var sdsdot = 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 yptr; + var mod; + var mem; + var nb; + var d; + var i; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new sdsdot.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing two vectors: + nb = bytesPerElement( options.dtype ); + mod.realloc( len*2*nb ); + + // Define pointers (i.e., byte offsets) to the first vector elements: + xptr = 0; + yptr = len * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( len, -100.0, 100.0, options ) ); + mod.write( yptr, uniform( len, -100.0, 100.0, options ) ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = mod.main( len, 0.0, xptr, 1, yptr, 1 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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/sdsdot/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js new file mode 100644 index 000000000000..8fc54e303850 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js @@ -0,0 +1,133 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var sdsdot = 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 yptr; + var mod; + var mem; + var nb; + var d; + var i; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new sdsdot.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing two vectors: + nb = bytesPerElement( options.dtype ); + mod.realloc( len*2*nb ); + + // Define pointers (i.e., byte offsets) to the first vector elements: + xptr = 0; + yptr = len * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( len, -100.0, 100.0, options ) ); + mod.write( yptr, uniform( len, -100.0, 100.0, options ) ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = mod.ndarray( len, 0.0, xptr, 1, 0, yptr, 1, 0 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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/sdsdot/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..8ceeb19defed --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var sdsdot = 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 x = uniform( len, -100.0, 100.0, options ); + var y = uniform( len, -100.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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/sdsdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt new file mode 100644 index 000000000000..c1f300a0994e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt @@ -0,0 +1,557 @@ + +{{alias}}.main( N, scalar, x, strideX, y, strideY ) + Computes the dot product of two single-precision floating-point vectors + with extended accumulation. + + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N <= 0`, both the functions return `0`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + scalar: number + Scalar constant to add to dot product. + + x: Float32Array + First input array. + + strideX: integer + Index increment for `x`. + + y: Float32Array + Second input array. + + strideY: integer + Index increment for `y`. + + Returns + ------- + out: number + Dot product. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ); + > var out = {{alias}}.main( x.length, 0.0, x, 1, y, 1 ) + -5.0 + + // Using `N` and stride parameters: + > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + > out = {{alias}}.main( 3, 0.0, x, 2, y, -1 ) + 9.0 + + // Using view offsets: + > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + > var x1 = new {{alias:@stdlib/array/float32}}( x.buffer, x.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/float32}}( y.buffer, y.BYTES_PER_ELEMENT*3 ); + > out = {{alias}}.main( 3, 0.0, x1, -2, y1, 1 ) + 128.0 + + +{{alias}}.ndarray( N, scalar, x, strideX, offsetX, y, strideY, offsetY ) + Computes the dot product of two single-precision floating-point vectors + with extended accumulation 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. + + scalar: number + Scalar constant to add to dot product. + + x: Float32Array + First input array. + + strideX: integer + Index increment for `x`. + + offsetX: integer + Starting index for `x`. + + y: Float32Array + Second input array. + + strideY: integer + Index increment for `y`. + + offsetY: integer + Starting index for `y`. + + Returns + ------- + out: number + Dot product. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ); + > var out = {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ) + -5.0 + + // Using `N` and stride parameters: + > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + > out = {{alias}}.ndarray( 3, 0.0, x, 2, 0, y, 2, 0 ) + 9.0 + + // Using offset indices: + > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + > out = {{alias}}.ndarray( 3, 0.0, x, -2, x.length-1, y, 1, 3 ) + 128.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, scalar, xp, sx, yp, sy ) + Computes the dot product of two single-precision floating-point vectors + with extended accumulation. + + Parameters + ---------- + N: integer + Number of indexed elements. + + scalar: number + Scalar constant to add to dot product. + + xp: integer + First input array pointer (i.e., byte offset). + + sx: integer + Index increment for `x`. + + yp: integer + Second input array pointer (i.e., byte offset). + + sy: integer + Index increment for `y`. + + Returns + ------- + out: number + Dot product. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 1 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + + // Define "pointers" (i.e., byte offsets) into module memory: + > var xptr = 0; + > var yptr = 40; + + // Write data to module memory: + > mod.write( xptr, {{alias:@stdlib/array/one-to}}( 5, 'float32' ) ); + > mod.write( yptr, {{alias:@stdlib/array/ones}}( 5, 'float32' ) ); + + // Perform computation: + > var out = mod.main( 5, 0.0, xptr, 1, yptr, 1 ) + 15.0 + + +{{alias}}.Module.prototype.ndarray( N, scalar, xp, sx, ox, yp, sy, oy ) + Computes the dot product of two single-precision floating-point vectors with + extended accumulation, using alternative indexing semantics. + + Parameters + ---------- + N: integer + Number of indexed elements. + + scalar: number + Scalar constant to add to dot product. + + xp: integer + First input array pointer (i.e., byte offset). + + sx: integer + Index increment for `x`. + + ox: integer + Starting index for `x`. + + yp: integer + Second input array pointer (i.e., byte offset). + + sy: integer + Index increment for `y`. + + oy: integer + Starting index for `y`. + + Returns + ------- + out: number + Dot product. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 1 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + + // Define "pointers" (i.e., byte offsets) into module memory: + > var xptr = 0; + > var yptr = 40; + + // Write data to module memory: + > mod.write( xptr, {{alias:@stdlib/array/one-to}}( 5, 'float32' ) ); + > mod.write( yptr, {{alias:@stdlib/array/ones}}( 5, 'float32' ) ); + + // Perform computation: + > var out = mod.ndarray( 5, 0.0, xptr, 1, 0, yptr, 1, 0 ) + 15.0 + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts new file mode 100644 index 000000000000..80b593016cf2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts @@ -0,0 +1,362 @@ +/* +* @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'; + +/** +* 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' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * + * // 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 sdsdot.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'float32'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * mod.write( yptr, ones( N, dtype ) ); + * + * // Perform computation: + * var dot = mod.main( N, 0.0, xptr, 1, yptr, 1 ); + * // returns 15.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' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * + * // 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 = sdsdot.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'float32'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * mod.write( yptr, ones( N, dtype ) ); + * + * // Perform computation: + * var dot = mod.main( N, 0.0, xptr, 1, yptr, 1 ); + * // returns 15.0 + */ + ( mem: Memory ): Module; // callable +} + +/** +* Interface describing a `sdsdot` WebAssembly module. +*/ +interface Module extends ModuleWrapper { + /** + * Computes the dot product of two single-precision floating-point vectors with extended accumulation. + * + * @param N - number of indexed elements + * @param scalar - scalar constant to add to dot product + * @param xptr - first input array pointer (i.e., byte offset) + * @param strideX - `x` stride length + * @param yptr - second input array pointer (i.e., byte offset) + * @param strideY - `y` stride length + * @returns dot product + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * + * // 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 sdsdot.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'float32'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * mod.write( yptr, ones( N, dtype ) ); + * + * // Perform computation: + * var dot = mod.main( N, 5.0, xptr, 1, yptr, 1 ); + * // returns 15.0 + */ + main( N: number, scalar: number, xptr: number, strideX: number, yptr: number, strideY: number ): number; + + /** + * Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param scalar - scalar constant to add to dot product + * @param xptr - first input array pointer (i.e., byte offset) + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param yptr - second input array pointer (i.e., byte offset) + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` + * @returns dot product + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * + * // 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 sdsdot.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'float32'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * mod.write( yptr, ones( N, dtype ) ); + * + * // Perform computation: + * var dot = mod.ndarray( N, 5.0, xptr, 1, 0, yptr, 1, 0 ); + * // returns 15.0 + */ + ndarray( N: number, scalar: number, xptr: number, strideX: number, offsetX: number, yptr: number, strideY: number, offsetY: number ): number; +} + +/** +* Interface describing `sdsdot`. +*/ +interface Routine extends ModuleWrapper { + /** + * Computes the dot product of two single-precision floating-point vectors with extended accumulation. + * + * @param N - number of indexed elements + * @param scalar - scalar constant to add to dot product + * @param x - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` stride length + * @returns dot product + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * + * var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); + * // returns 15.0 + */ + main( N: number, scalar: number, x: Float32Array, strideX: number, y: Float32Array, strideY: number ): number; + + /** + * Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param scalar - scalar constant to add to dot product + * @param x - first input array + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param y - second input array + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` + * @returns dot product + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * + * sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); + * // returns 15.0 + */ + ndarray( N: number, scalar: number, x: Float32Array, strideX: number, offsetX: number, y: Float32Array, strideY: number, offsetY: 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' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * + * // 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 sdsdot.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'float32'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing two vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * mod.write( xptr, oneTo( N, dtype ) ); + * mod.write( yptr, ones( N, dtype ) ); + * + * // Perform computation: + * var dot = mod.main( N, 0.0, xptr, 1, yptr, 1 ); + * // returns 15.0 + */ + Module: ModuleConstructor; +} + +/** +* Computes the dot product of two single-precision floating-point vectors with extended accumulation. +* +* @param N - number of indexed elements +* @param scalar - scalar constant to add to dot product +* @param x - first input array +* @param strideX - `x` stride length +* @param y - second input array +* @param strideY - `y` stride length +* @returns dot product +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +* // returns 15.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* var dot = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +* // returns 15.0 +*/ +declare var sdsdot: Routine; + + +// EXPORTS // + +export = sdsdot; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts new file mode 100644 index 000000000000..3ba72eb93fd3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts @@ -0,0 +1,577 @@ +/* +* @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 Memory = require( '@stdlib/wasm/memory' ); +import sdsdot = require( './index' ); + + +// TESTS // + +// Attached to the main export is a `main` method which returns a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( x.length, 0.0, 0.0, x, 1, y, 1 ); // $ExpectType number +} + +// The compiler throws an error if the `main` method is provided a first argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( '10', 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( true, 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( false, 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( null, 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( undefined, 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( [], 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( {}, 0.0, x, 1, y, 1 ); // $ExpectError + sdsdot.main( ( x: number ): number => x, 0.0, x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a second argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( x.length, '10', x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, true, x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, false, x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, null, x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, undefined, x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, [], x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, {}, x, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a third argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( x.length, 0.0, 10, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, '10', 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, true, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, false, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, null, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, undefined, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, [], 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, {}, 1, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, ( x: number ): number => x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a fourth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( x.length, 0.0, x, '10', y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, true, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, false, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, null, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, undefined, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, [], y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, {}, y, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a fifth argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + + sdsdot.main( x.length, 0.0, x, 1, 10, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, '10', 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, true, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, false, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, null, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, undefined, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, [], 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, {}, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a sixth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main( x.length, 0.0, x, 1, y, '10' ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, true ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, false ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, null ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, undefined ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, [] ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, {} ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided an unsupported number of arguments... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.main(); // $ExpectError + sdsdot.main( x.length ); // $ExpectError + sdsdot.main( x.length, x ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1 ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y ); // $ExpectError + sdsdot.main( x.length, 0.0, x, 1, y, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( '10', 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( true, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( false, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( null, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( undefined, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( [], 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( {}, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( ( x: number ): number => x, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, '10', x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, true, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, false, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, null, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, undefined, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, [], x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, {}, x, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, 10, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, '10', 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, true, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, false, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, null, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, undefined, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, [], 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, {}, 1, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, '10', 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, true, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, false, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, null, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, undefined, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, [], 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, {}, 0, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, ( x: number ): number => x, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, 1, '10', y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, true, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, false, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, null, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, undefined, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, [], y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, {}, y, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, 1, 0, 10, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, '10', 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, true, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, false, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, null, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, undefined, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, [], 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, {}, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, '10', 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, true, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, false, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, null, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, undefined, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, [], 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, {}, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a eighth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, '10' ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, true ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, false ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, null ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, undefined ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, [] ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, {} ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + sdsdot.ndarray(); // $ExpectError + sdsdot.ndarray( x.length ); // $ExpectError + sdsdot.ndarray( x.length, x ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0, 10 ); // $ExpectError +} + +// Attached to the main export is a `Module` constructor which returns a module... +{ + const mem = new Memory({ + 'initial': 0 + }); + + sdsdot.Module( mem ); // $ExpectType Module +} + +// The compiler throws an error if the `Module` constructor is not provided a WebAssembly memory instance... +{ + sdsdot.Module( '10' ); // $ExpectError + sdsdot.Module( true ); // $ExpectError + sdsdot.Module( false ); // $ExpectError + sdsdot.Module( null ); // $ExpectError + sdsdot.Module( undefined ); // $ExpectError + sdsdot.Module( [] ); // $ExpectError + sdsdot.Module( {} ); // $ExpectError + sdsdot.Module( ( x: number ): number => x ); // $ExpectError +} + +// The `Module` constructor returns a module instance having a `main` method which returns a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.main( 10, 1, 0, 1, 80, 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 = sdsdot.Module( mem ); + + mod.main( '10', 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( true, 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( false, 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( null, 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( undefined, 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( [], 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( {}, 1, 10, 1, 80, 1 ); // $ExpectError + mod.main( ( x: number ): number => x, 1, 10, 1, 80, 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 = sdsdot.Module( mem ); + + mod.main( 10, '10', 1, 80, 1 ); // $ExpectError + mod.main( 10, true, 1, 80, 1 ); // $ExpectError + mod.main( 10, false, 1, 80, 1 ); // $ExpectError + mod.main( 10, null, 1, 80, 1 ); // $ExpectError + mod.main( 10, undefined, 1, 80, 1 ); // $ExpectError + mod.main( 10, [], 1, 80, 1 ); // $ExpectError + mod.main( 10, {}, 1, 80, 1 ); // $ExpectError + mod.main( 10, ( x: number ): number => x, 1, 80, 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 = sdsdot.Module( mem ); + + mod.main( 10, 1, '10', 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, true, 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, false, 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, null, 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, undefined, 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, [], 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, {}, 1, 80, 1 ); // $ExpectError + mod.main( 10, 1, ( x: number ): number => x, 1, 80, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided a fourth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.main( 10, 1, 0, '10', 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, true, 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, false, 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, null, 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, undefined, 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, [], 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, {}, 80, 1 ); // $ExpectError + mod.main( 10, 1, 0, ( x: number ): number => x, 80, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided a fifth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.main( 10, 1, 0, 1, '10', 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, true, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, false, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, null, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, undefined, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, [], 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, {}, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided a sixth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.main( 10, 1, 0, 1, 80, '10' ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, true ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, false ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, null ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, undefined ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, [] ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, {} ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, ( 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... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.main(); // $ExpectError + mod.main( 10 ); // $ExpectError + mod.main( 10, 1 ); // $ExpectError + mod.main( 10, 1,0 ); // $ExpectError + mod.main( 10, 1, 0, 1 ); // $ExpectError + mod.main( 10, 1, 0, 1, 80 ); // $ExpectError + mod.main( 10, 1, 0, 1, 80, 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 = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, 0, 1, 0, 80, 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 = sdsdot.Module( mem ); + + mod.ndarray( '10', 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( true, 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( false, 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( null, 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( undefined, 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( [], 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( {}, 0, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( ( x: number ): number => x, 0, 0, 1, 0, 80, 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 = sdsdot.Module( mem ); + + mod.ndarray( 10, '10', 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, true, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, false, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, null, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, undefined, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, [], 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, {}, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, ( x: number ): number => x, x, 1, 0, 80, 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 = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, '10', 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, true, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, false, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, null, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, undefined, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, [], 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, {}, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, ( x: number ): number => x, x, 0, 80, 1, 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 = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, 0, 1, '10', 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, true, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, false, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, null, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, undefined, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, [], 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, {}, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, ( x: number ): number => x, 80, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a fifth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, 0, 1, 0, '10', 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, true, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, false, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, null, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, undefined, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, [], 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, {}, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, ( x: number ): number => x, 0, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a sixth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, 0, 1, 0, 80, '10', 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, true, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, false, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, null, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, undefined, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, [], 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, {}, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a seventh argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, '10' ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, true ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, false ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, null ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, undefined ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, [] ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, {} ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 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... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + + mod.ndarray(); // $ExpectError + mod.ndarray( 10 ); // $ExpectError + mod.ndarray( 10, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1 ); // $ExpectError + mod.ndarray( 10, 0, 0, 1, 0, 80, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js new file mode 100644 index 000000000000..816d3779b828 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js @@ -0,0 +1,45 @@ +/** +* @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 ones = require( '@stdlib/array/ones' ); +var sdsdot = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Specify a vector length: + var N = 5; + + // Create two arrays: + var x = oneTo( N, 'float32' ); + var y = ones( N, 'float32' ); + + // Perform computation: + var dot = sdsdot.ndarray( N, 0.0, x, 1, 0, y, 1, 0 ); + + // Print the result: + console.log( dot ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js new file mode 100644 index 000000000000..2f15a71a182b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js @@ -0,0 +1,73 @@ +/** +* @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 gfill = require( '@stdlib/blas/ext/base/gfill' ); +var gfillBy = require( '@stdlib/blas/ext/base/gfill-by' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Float32ArrayLE = require( '@stdlib/array/little-endian-float32' ); +var sdsdot = 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 sdsdot.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Define a vector data type: + var dtype = 'float32'; + + // Specify a vector length: + var N = 5; + + // Define pointers (i.e., byte offsets) for storing two vectors: + var xptr = 0; + var yptr = N * bytesPerElement( dtype ); + + // Create typed array views over module memory: + var x = new Float32ArrayLE( mod.memory.buffer, xptr, N ); + var y = new Float32ArrayLE( mod.memory.buffer, yptr, N ); + + // Write values to module memory: + gfillBy( N, x, 1, discreteUniform( -10.0, 10.0 ) ); + gfill( N, 1.0, y, 1 ); + + // Perform computation: + var dot = mod.ndarray( N, 0.0, xptr, 1, 0, yptr, 1, 0 ); + + // Print the result: + console.log( dot ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js new file mode 100644 index 000000000000..82c3885c30a8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js @@ -0,0 +1,67 @@ +/** +* @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 ones = require( '@stdlib/array/ones' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var sdsdot = 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 sdsdot.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Define a vector data type: + var dtype = 'float32'; + + // Specify a vector length: + var N = 5; + + // Define pointers (i.e., byte offsets) for storing two vectors: + var xptr = 0; + var yptr = N * bytesPerElement( dtype ); + + // Write vector values to module memory: + mod.write( xptr, oneTo( N, dtype ) ); + mod.write( yptr, ones( N, dtype ) ); + + // Perform computation: + var dot = mod.ndarray( N, 0.0, xptr, 1, 0, yptr, 1, 0 ); + + // Print the result: + console.log( dot ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.browser.js new file mode 100644 index 000000000000..80a7e46432ce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEaA2AAAGAGf31/f39/AX1gCH99f39/f39/AX0CDwEDZW52Bm1lbW9yeQIAAAMEAwABAgczAxFfX3dhc21fY2FsbF9jdG9ycwAACGNfc2RzZG90AAEQY19zZHNkb3RfbmRhcnJheQACCvICAwMAAQsvACAAIAEgAiADQQEgAGsiACADbEEAIANBAEwbIAQgBSAAIAVsQQAgBUEATBsQAgu7AgIBfwF8IABBAEoEfSABuyEJAkAgA0EBRyAGQQFHckUEQAJAIABBBXAiBkUNAANAIAYgCEYNASACIARBAnRqKgIAuyAFIAdBAnRqKgIAu6IgCaAhCSAIQQFqIQggB0EBaiEHIARBAWohBAwACwALIABBBEwNAQNAIAAgBkwNAiAJIAIgBEECdGoiAyoCELsgBSAHQQJ0aiIIKgIQu6IgAyoCDLsgCCoCDLuiIAMqAgi7IAgqAgi7oiADKgIAuyAIKgIAu6IgAyoCBLsgCCoCBLuioKCgoKAhCSAGQQVqIQYgB0EFaiEHIARBBWohBAwACwALA0AgACAIRg0BIAIgBEECdGoqAgC7IAUgB0ECdGoqAgC7oiAJoCEJIAhBAWohCCAGIAdqIQcgAyAEaiEEDAALAAsgCbYFIAELCw==' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js new file mode 100644 index 000000000000..6f02393f96e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js new file mode 100644 index 000000000000..8d4dd984c6a0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js @@ -0,0 +1,108 @@ +/** +* @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 dot product of two single-precision floating-point vectors with extended accumulation. +* +* @module @stdlib/blas/base/wasm/sdsdot +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sdsdot = require( '@stdlib/blas/base/wasm/sdsdot' ); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +* // returns 15.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sdsdot = require( '@stdlib/blas/base/wasm/sdsdot' ); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +* // returns 15.0 +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var ones = require( '@stdlib/array/ones' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* var sdsdot = require( '@stdlib/blas/base/wasm/sdsdot' ); +* +* // 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 sdsdot.Module( mem ); +* // returns +* +* // Initialize the routine: +* mod.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'float32'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing two vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* mod.write( xptr, oneTo( N, dtype ) ); +* mod.write( yptr, ones( N, dtype ) ); +* +* // Perform computation: +* var dot = mod.main( N, 0.0, xptr, 1, yptr, 1 ); +* +* console.log( dot ); +* // returns 15.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/sdsdot/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js new file mode 100644 index 000000000000..c5edcccf3769 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js @@ -0,0 +1,62 @@ +/** +* @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 to compute the dot product of two single-precision floating-point vectors with extended accumulation. +* +* @name sdsdot +* @type {Routine} +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +* // returns 15.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +* // returns 15.0 +*/ +var sdsdot = new Routine(); +sdsdot.initializeSync(); // eslint-disable-line node/no-sync + + +// EXPORTS // + +module.exports = sdsdot; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js new file mode 100644 index 000000000000..20fd29d31c77 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js @@ -0,0 +1,220 @@ +/** +* @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' ); +* var ones = require( '@stdlib/array/ones' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* +* // 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 sdsdot = new Module( mem ); +* // returns +* +* // Initialize the routine: +* sdsdot.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'float32'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing two vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* sdsdot.write( xptr, oneTo( N, dtype ) ); +* sdsdot.write( yptr, ones( N, dtype ) ); +* +* // Perform computation: +* var dot = sdsdot.main( N, 0.0, xptr, 1, yptr, 1 ); +* // returns 15.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 dot product of two single-precision floating-point vectors with extended accumulation. +* +* @name main +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {number} scalar - scalar constant to add to dot product +* @param {NonNegativeInteger} xptr - first input array pointer (i.e., byte offset) +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} yptr - second input array pointer (i.e., byte offset) +* @param {integer} strideY - `y` stride length +* @returns {number} dot product +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var ones = require( '@stdlib/array/ones' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* +* // 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 sdsdot = new Module( mem ); +* // returns +* +* // Initialize the routine: +* sdsdot.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'float32'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing two vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* sdsdot.write( xptr, oneTo( N, dtype ) ); +* sdsdot.write( yptr, ones( N, dtype ) ); +* +* // Perform computation: +* var dot = sdsdot.main( N, 0.0, xptr, 1, yptr, 1 ); +* // returns 15.0 +*/ +setReadOnly( Module.prototype, 'main', function sdsdot( N, scalar, xptr, strideX, yptr, strideY ) { + return this._instance.exports.c_sdsdot( N, scalar, xptr, strideX, yptr, strideY ); +}); + +/** +* Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. +* +* @name ndarray +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {number} scalar - scalar constant to add to dot product +* @param {NonNegativeInteger} xptr - first input array pointer (i.e., byte offset) +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {NonNegativeInteger} yptr - second input array pointer (i.e., byte offset) +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {number} dot product +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var ones = require( '@stdlib/array/ones' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* +* // 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 sdsdot = new Module( mem ); +* // returns +* +* // Initialize the routine: +* sdsdot.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'float32'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing two vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* sdsdot.write( xptr, oneTo( N, dtype ) ); +* sdsdot.write( yptr, ones( N, dtype ) ); +* +* // Perform computation: +* var sdsdot = sdsdot.ndarray( N, 0.0, xptr, 1, 0, yptr, 1, 0 ); +* // returns 15.0 +*/ +setReadOnly( Module.prototype, 'ndarray', function sdsdot( N, scalar, xptr, strideX, offsetX, yptr, strideY, offsetY ) { + return this._instance.exports.c_sdsdot_ndarray( N, scalar, xptr, strideX, offsetX, yptr, strideY, offsetY ); // eslint-disable-line max-len +}); + + +// EXPORTS // + +module.exports = Module; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js new file mode 100644 index 000000000000..73cf1b86df70 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js @@ -0,0 +1,180 @@ +/** +* @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 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 Float32Array = require( '@stdlib/array/float32' ); +* +* // Create a new routine: +* var sdsdot = new Routine(); +* +* // Initialize the module: +* sdsdot.initializeSync(); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +* // returns 15.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* // Create a new routine: +* var sdsdot = new Routine(); +* +* // Initialize the module: +* sdsdot.initializeSync(); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +* // returns 15.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 dot product of two single-precision floating-point vectors with extended accumulation. +* +* @name main +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {number} scalar - scalar constant to add to dot product +* @param {Float32Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {Float32Array} y - second input array +* @param {integer} strideY - `y` stride length +* @returns {number} dot product +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* // Create a new routine: +* var sdsdot = new Routine(); +* +* // Initialize the module: +* sdsdot.initializeSync(); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); +* // returns 15.0 +*/ +setReadOnly( Routine.prototype, 'main', function sdsdot( N, scalar, x, strideX, y, strideY ) { + return this.ndarray( N, scalar, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len +}); + +/** +* Computes the dot product of two single-precision floating-point vectors with extended accumulation using alternative indexing semantics. +* +* @name ndarray +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {number} scalar - scalar constant to add to dot product +* @param {Float32Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Float32Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {number} dot product +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* // Create a new routine: +* var sdsdot = new Routine(); +* +* // Initialize the module: +* sdsdot.initializeSync(); +* +* // Define strided arrays: +* var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +* +* // Perform operation: +* var dot = sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); +* // returns 15.0 +*/ +setReadOnly( Routine.prototype, 'ndarray', function sdsdot( N, scalar, x, strideX, offsetX, y, strideY, offsetY ) { + var ptrs; + var p0; + var p1; + + // Convert the input arrays to "pointers" in the module's memory: + ptrs = arrays2ptrs( this, [ + strided2object( N, x, strideX, offsetX ), + strided2object( N, y, strideY, offsetY ) + ]); + p0 = ptrs[ 0 ]; + p1 = ptrs[ 1 ]; + + // Perform computation by calling the corresponding parent method: + return Module.prototype.ndarray.call( this, N, scalar, p0.ptr, p0.stride, p0.offset, p1.ptr, p1.stride, p1.offset ); // eslint-disable-line max-len +}); + + +// EXPORTS // + +module.exports = Routine; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/manifest.json b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/manifest.json new file mode 100644 index 000000000000..100a0b1fa02f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json new file mode 100644 index 000000000000..acb1fdedb7af --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json @@ -0,0 +1,80 @@ +{ + "name": "@stdlib/blas/base/wasm/sdsdot", + "version": "0.0.0", + "description": "Compute the dot product of `x` and `y` with extended accumulation and result.", + "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", + "sdsdot", + "linear", + "algebra", + "subroutines", + "dot", + "vector", + "array", + "ndarray", + "float32", + "float", + "float32array", + "webassembly", + "wasm" + ], + "__stdlib__": { + "wasm": true + } +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/scripts/build.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/scripts/build.js new file mode 100644 index 000000000000..66bf9650b6d6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/scripts/template.txt new file mode 100644 index 000000000000..f66cdb9735b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/Makefile new file mode 100644 index 000000000000..eb51121eec4c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/src/exports.json b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/exports.json new file mode 100644 index 000000000000..d1ed48155e0c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/exports.json @@ -0,0 +1,4 @@ +[ + "_c_sdsdot", + "_c_sdsdot_ndarray" +] diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wasm b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wasm new file mode 100755 index 0000000000000000000000000000000000000000..ec8ac34f942a771a1b3486673a47ea34f3261e2b GIT binary patch literal 502 zcma)%v2MaZ3_xw)<+wCN(6wEhj0|n1{s1>nq>6tC5n(6_A>`5F`e+IFxVO^}`ct&v>Wi0CRIXo+R)%w{7KX8lYNkKg?#i*;NMu zP+9>}?^)eu*{2w@MP8QKV!x|u0K3TQqAqrOz+qQr+aj;3`~Y Date: Mon, 21 Apr 2025 07:29:15 +0000 Subject: [PATCH 02/12] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md | 2 +- .../@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.js | 2 +- .../blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js | 2 +- .../blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js | 2 +- .../blas/base/wasm/sdsdot/benchmark/benchmark.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts | 2 +- .../@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts | 2 +- .../@stdlib/blas/base/wasm/sdsdot/examples/index.js | 2 +- .../blas/base/wasm/sdsdot/examples/little_endian_arrays.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/examples/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/Makefile | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wat | 2 +- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.main.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.module.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.routine.js | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md index 918b794a21ec..e8cd09c5deb7 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js index 3f2919fd7b45..631ebbeb93c3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.js index 03df30b91676..a9410d0e5929 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js index 1080c401f9c0..934cec779fb0 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js index 8fc54e303850..4f0665d632f1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.ndarray.js index 8ceeb19defed..208ab4f353fa 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts index 80b593016cf2..77f3c71797de 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts index 3ba72eb93fd3..8e58272463d9 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js index 816d3779b828..094f0498fd95 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js index 2f15a71a182b..40edd72f8771 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/little_endian_arrays.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js index 82c3885c30a8..e4ab92bf7b89 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/examples/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js index 6f02393f96e5..2b83fe651780 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/binary.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js index 8d4dd984c6a0..a6249a8f36af 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js index c5edcccf3769..eca8050894cd 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js index 20fd29d31c77..61f61b40cdaf 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js index 73cf1b86df70..dd7756a2d704 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/Makefile index eb51121eec4c..1b1f35347760 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/Makefile +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/src/main.wat b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wat index 023c5aa6d985..c1fe242a9516 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wat +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/src/main.wat @@ -1,6 +1,6 @@ ;; @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/sdsdot/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.js index f2fbb62377f7..fe3129689fec 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js index 44ad5b86ec4d..8bd5553234fc 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.js index 9adcb07e22fa..0cdcd97ef151 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js index 0bf25de6ee73..f42b7d4a58e7 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js index 335a33587594..f69931e6292a 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js index 2cda49e2ac16..5e070cddedf3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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/sdsdot/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.routine.js index 56a4b67daaf0..d90a5804a8e1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/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 1472ad2f7bf76665e6ad648b40ec86526f1767dd Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 03:43:11 -0700 Subject: [PATCH 03/12] docs: add missing period Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md index e8cd09c5deb7..3ce303879124 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md @@ -47,7 +47,7 @@ var z = sdsdot.main( x.length, 0.0, x, 1, y, 1 ); The function has the following parameters: - **N**: number of indexed elements. -- **scalar**: scalar constant to add to dot product +- **scalar**: scalar constant to add to dot product. - **x**: first input [`Float32Array`][@stdlib/array/float32]. - **strideX**: index increment for `x`. - **y**: second input [`Float32Array`][@stdlib/array/float32]. From f023568335d92da8525c590e2caf32cd2e73e01f Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 03:44:33 -0700 Subject: [PATCH 04/12] docs: fix missing period Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md index 3ce303879124..d9f2f7b011fc 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/README.md @@ -191,7 +191,7 @@ console.log( z ); The function has the following parameters: - **N**: number of indexed elements. -- **scalar**: scalar constant to add to dot product +- **scalar**: scalar constant to add to dot product. - **xp**: first input [`Float32Array`][@stdlib/array/float32] pointer (i.e., byte offset). - **sx**: index increment for `x`. - **yp**: second input [`Float32Array`][@stdlib/array/float32] pointer (i.e., byte offset). From 5bae2c292ddb544ea33b194bf8034fcc1afbe793 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 03:47:13 -0700 Subject: [PATCH 05/12] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt index c1f300a0994e..4e693b9d0ad9 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt @@ -9,7 +9,7 @@ Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N <= 0`, both the functions return `0`. + If `N <= 0`, the function returns `0`. Parameters ---------- From b986b585ec2fd2b59fbed990548c25cfafebd48e Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 03:49:16 -0700 Subject: [PATCH 06/12] docs: use description Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt index 4e693b9d0ad9..a128ddb1fffb 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt @@ -500,7 +500,7 @@ {{alias}}.Module.prototype.ndarray( N, scalar, xp, sx, ox, yp, sy, oy ) Computes the dot product of two single-precision floating-point vectors with - extended accumulation, using alternative indexing semantics. + extended accumulation using alternative indexing semantics. Parameters ---------- From a877a5c4a67c7a714d8159bd3578384ad8e3d9b0 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 03:50:02 -0700 Subject: [PATCH 07/12] docs: remove blank line Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt index a128ddb1fffb..fd19e760e5c8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/repl.txt @@ -551,7 +551,6 @@ > var out = mod.ndarray( 5, 0.0, xptr, 1, 0, yptr, 1, 0 ) 15.0 - See Also -------- From 74464a6e00e84ad8d5540fc426d92dc2cac3f21f Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 04:02:53 -0700 Subject: [PATCH 08/12] Apply suggestions from code review Signed-off-by: Athan --- .../@stdlib/blas/base/wasm/sdsdot/test/test.main.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js index 8bd5553234fc..38bafaa3f089 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.main.js @@ -38,7 +38,7 @@ tape( 'the `main` method has an arity of 6', function test( t ) { t.end(); }); -tape( 'the `main` method computes the dot product of `x` and `y` with extended accumulation and result', function test( t ) { +tape( 'the `main` method computes the dot product of `x` and `y` with extended accumulation', function test( t ) { var dot; var x; var y; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js index f42b7d4a58e7..cc6923812974 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.main.js @@ -48,7 +48,7 @@ tape( 'a module instance has a `main` method which has an arity of 6', function t.end(); }); -tape( 'a module instance has a `main` method which computes the dot product of `x` and `y` with extended accumulation and result', function test( t ) { +tape( 'a module instance has a `main` method which computes the dot product of `x` and `y` with extended accumulation', function test( t ) { var dot; var mem; var mod; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js index f69931e6292a..6b820e541974 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.module.ndarray.js @@ -48,7 +48,7 @@ tape( 'a module instance has an `ndarray` method which has an arity of 8', funct t.end(); }); -tape( 'a module instance has an `ndarray` method which computes the dot product of `x` and `y` with extended accumulation and result', function test( t ) { +tape( 'a module instance has an `ndarray` method which computes the dot product of `x` and `y` with extended accumulation', function test( t ) { var dot; var mem; var mod; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js index 5e070cddedf3..bba26e8a1c32 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/test/test.ndarray.js @@ -38,7 +38,7 @@ tape( 'the `ndarray` method has an arity of 8', function test( t ) { t.end(); }); -tape( 'the `ndarray` method computes the dot product of `x` and `y` with extended accumulation and result', function test( t ) { +tape( 'the `ndarray` method computes the dot product of `x` and `y` with extended accumulation', function test( t ) { var dot; var x; var y; From cc1c18c897813ec5fe477b0d6044a763bba52127 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 25 Apr 2025 04:03:17 -0700 Subject: [PATCH 09/12] docs: fix description Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json index acb1fdedb7af..05112610f7b1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/wasm/sdsdot", "version": "0.0.0", - "description": "Compute the dot product of `x` and `y` with extended accumulation and result.", + "description": "Calculate the dot product of two single-precision floating-point vectors with extended accumulation.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From aab158bab2fc3f36ea8998255cadb34d35f2dcf8 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:17:02 +0530 Subject: [PATCH 10/12] chore: add correct argument number Co-authored-by: Athan Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts index 8e58272463d9..29149aac6fa0 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts @@ -541,7 +541,7 @@ import sdsdot = require( './index' ); mod.ndarray( 10, 0, 0, 1, 0, 80, ( x: number ): number => x, 0 ); // $ExpectError } -// The compiler throws an error if the `ndarray` method of a module instance is provided a seventh argument which is not a number... +// The compiler throws an error if the `ndarray` method of a module instance is provided an eighth argument which is not a number... { const mem = new Memory({ 'initial': 1 From fa5e338cf3896f0d4a274bfa80757ff33a46acaa Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:33:35 +0530 Subject: [PATCH 11/12] chore: add correct argument number Co-authored-by: Athan Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts index 29149aac6fa0..5618430cb2a0 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts @@ -524,7 +524,7 @@ import sdsdot = require( './index' ); mod.ndarray( 10, 0, 0, 1, 0, ( x: number ): number => x, 0, 1, 0 ); // $ExpectError } -// The compiler throws an error if the `ndarray` method of a module instance is provided a sixth argument which is not a number... +// The compiler throws an error if the `ndarray` method of a module instance is provided a seventh argument which is not a number... { const mem = new Memory({ 'initial': 1 From 430e0fa485681abe1eed440cc30942f86b6d529c Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 25 Apr 2025 17:47:08 +0530 Subject: [PATCH 12/12] chore: add test cases --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../blas/base/wasm/sdsdot/docs/types/test.ts | 77 ++++++++++++------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts index 5618430cb2a0..cd8f199154a8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/sdsdot/docs/types/test.ts @@ -29,7 +29,7 @@ import sdsdot = require( './index' ); const x = new Float32Array( 10 ); const y = new Float32Array( 10 ); - sdsdot.main( x.length, 0.0, 0.0, x, 1, y, 1 ); // $ExpectType number + sdsdot.main( x.length, 0.0, x, 1, y, 1 ); // $ExpectType number } // The compiler throws an error if the `main` method is provided a first argument which is not a number... @@ -130,7 +130,8 @@ import sdsdot = require( './index' ); sdsdot.main(); // $ExpectError sdsdot.main( x.length ); // $ExpectError - sdsdot.main( x.length, x ); // $ExpectError + sdsdot.main( x.length, 0.0 ); // $ExpectError + sdsdot.main( x.length, 0.0, x ); // $ExpectError sdsdot.main( x.length, 0.0, x, 1 ); // $ExpectError sdsdot.main( x.length, 0.0, x, 1, y ); // $ExpectError sdsdot.main( x.length, 0.0, x, 1, y, 1, 10 ); // $ExpectError @@ -250,7 +251,7 @@ import sdsdot = require( './index' ); sdsdot.ndarray( x.length, 0.0, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError } -// The compiler throws an error if the `ndarray` method is provided a eighth argument which is not a number... +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... { const x = new Float32Array( 10 ); const y = new Float32Array( 10 ); @@ -272,7 +273,8 @@ import sdsdot = require( './index' ); sdsdot.ndarray(); // $ExpectError sdsdot.ndarray( x.length ); // $ExpectError - sdsdot.ndarray( x.length, x ); // $ExpectError + sdsdot.ndarray( x.length, 0.0 ); // $ExpectError + sdsdot.ndarray( x.length, 0.0, x ); // $ExpectError sdsdot.ndarray( x.length, 0.0, x, 1 ); // $ExpectError sdsdot.ndarray( x.length, 0.0, x, 1, 0 ); // $ExpectError sdsdot.ndarray( x.length, 0.0, x, 1, 0, y ); // $ExpectError @@ -335,14 +337,14 @@ import sdsdot = require( './index' ); }); const mod = sdsdot.Module( mem ); - mod.main( 10, '10', 1, 80, 1 ); // $ExpectError - mod.main( 10, true, 1, 80, 1 ); // $ExpectError - mod.main( 10, false, 1, 80, 1 ); // $ExpectError - mod.main( 10, null, 1, 80, 1 ); // $ExpectError - mod.main( 10, undefined, 1, 80, 1 ); // $ExpectError - mod.main( 10, [], 1, 80, 1 ); // $ExpectError - mod.main( 10, {}, 1, 80, 1 ); // $ExpectError - mod.main( 10, ( x: number ): number => x, 1, 80, 1 ); // $ExpectError + mod.main( 10, '10', 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, true, 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, false, 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, null, 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, undefined, 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, [], 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, {}, 10, 1, 80, 1 ); // $ExpectError + mod.main( 10, ( x: number ): number => x, 10, 1, 80, 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... @@ -463,14 +465,14 @@ import sdsdot = require( './index' ); }); const mod = sdsdot.Module( mem ); - mod.ndarray( 10, '10', 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, true, 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, false, 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, null, 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, undefined, 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, [], 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, {}, 1, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, ( x: number ): number => x, x, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, '10', 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, true, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, false, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, null, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, undefined, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, [], 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, {}, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, ( x: number ): number => x, 0, 1, 0, 80, 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... @@ -480,14 +482,14 @@ import sdsdot = require( './index' ); }); const mod = sdsdot.Module( mem ); - mod.ndarray( 10, 0, '10', 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, true, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, false, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, null, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, undefined, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, [], 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, {}, 0, 80, 1, 0 ); // $ExpectError - mod.ndarray( 10, 0, ( x: number ): number => x, x, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, '10', 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, true, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, false, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, null, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, undefined, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, [], 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, {}, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, ( x: number ): number => x, 1, 0, 80, 1, 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... @@ -497,6 +499,23 @@ import sdsdot = require( './index' ); }); const mod = sdsdot.Module( mem ); + mod.ndarray( 10, 0, 0, '10', 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, true, 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, false, 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, null, 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, undefined, 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, [], 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, {}, 1, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 0, ( x: number ): number => x, 1, 80, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a fifth argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = sdsdot.Module( mem ); + mod.ndarray( 10, 0, 0, 1, '10', 80, 1, 0 ); // $ExpectError mod.ndarray( 10, 0, 0, 1, true, 80, 1, 0 ); // $ExpectError mod.ndarray( 10, 0, 0, 1, false, 80, 1, 0 ); // $ExpectError @@ -507,7 +526,7 @@ import sdsdot = require( './index' ); mod.ndarray( 10, 0, 0, 1, ( x: number ): number => x, 80, 1, 0 ); // $ExpectError } -// The compiler throws an error if the `ndarray` method of a module instance is provided a fifth argument which is not a number... +// The compiler throws an error if the `ndarray` method of a module instance is provided a sixth argument which is not a number... { const mem = new Memory({ 'initial': 1