From e2832f08f6fd38b5b092870d0705136c85c27447 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Wed, 18 Dec 2024 11:26:29 +0530 Subject: [PATCH 1/4] feat: add wasm support for zswap --- .../@stdlib/blas/base/zswap-wasm/README.md | 465 ++++++++++++ .../base/zswap-wasm/benchmark/benchmark.js | 116 +++ .../zswap-wasm/benchmark/benchmark.module.js | 66 ++ .../benchmark/benchmark.module.main.js | 141 ++++ .../benchmark/benchmark.module.ndarray.js | 141 ++++ .../zswap-wasm/benchmark/benchmark.ndarray.js | 116 +++ .../blas/base/zswap-wasm/docs/repl.txt | 625 ++++++++++++++++ .../base/zswap-wasm/docs/types/index.d.ts | 544 ++++++++++++++ .../blas/base/zswap-wasm/docs/types/test.ts | 529 ++++++++++++++ .../blas/base/zswap-wasm/examples/index.js | 54 ++ .../examples/little_endian_arrays.js | 70 ++ .../blas/base/zswap-wasm/examples/module.js | 83 +++ .../base/zswap-wasm/lib/binary.browser.js | 33 + .../blas/base/zswap-wasm/lib/binary.js | 34 + .../@stdlib/blas/base/zswap-wasm/lib/index.js | 163 +++++ .../@stdlib/blas/base/zswap-wasm/lib/main.js | 100 +++ .../blas/base/zswap-wasm/lib/module.js | 283 +++++++ .../blas/base/zswap-wasm/lib/routine.js | 264 +++++++ .../blas/base/zswap-wasm/manifest.json | 36 + .../@stdlib/blas/base/zswap-wasm/package.json | 83 +++ .../blas/base/zswap-wasm/scripts/build.js | 63 ++ .../blas/base/zswap-wasm/scripts/template.txt | 33 + .../@stdlib/blas/base/zswap-wasm/src/Makefile | 235 ++++++ .../blas/base/zswap-wasm/src/exports.json | 4 + .../blas/base/zswap-wasm/src/main.wasm | Bin 0 -> 459 bytes .../@stdlib/blas/base/zswap-wasm/src/main.wat | 184 +++++ .../@stdlib/blas/base/zswap-wasm/test/test.js | 53 ++ .../blas/base/zswap-wasm/test/test.main.js | 473 ++++++++++++ .../blas/base/zswap-wasm/test/test.module.js | 154 ++++ .../base/zswap-wasm/test/test.module.main.js | 517 +++++++++++++ .../zswap-wasm/test/test.module.ndarray.js | 691 ++++++++++++++++++ .../blas/base/zswap-wasm/test/test.ndarray.js | 527 +++++++++++++ .../blas/base/zswap-wasm/test/test.routine.js | 71 ++ 33 files changed, 6951 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/src/exports.json create mode 100755 lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wasm create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.routine.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md b/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md new file mode 100644 index 000000000000..81e1a5e5e1e9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md @@ -0,0 +1,465 @@ + + +# zswap + +> Interchange two complex double-precision floating-point vectors. + +
+ +## Usage + +```javascript +var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +``` + +#### zswap.main( N, x, strideX, y, strideY ) + +Interchanges two complex double-precision floating-point vectors. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +zswap.main( x.length, x, 1, y, 1 ); + +var z = y.get( 0 ); +// returns + +var re = real( z ); +// returns 1.0 + +var im = imag( z ); +// returns 2.0 + +z = x.get( 0 ); +// returns + +re = real( z ); +// returns 0.0 + +im = imag( z ); +// returns 0.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **x**: first input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `x`. +- **y**: second input [`Complex128Array`][@stdlib/array/complex128]. +- **strideY**: index increment for `y`. + +The `N` and stride parameters determine how values from `x` are interchanged with values from `y`. For example, to interchange every other value in `x` with the first `N` elements of `y` in reverse order, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +zswap.main( 2, x, -2, y, 1 ); + +var z = y.get( 0 ); +// returns + +var re = real( z ); +// returns 5.0 + +var im = imag( z ); +// returns 6.0 + +z = x.get( 0 ); +// returns + +re = real( z ); +// returns 0.0 + +im = imag( z ); +// returns 0.0 +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +// Initial arrays... +var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var y0 = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +// Create offset views... +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element + +// Interchange every other value from `x1` into `y1` in reverse order... +zswap.main( 2, x1, -2, y1, 1 ); + +var z = y0.get( 2 ); +// returns + +var re = real( z ); +// returns 7.0 + +var im = imag( z ); +// returns 8.0 + +z = x0.get( 1 ); +// returns + +re = real( z ); +// returns 0.0 + +im = imag( z ); +// returns 0.0 +``` + +#### zswap.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + +Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +zswap.ndarray( x.length, x, 1, 0, y, 1, 0 ); + +var z = y.get( 0 ); +// returns + +var re = real( z ); +// returns 1.0 + +var im = imag( z ); +// returns 2.0 + +z = x.get( 0 ); +// returns + +re = real( z ); +// returns 0.0 + +im = imag( z ); +// returns 0.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 interchange every other value in `x` starting from the second value into the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,..., + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +zswap.ndarray( 2, x, 2, 1, y, -1, y.length-1 ); + +var z = y.get( y.length-1 ); +// returns + +var re = real( z ); +// returns 3.0 + +var im = imag( z ); +// returns 4.0 + +z = x.get( x.length-1 ); +// returns + +re = real( z ); +// returns 0.0 + +im = imag( z ); +// returns 0.0 +``` + +* * * + +### Module + +#### zswap.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 zswap.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); +``` + +#### zswap.Module.prototype.main( N, xp, sx, yp, sy ) + +Interchanges two complex double-precision floating-point vectors. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zswap = require( '@stdlib/blas/base/zswap-wasm' ); + +// Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +var mem = new Memory({ + 'initial': 10, + 'maximum': 100 +}); + +// Create a BLAS routine: +var mod = new zswap.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex128'; + +// Specify a vector length: +var N = 5; + +// Define pointers (i.e., byte offsets) for storing input vectors: +var xptr = 0; +var yptr = N * bytesPerElement( dtype ); + +// Write vector values to module memory: +var xbuf = oneTo( N*2, 'float64' ); +var x = new Complex128Array( xbuf.buffer ); +mod.write( xptr, x ); + +var ybuf = zeros( N*2, 'float64' ); +var y = new Complex128Array( ybuf.buffer ); +mod.write( yptr, y ); + +// Perform computation: +mod.main( N, xptr, 1, yptr, 1 ); + +// Read out the results: +var viewX = zeros( N, dtype ); +var viewY = zeros( N, dtype ); +mod.read( xptr, viewX ); +mod.read( yptr, viewY ); + +console.log( reinterpretComplex128( viewX, 0 ) ); +// => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + +console.log( reinterpretComplex128( viewY, 0 ) ); +// => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **xp**: first input [`Complex128Array`][@stdlib/array/complex128] pointer (i.e., byte offset). +- **sx**: index increment for `x`. +- **yp**: second input [`Complex128Array`][@stdlib/array/complex128] pointer (i.e., byte offset). +- **sy**: index increment for `y`. + +#### zswap.Module.prototype.ndarray( N, xp, sx, ox, yp, sy, oy ) + +Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zswap = require( '@stdlib/blas/base/zswap-wasm' ); + +// Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +var mem = new Memory({ + 'initial': 10, + 'maximum': 100 +}); + +// Create a BLAS routine: +var mod = new zswap.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex128'; + +// Specify a vector length: +var N = 5; + +// Define pointers (i.e., byte offsets) for storing input vectors: +var xptr = 0; +var yptr = N * bytesPerElement( dtype ); + +// Write vector values to module memory: +var xbuf = oneTo( N*2, 'float64' ); +var x = new Complex128Array( xbuf.buffer ); +mod.write( xptr, x ); + +var ybuf = zeros( N*2, 'float64' ); +var y = new Complex128Array( ybuf.buffer ); +mod.write( yptr, y ); + +// Perform computation: +mod.ndarray( N, xptr, 1, 0, yptr, 1, 0 ); + +// Read out the results: +var viewX = zeros( N, dtype ); +var viewY = zeros( N, dtype ); +mod.read( xptr, viewX ); +mod.read( yptr, viewY ); + +console.log( reinterpretComplex128( viewX, 0 ) ); +// => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + +console.log( reinterpretComplex128( viewY, 0 ) ); +// => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +``` + +The function has the following additional parameters: + +- **ox**: starting index for `x`. +- **oy**: starting index for `y`. + +
+ + + +
+ +* * * + +## Notes + +- If `N <= 0`, both functions leave `x` and `y` unchanged. +- This package implements routines using WebAssembly. When provided arrays which are not allocated on a `zswap` 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/zswap`][@stdlib/blas/base/zswap]. 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/zswap`][@stdlib/blas/base/zswap]. 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. +- `zswap()` corresponds to the [BLAS][blas] level 1 function [`zswap`][zswap]. + +
+ + + +
+ +* * * + +## Examples + + + +```javascript +var hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zswap = require( '@stdlib/blas/base/zswap-wasm' ); + +// Specify a vector length: +var N = 5; + +var xbuf = oneTo( N*2, 'float64' ); +var x = new Complex128Array( xbuf.buffer ); + +var ybuf = zeros( N*2, 'float64' ); +var y = new Complex128Array( ybuf.buffer ); + +// Perform computation: +zswap.ndarray( N, x, 1, 0, y, -1, N-1 ); + +// Print the results: +console.log( reinterpretComplex128( x, 0 ) ); +// => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + +console.log( reinterpretComplex128( y, 0 ) ); +// => [ 9.0, 10.0, 7.0, 8.0, 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ] +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js new file mode 100644 index 000000000000..9584a6787d32 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js @@ -0,0 +1,116 @@ +/** +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +var pkg = require( './../package.json' ).name; +var zswap = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + + ybuf = uniform( len*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zswap.main( x.length, x, 1, y, 1 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js new file mode 100644 index 000000000000..4284d5fd2e43 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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 zswap = 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 zswap.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/zswap-wasm/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js new file mode 100644 index 000000000000..155fe83c7766 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js @@ -0,0 +1,141 @@ +/** +* @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 zswap = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float64' +}; + + +// 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 byteOffset; + var view; + var xptr; + var yptr; + var mod; + var mem; + var nb; + var N; + var i; + + N = len * 2; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new zswap.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing two vectors: + nb = bytesPerElement( 'complex128' ); + mod.realloc( 2*(N*nb) ); + + // Define pointers (i.e., byte offsets) to the first vector elements: + xptr = 0; + yptr = N * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( N, -100.0, 100.0, options ) ); + mod.write( yptr, uniform( N, -100.0, 100.0, options ) ); + + // Retrieve a DataView of module memory: + view = mod.view; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mod.main( len, xptr, 1, yptr, 1 ); + byteOffset = yptr + ( (i%len)*nb ); + if ( isnan( view.getFloat64( byteOffset, true ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( view.getFloat64( byteOffset, true ) ) ) { + 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/zswap-wasm/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js new file mode 100644 index 000000000000..4efb241e0f6c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js @@ -0,0 +1,141 @@ +/** +* @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 zswap = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float64' +}; + + +// 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 byteOffset; + var view; + var xptr; + var yptr; + var mod; + var mem; + var nb; + var N; + var i; + + N = len * 2; + + // Create a new BLAS routine interface: + mem = new Memory({ + 'initial': 0 + }); + mod = new zswap.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing two vectors: + nb = bytesPerElement( 'complex128' ); + mod.realloc( 2*(N*nb) ); + + // Define pointers (i.e., byte offsets) to the first vector elements: + xptr = 0; + yptr = N * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( N, -100.0, 100.0, options ) ); + mod.write( yptr, uniform( N, -100.0, 100.0, options ) ); + + // Retrieve a DataView of module memory: + view = mod.view; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mod.ndarray( len, xptr, 1, 0, yptr, 1, 0 ); + byteOffset = yptr + ( (i%len)*nb ); + if ( isnan( view.getFloat64( byteOffset, true ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( view.getFloat64( byteOffset, true ) ) ) { + 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/zswap-wasm/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..0108f0712e35 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js @@ -0,0 +1,116 @@ +/** +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +var pkg = require( './../package.json' ).name; +var zswap = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasWebAssemblySupport() +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + + ybuf = uniform( len*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zswap.ndarray( x.length, x, 1, 0, y, 1, 0 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt new file mode 100644 index 000000000000..759fa3f3473c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt @@ -0,0 +1,625 @@ + +{{alias}}.main( N, x, strideX, y, strideY ) + Interchanges two complex double-precision floating-point vectors. + + The `N` and stride parameters determine how values from `x` are swapped with + values from `y`. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is less than or equal to `0`, the vectors are unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex128Array + First input array. + + strideX: integer + Index increment for `x`. + + y: Complex128Array + Second input array. + + strideY: integer + Index increment for `y`. + + Returns + ------- + y: Complex128Array + Input array `y`. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 6.0, 7.0, 8.0, 9.0 ] ); + > {{alias}}.main( x.length, x, 1, y, 1 ); + > var z = y.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( z ) + 1.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( z ) + 2.0 + > z = x.get( 0 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 6.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 7.0 + + // Advanced indexing: + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > y = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + > {{alias}}.main( 2, x, -2, y, 1 ); + > z = y.get( 0 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 5.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 6.0 + > z = x.get( 0 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 0.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 0.0 + + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var y0 = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + > {{alias}}.main( 2, x1, -1, y1, 1 ); + > z = y0.get( 2 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 3.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 4.0 + > z = x0.get( 1 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 0.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 0.0 + + +{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + Interchanges two complex double-precision floating-point vectors 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. + + x: Complex128Array + First input array. + + strideX: integer + Index increment for `x`. + + offsetX: integer + Starting index for `x`. + + y: Complex128Array + Second input array. + + strideY: integer + Index increment for `y`. + + offsetY: integer + Starting index for `y`. + + Returns + ------- + y: Complex128Array + Input array `y`. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 6.0, 7.0, 8.0, 9.0 ] ); + > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ); + > var z = y.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( z ) + 1.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( z ) + 2.0 + > z = x.get( 0 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 6.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 7.0 + + // Advanced indexing: + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > y = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + > {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1 ); + > z = y.get( y.length-1 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 3.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 4.0 + > z = x.get( 1 ); + > re = {{alias:@stdlib/complex/float64/real}}( z ) + 0.0 + > im = {{alias:@stdlib/complex/float64/imag}}( z ) + 0.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 double-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 + double-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 double-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 + double-precision floating-point numbers contained in a Float32Array as + signed 32-bit integers, you must convert the Float32Array to an Int32Array + after reading memory values using this method. + + If provided an output array having an unknown or "generic" data type, + elements are read as double-precision floating-point numbers. + + Parameters + ---------- + byteOffset: integer + Byte offset at which to start reading values. + + out: ArrayLikeObject + Output array for storing read values. + + Returns + ------- + mod: Module + Module wrapper instance. + + Examples + -------- + > var mem = new {{alias:@stdlib/wasm/memory}}( { 'initial': 0 } ); + > var mod = new {{alias}}.Module( mem ); + > mod.initializeSync(); + > mod.realloc( 100 ); + > mod.write( 0, [ 1, 2, 3, 4 ] ); + > var out = [ 0, 0, 0, 0 ]; + > mod.read( 0, out ); + > out + [ 1, 2, 3, 4 ] + + +{{alias}}.Module.prototype.main( N, xp, sx, yp, sy ) + Interchanges two complex double-precision floating-point vectors. + + Parameters + ---------- + N: integer + Number of indexed elements. + + 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 + ------- + yp: integer + Input array pointer `y` (i.e., byte offset). + + 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 = 80; + + // Write data to module memory: + > var xbuf = {{alias:@stdlib/array/one-to}}( 10, 'float64' ); + > var x = new {{alias:@stdlib/array/complex128}}( xbuf.buffer ); + > mod.write( xptr, x ); + + > var ybuf = {{alias:@stdlib/array/zeros}}( 10, 'float64' ); + > var y = new {{alias:@stdlib/array/complex128}}( ybuf.buffer ); + > mod.write( yptr, y ); + + // Perform computation: + > mod.main( 5, xptr, 1, yptr, 1 ); + + // Extract results from module memory: + > var viewX = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > var viewY = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > mod.read( xptr, viewX ); + > mod.read( yptr, viewY ); + + > var v = viewX.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + 0.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 0.0 + + > var v = viewY.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + 1.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 2.0 + + +{{alias}}.Module.prototype.ndarray( N, xp, sx, ox, yp, sy, oy ) + Interchanges two complex double-precision floating-point vectors using + alternative indexing semantics. + + Parameters + ---------- + N: integer + Number of indexed elements. + + 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 + ------- + yp: integer + Input array pointer `y` (i.e., byte offset). + + 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 = 80; + + // Write data to module memory: + > var xbuf = {{alias:@stdlib/array/one-to}}( 10, 'float64' ); + > var x = new {{alias:@stdlib/array/complex128}}( xbuf.buffer ); + > mod.write( xptr, x ); + + > var ybuf = {{alias:@stdlib/array/zeros}}( 10, 'float64' ); + > var y = new {{alias:@stdlib/array/complex128}}( ybuf.buffer ); + > mod.write( yptr, y ); + + // Perform computation: + > mod.ndarray( 5, xptr, 1, 0, yptr, 1, 0 ); + + // Extract results from module memory: + > var viewX = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > var viewY = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > mod.read( xptr, viewX ); + > mod.read( yptr, viewY ); + + > var v = viewX.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + 0.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 0.0 + + > var v = viewY.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + 1.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 2.0 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts new file mode 100644 index 000000000000..ebe9392f76bd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts @@ -0,0 +1,544 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ModuleWrapper, Memory } from '@stdlib/types/wasm'; +import { Complex128Array } from '@stdlib/types/array'; + +/** +* Interface defining a module constructor which is both "newable" and "callable". +*/ +interface ModuleConstructor { + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); + * + * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new zswap.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing input vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * var xbuf = oneTo( N*2, 'float64' ); + * var x = new Complex128Array( xbuf.buffer ); + * mod.write( xptr, x ); + * + * var ybuf = zeros( N*2, 'float64' ); + * var y = new Complex128Array( ybuf.buffer ); + * mod.write( yptr, y ); + * + * // Perform computation: + * var ptr = mod.main( N, xptr, 1, yptr, 1 ); + * // returns + * + * var bool = ( ptr === yptr ); + * // returns true + * + * // Read out the results: + * var viewX = zeros( N, dtype ); + * var viewY = zeros( N, dtype ); + * mod.read( xptr, viewX ); + * mod.read( yptr, viewY ); + * + * console.log( reinterpretComplex128( viewX, 0 ) ); + * // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + * + * console.log( reinterpretComplex128( viewY, 0 ) ); + * // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] + */ + new( mem: Memory ): Module; // newable + + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); + * + * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = zswap.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing input vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * var xbuf = oneTo( N*2, 'float64' ); + * var x = new Complex128Array( xbuf.buffer ); + * mod.write( xptr, x ); + * + * var ybuf = zeros( N*2, 'float64' ); + * var y = new Complex128Array( ybuf.buffer ); + * mod.write( yptr, y ); + * + * // Perform computation: + * var ptr = mod.main( N, xptr, 1, yptr, 1 ); + * // returns + * + * var bool = ( ptr === yptr ); + * // returns true + * + * // Read out the results: + * var viewX = zeros( N, dtype ); + * var viewY = zeros( N, dtype ); + * mod.read( xptr, viewX ); + * mod.read( yptr, viewY ); + * + * console.log( reinterpretComplex128( viewX, 0 ) ); + * // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + * + * console.log( reinterpretComplex128( viewY, 0 ) ); + * // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] + */ + ( mem: Memory ): Module; // callable +} + +/** +* Interface describing a `zswap` WebAssembly module. +*/ +interface Module extends ModuleWrapper { + /** + * Interchanges two complex double-precision floating-point vectors. + * + * @param N - number of indexed elements + * @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 input array pointer `y` (i.e., byte offset) + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); + * + * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new zswap.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing input vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * var xbuf = oneTo( N*2, 'float64' ); + * var x = new Complex128Array( xbuf.buffer ); + * mod.write( xptr, x ); + * + * var ybuf = zeros( N*2, 'float64' ); + * var y = new Complex128Array( ybuf.buffer ); + * mod.write( yptr, y ); + * + * // Perform computation: + * var ptr = mod.main( N, xptr, 1, yptr, 1 ); + * // returns + * + * var bool = ( ptr === yptr ); + * // returns true + * + * // Read out the results: + * var viewX = zeros( N, dtype ); + * var viewY = zeros( N, dtype ); + * mod.read( xptr, viewX ); + * mod.read( yptr, viewY ); + * + * console.log( reinterpretComplex128( viewX, 0 ) ); + * // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + * + * console.log( reinterpretComplex128( viewY, 0 ) ); + * // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] + */ + main( N: number, xptr: number, strideX: number, yptr: number, strideY: number ): number; + + /** + * Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. + * + * @param N - number of indexed elements + * @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 input array pointer `y` (i.e., byte offset) + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); + * + * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new zswap.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing input vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * var xbuf = oneTo( N*2, 'float64' ); + * var x = new Complex128Array( xbuf.buffer ); + * mod.write( xptr, x ); + * + * var ybuf = zeros( N*2, 'float64' ); + * var y = new Complex128Array( ybuf.buffer ); + * mod.write( yptr, y ); + * + * // Perform computation: + * var ptr = mod.ndarray( N, xptr, 1, 0, yptr, 1, 0 ); + * // returns + * + * var bool = ( ptr === yptr ); + * // returns true + * + * // Read out the results: + * var viewX = zeros( N, dtype ); + * var viewY = zeros( N, dtype ); + * mod.read( xptr, viewX ); + * mod.read( yptr, viewY ); + * + * console.log( reinterpretComplex128( viewX, 0 ) ); + * // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + * + * console.log( reinterpretComplex128( viewY, 0 ) ); + * // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] + */ + ndarray( N: number, xptr: number, strideX: number, offsetX: number, yptr: number, strideY: number, offsetY: number ): number; +} + +/** +* Interface describing `zswap`. +*/ +interface Routine extends ModuleWrapper { + /** + * Interchanges two complex double-precision floating-point vectors. + * + * @param N - number of indexed elements + * @param x - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` stride length + * @returns input array `y` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); + * var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * // Perform operation: + * zswap.main( x.length, x, 1, y, 1 ); + * + * var v = x.get( 0 ); + * // returns + * + * var re = real( v ); + * // returns 1.0 + * + * var im = imag( v ); + * // returns 2.0 + * + * var v = y.get( 0 ); + * // returns + * + * var re = real( v ); + * // returns -1.0 + * + * var im = imag( v ); + * // returns -2.0 + */ + main( N: number, x: Complex128Array, strideX: number, y: Complex128Array, strideY: number ): Complex128Array; + + /** + * Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. + * + * @param N - number of indexed elements + * @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 input array `y` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); + * var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * // Perform operation: + * zswap.ndarray( x.length, x, -1, 2, y, 1, 0 ); + * + * var v = x.get( 2 ); + * // returns + * + * var re = real( v ); + * // returns 1.0 + * + * var im = imag( v ); + * // returns 2.0 + * + * var v = y.get( 2 ); + * // returns + * + * var re = real( v ); + * // returns -1.0 + * + * var im = imag( v ); + * // returns -2.0 + */ + ndarray( N: number, x: Complex128Array, strideX: number, offsetX: number, y: Complex128Array, strideY: number, offsetY: number ): Complex128Array; + + /** + * 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' ); + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); + * + * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): + * var mem = new Memory({ + * 'initial': 10, + * 'maximum': 100 + * }); + * + * // Create a BLAS routine: + * var mod = new zswap.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define pointers (i.e., byte offsets) for storing input vectors: + * var xptr = 0; + * var yptr = N * bytesPerElement( dtype ); + * + * // Write vector values to module memory: + * var xbuf = oneTo( N*2, 'float64' ); + * var x = new Complex128Array( xbuf.buffer ); + * mod.write( xptr, x ); + * + * var ybuf = zeros( N*2, 'float64' ); + * var y = new Complex128Array( ybuf.buffer ); + * mod.write( yptr, y ); + * + * // Perform computation: + * var ptr = mod.main( N, xptr, 1, yptr, 1 ); + * // returns + * + * var bool = ( ptr === yptr ); + * // returns true + * + * // Read out the results: + * var viewX = zeros( N, dtype ); + * var viewY = zeros( N, dtype ); + * mod.read( xptr, viewX ); + * mod.read( yptr, viewY ); + * + * console.log( reinterpretComplex128( viewX, 0 ) ); + * // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + * + * console.log( reinterpretComplex128( viewY, 0 ) ); + * // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] + */ + Module: ModuleConstructor; +} + +/** +* Interchanges two complex double-precision floating-point vectors. +* +* @param N - number of indexed elements +* @param x - first input array +* @param strideX - `x` stride length +* @param y - second input array +* @param strideY - `y` stride length +* @returns input array `y` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var y = new Complex128Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Perform operation: +* zswap.main( x.length, x, -1, y, 1 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 11.0 +* +* var im = imag( v ); +* // returns 12.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 5.0 +* +* var im = imag( v ); +* // returns 6.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var y = new Complex128Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Perform operation: +* zswap.ndarray( x.length, x, 1, 0, y, -1, 2 ); +* +* var v = x.get( 2 ); +* // returns +* +* var re = real( v ); +* // returns 7.0 +* +* var im = imag( v ); +* // returns 8.0 +* +* var v = y.get( 2 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +*/ +declare var zswap: Routine; + + +// EXPORTS // + +export = zswap; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts new file mode 100644 index 000000000000..c23f9c1a1f04 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts @@ -0,0 +1,529 @@ +/* +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +import Memory = require( '@stdlib/wasm/memory' ); +import zswap = require( './index' ); + + +// TESTS // + +// Attached to the main export is a `main` method which returns a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main( zx.length, zx, 1, zy, 1 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `main` method is provided a first argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main( '10', zx, 1, zy, 1 ); // $ExpectError + zswap.main( true, zx, 1, zy, 1 ); // $ExpectError + zswap.main( false, zx, 1, zy, 1 ); // $ExpectError + zswap.main( null, zx, 1, zy, 1 ); // $ExpectError + zswap.main( undefined, zx, 1, zy, 1 ); // $ExpectError + zswap.main( [], zx, 1, zy, 1 ); // $ExpectError + zswap.main( {}, zx, 1, zy, 1 ); // $ExpectError + zswap.main( ( x: number ): number => x, zx, 1, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a second argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main( zx.length, 10, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, '10', 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, true, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, false, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, null, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, undefined, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, [], 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, {}, 1, zy, 1 ); // $ExpectError + zswap.main( zx.length, ( x: number ): number => x, 1, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a third argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main( zx.length, zx, '10', zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, true, zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, false, zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, null, zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, undefined, zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, [], zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, {}, zy, 1 ); // $ExpectError + zswap.main( zx.length, zx, ( x: number ): number => x, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a fourth argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + + zswap.main( zx.length, zx, 1, 10, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, '10', 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, true, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, false, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, null, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, undefined, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, [], 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, {}, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a fifth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main( zx.length, zx, 1, zy, '10' ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, true ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, false ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, null ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, undefined ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, [] ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, {} ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided an unsupported number of arguments... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.main(); // $ExpectError + zswap.main( zx.length ); // $ExpectError + zswap.main( zx.length, zx ); // $ExpectError + zswap.main( zx.length, zx, 1 ); // $ExpectError + zswap.main( zx.length, zx, 1, zy ); // $ExpectError + zswap.main( zx.length, zx, 1, zy, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( '10', zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( true, zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( false, zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( null, zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( undefined, zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( [], zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( {}, zx, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( ( x: number ): number => x, zx, 1, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, 10, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, '10', 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, true, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, false, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, null, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, undefined, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, [], 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, {}, 1, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, ( x: number ): number => x, 1, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, '10', 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, true, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, false, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, null, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, undefined, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, [], 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, {}, 0, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, ( x: number ): number => x, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, 1, '10', zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, true, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, false, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, null, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, undefined, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, [], zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, {}, zy, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, ( x: number ): number => x, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, 1, 0, 10, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, '10', 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, true, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, false, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, null, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, undefined, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, [], 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, {}, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, 1, 0, zy, '10', 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, true, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, false, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, null, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, undefined, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, [], 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, {}, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, '10' ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, true ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, false ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, null ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, undefined ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, [] ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, {} ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const zx = new Complex128Array( 10 ); + const zy = new Complex128Array( 10 ); + + zswap.ndarray(); // $ExpectError + zswap.ndarray( zx.length ); // $ExpectError + zswap.ndarray( zx.length, zx ); // $ExpectError + zswap.ndarray( zx.length, zx, 1 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1 ); // $ExpectError + zswap.ndarray( zx.length, zx, 1, 0, zy, 1, 0, 10 ); // $ExpectError +} + +// Attached to the main export is a `Module` constructor which returns a module... +{ + const mem = new Memory({ + 'initial': 0 + }); + + zswap.Module( mem ); // $ExpectType Module +} + +// The compiler throws an error if the `Module` constructor is not provided a WebAssembly memory instance... +{ + zswap.Module( '10' ); // $ExpectError + zswap.Module( true ); // $ExpectError + zswap.Module( false ); // $ExpectError + zswap.Module( null ); // $ExpectError + zswap.Module( undefined ); // $ExpectError + zswap.Module( [] ); // $ExpectError + zswap.Module( {} ); // $ExpectError + zswap.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 = zswap.Module( mem ); + + mod.main( 10, 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 = zswap.Module( mem ); + + mod.main( '10', 10, 1, 80, 1 ); // $ExpectError + mod.main( true, 10, 1, 80, 1 ); // $ExpectError + mod.main( false, 10, 1, 80, 1 ); // $ExpectError + mod.main( null, 10, 1, 80, 1 ); // $ExpectError + mod.main( undefined, 10, 1, 80, 1 ); // $ExpectError + mod.main( [], 10, 1, 80, 1 ); // $ExpectError + mod.main( {}, 10, 1, 80, 1 ); // $ExpectError + mod.main( ( 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 second argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zswap.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 = zswap.Module( mem ); + + mod.main( 10, 0, '10', 80, 1 ); // $ExpectError + mod.main( 10, 0, true, 80, 1 ); // $ExpectError + mod.main( 10, 0, false, 80, 1 ); // $ExpectError + mod.main( 10, 0, null, 80, 1 ); // $ExpectError + mod.main( 10, 0, undefined, 80, 1 ); // $ExpectError + mod.main( 10, 0, [], 80, 1 ); // $ExpectError + mod.main( 10, 0, {}, 80, 1 ); // $ExpectError + mod.main( 10, 0, ( x: number ): number => x, 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 = zswap.Module( mem ); + + mod.main( 10, 0, 1, '10', 1 ); // $ExpectError + mod.main( 10, 0, 1, true, 1 ); // $ExpectError + mod.main( 10, 0, 1, false, 1 ); // $ExpectError + mod.main( 10, 0, 1, null, 1 ); // $ExpectError + mod.main( 10, 0, 1, undefined, 1 ); // $ExpectError + mod.main( 10, 0, 1, [], 1 ); // $ExpectError + mod.main( 10, 0, 1, {}, 1 ); // $ExpectError + mod.main( 10, 0, 1, ( x: number ): number => x, 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 = zswap.Module( mem ); + + mod.main( 10, 0, 1, 80, '10' ); // $ExpectError + mod.main( 10, 0, 1, 80, true ); // $ExpectError + mod.main( 10, 0, 1, 80, false ); // $ExpectError + mod.main( 10, 0, 1, 80, null ); // $ExpectError + mod.main( 10, 0, 1, 80, undefined ); // $ExpectError + mod.main( 10, 0, 1, 80, [] ); // $ExpectError + mod.main( 10, 0, 1, 80, {} ); // $ExpectError + mod.main( 10, 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 = zswap.Module( mem ); + + mod.main(); // $ExpectError + mod.main( 10 ); // $ExpectError + mod.main( 10, 0 ); // $ExpectError + mod.main( 10, 0, 1 ); // $ExpectError + mod.main( 10, 0, 1, 80 ); // $ExpectError + mod.main( 10, 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 = zswap.Module( mem ); + + mod.ndarray( 10, 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 = zswap.Module( mem ); + + mod.ndarray( '10', 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( true, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( false, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( null, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( undefined, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( [], 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( {}, 0, 1, 0, 80, 1, 0 ); // $ExpectError + mod.ndarray( ( 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 second argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zswap.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, 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 = zswap.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, 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 = zswap.Module( mem ); + + mod.ndarray( 10, 0, 1, '10', 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, true, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, false, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, null, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, undefined, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, [], 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, {}, 80, 1, 0 ); // $ExpectError + mod.ndarray( 10, 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 = zswap.Module( mem ); + + mod.ndarray( 10, 0, 1, 0, '10', 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, true, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, false, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, null, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, undefined, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, [], 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, {}, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, ( x: number ): number => x, 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 = zswap.Module( mem ); + + mod.ndarray( 10, 0, 1, 0, 80, '10', 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, true, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, false, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, null, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, undefined, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, [], 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, {}, 0 ); // $ExpectError + mod.ndarray( 10, 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 = zswap.Module( mem ); + + mod.ndarray( 10, 0, 1, 0, 80, 1, '10' ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, true ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, false ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, null ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, undefined ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, [] ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, {} ); // $ExpectError + mod.ndarray( 10, 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 = zswap.Module( mem ); + + mod.ndarray(); // $ExpectError + mod.ndarray( 10 ); // $ExpectError + mod.ndarray( 10, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1 ); // $ExpectError + mod.ndarray( 10, 0, 1, 0, 80, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js new file mode 100644 index 000000000000..55b12b461d25 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js @@ -0,0 +1,54 @@ +/** +* @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 zeros = require( '@stdlib/array/zeros' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zswap = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Specify a vector length: + var N = 5; + + // Create input arrays: + var xbuf = oneTo( N*2, 'float64' ); + var x = new Complex128Array( xbuf.buffer ); + + var ybuf = zeros( N*2, 'float64' ); + var y = new Complex128Array( ybuf.buffer ); + + // Perform computation: + zswap.ndarray( N, x, 1, 0, y, 1, 0 ); + + // Print the results: + console.log( reinterpretComplex128( x, 0 ) ); + // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + + console.log( reinterpretComplex128( y, 0 ) ); + // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js new file mode 100644 index 000000000000..27dfdb07802e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var Memory = require( '@stdlib/wasm/memory' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var gfillBy = require( '@stdlib/blas/ext/base/gfill-by' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Float64ArrayLE = require( '@stdlib/array/little-endian-float64' ); +var zswap = 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 zswap.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Specify a vector length: + var N = 5; + + // Define pointers (i.e., byte offsets) for storing input vectors: + var xptr = 0; + var yptr = N * bytesPerElement( 'complex128' ); + + // Create typed array views over module memory: + var x = new Float64ArrayLE( mod.memory.buffer, xptr, N*2 ); + var y = new Float64ArrayLE( mod.memory.buffer, yptr, N*2 ); + + // Write values to module memory: + gfillBy( N*2, x, 1, discreteUniform( -10.0, 10.0 ) ); + gfillBy( N*2, y, 1, discreteUniform( -10.0, 10.0 ) ); + + // Perform computation: + mod.ndarray( N, xptr, 1, 0, yptr, 1, 0 ); + + // Print the result: + console.log( 'x[:] = [%s]', x.toString() ); + console.log( 'y[:] = [%s]', y.toString() ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js new file mode 100644 index 000000000000..579f3e3d47b0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js @@ -0,0 +1,83 @@ +/** +* @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 bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zswap = 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 zswap.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Define a vector data type for interleaved real and imaginary components: + var dtype = 'complex128'; + + // Specify a vector length: + var N = 5; + + // Define pointers (i.e., byte offsets) for storing input vectors: + var xptr = 0; + var yptr = N * bytesPerElement( dtype ); + + // Write vector values to module memory: + var xbuf = oneTo( N*2, 'float64' ); + var x = new Complex128Array( xbuf.buffer ); + mod.write( xptr, x ); + + var ybuf = zeros( N*2, 'float64' ); + var y = new Complex128Array( ybuf.buffer ); + mod.write( yptr, y ); + + // Perform computation: + mod.ndarray( N, xptr, 1, 0, yptr, 1, 0 ); + + // Read out the results: + var viewX = zeros( N, dtype ); + var viewY = zeros( N, dtype ); + mod.read( xptr, viewX ); + mod.read( yptr, viewY ); + + console.log( reinterpretComplex128( viewX, 0 ) ); + // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] + + console.log( reinterpretComplex128( viewY, 0 ) ); + // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js new file mode 100644 index 000000000000..033ad832d281 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js @@ -0,0 +1,33 @@ +/** +* @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 base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); + + +// MAIN // + +var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEWA2AAAGAFf39/f38AYAd/f39/f39/AAIPAQNlbnYGbWVtb3J5AgAAAwQDAAECB0wEEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAHY196c3dhcAABD2NfenN3YXBfbmRhcnJheQACCrICAwMAAQuiAQIFfwF8IABBAEoEQEEBIABrIgUgBGxBAXRBACAEQQBMGyEGIAIgBWxBAXRBACACQQBMGyEFIARBAXQhCCACQQF0IQkDQCABIAVBA3RqIgIrAwAhCiACIAMgBkEDdGoiBCsDADkDACAEIAo5AwAgAisDCCEKIAIgBCsDCDkDCCAEIAo5AwggBiAIaiEGIAUgCWohBSAHQQFqIgcgAEcNAAsLC4cBAgF8A38gAEEASgRAIAZBAXQhBiAFQQF0IQkgA0EBdCEFIAJBAXQhCgNAIAEgBUEDdGoiAisDACEHIAIgBCAGQQN0aiIDKwMAOQMAIAMgBzkDACACKwMIIQcgAiADKwMIOQMIIAMgBzkDCCAGIAlqIQYgBSAKaiEFIAhBAWoiCCAARw0ACwsL' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js new file mode 100644 index 000000000000..6f02393f96e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/index.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js new file mode 100644 index 000000000000..1443c6b33fdc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js @@ -0,0 +1,163 @@ +/** +* @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 interchange two complex double-precision floating-point vectors. +* +* @module @stdlib/blas/base/zswap-wasm +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* +* // Define strided arrays... +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); +* +* // Perform operation: +* zswap.main( x.length, x, 1, y, 1 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 0.0 +* +* var im = imag( v ); +* // returns 0.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* +* // Define strided arrays... +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); +* +* // Perform operation: +* zswap.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 0.0 +* +* var im = imag( v ); +* // returns 0.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.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 Complex128Array = require( '@stdlib/array/complex128' ); +* var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* +* // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var mod = new zswap.Module( mem ); +* // returns +* +* // Initialize the routine: +* mod.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing input vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* mod.write( xptr, x ); +* +* var ybuf = zeros( N*2, 'float64' ); +* var y = new Complex128Array( ybuf.buffer ); +* mod.write( yptr, y ); +* +* // Perform computation: +* mod.main( N, xptr, 1, yptr, 1 ); +* +* // Read out the results: +* var viewX = zeros( N, dtype ); +* var viewY = zeros( N, dtype ); +* mod.read( xptr, viewX ); +* mod.read( yptr, viewY ); +* +* console.log( reinterpretComplex128( viewX, 0 ) ); +* // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* console.log( reinterpretComplex128( viewY, 0 ) ); +* // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var Module = require( './module.js' ); + + +// MAIN // + +setReadOnly( main, 'Module', Module ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "Module": "main.Module" } diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js new file mode 100644 index 000000000000..95f14aec93b9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js @@ -0,0 +1,100 @@ +/** +* @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 interchange two complex double-precision floating-point vectors. +* +* @name zswap +* @type {Routine} +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Define strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.main( x.length, x, 1, y, 1 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -1.0 +* +* var im = imag( v ); +* // returns -2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Define a strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.ndarray( x.length, x, 1, 0, y, -1, 2 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 5.0 +* +* var im = imag( v ); +* // returns 6.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -5.0 +* +* var im = imag( v ); +* // returns -6.0 +*/ +var zswap = new Routine(); +zswap.initializeSync(); // eslint-disable-line node/no-sync + + +// EXPORTS // + +module.exports = zswap; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js new file mode 100644 index 000000000000..7eea06bb165f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js @@ -0,0 +1,283 @@ +/** +* @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 zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +* +* // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var zswap = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zswap.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing input vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zswap.write( xptr, x ); +* +* var ybuf = zeros( N*2, 'float64' ); +* var y = new Complex128Array( ybuf.buffer ); +* zswap.write( yptr, y ); +* +* // Perform computation: +* var ptr = zswap.main( N, xptr, 1, yptr, 1 ); +* // returns +* +* var bool = ( ptr === yptr ); +* // returns true +* +* // Read out the results: +* var viewX = zeros( N, dtype ); +* var viewY = zeros( N, dtype ); +* zswap.read( xptr, viewX ); +* zswap.read( yptr, viewY ); +* +* console.log( reinterpretComplex128( viewX, 0 ) ); +* // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* console.log( reinterpretComplex128( viewY, 0 ) ); +* // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +*/ +function Module( memory ) { + if ( !( this instanceof Module ) ) { + return new Module( memory ); + } + if ( !isWebAssemblyMemory( memory ) ) { + throw new TypeError( format( 'invalid argument. Must provide a WebAssembly memory instance. Value: `%s`.', memory ) ); + } + // Call the parent constructor: + WasmModule.call( this, wasmBinary, memory, { + 'env': { + 'memory': memory + } + }); + + return this; +} + +// Inherit from the parent constructor: +inherits( Module, WasmModule ); + +/** +* Interchanges two complex double-precision floating-point vectors. +* +* @name main +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @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 {NonNegativeInteger} input array pointer `y` (i.e., byte offset) +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +* +* // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var zswap = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zswap.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing input vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zswap.write( xptr, x ); +* +* var ybuf = zeros( N*2, 'float64' ); +* var y = new Complex128Array( ybuf.buffer ); +* zswap.write( yptr, y ); +* +* // Perform computation: +* var ptr = zswap.main( N, xptr, 1, yptr, 1 ); +* // returns +* +* var bool = ( ptr === yptr ); +* // returns true +* +* // Read out the results: +* var viewX = zeros( N, dtype ); +* var viewY = zeros( N, dtype ); +* zswap.read( xptr, viewX ); +* zswap.read( yptr, viewY ); +* +* console.log( reinterpretComplex128( viewX, 0 ) ); +* // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* console.log( reinterpretComplex128( viewY, 0 ) ); +* // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +*/ +setReadOnly( Module.prototype, 'main', function zswap( N, xptr, strideX, yptr, strideY ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + this._instance.exports.c_zswap( N, xptr, strideX, yptr, strideY ); + return yptr; +}); + +/** +* Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. +* +* @name ndarray +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {NonNegativeInteger} xptr - first input array pointer (i.e., byte offset) +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {NonNegativeInteger} yptr - second input array pointer (i.e., byte offset) +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {NonNegativeInteger} input array pointer `y` (i.e., byte offset) +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +* +* // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): +* var mem = new Memory({ +* 'initial': 10, +* 'maximum': 100 +* }); +* +* // Create a BLAS routine: +* var zswap = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zswap.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define pointers (i.e., byte offsets) for storing input vectors: +* var xptr = 0; +* var yptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zswap.write( xptr, x ); +* +* var ybuf = zeros( N*2, 'float64' ); +* var y = new Complex128Array( ybuf.buffer ); +* zswap.write( yptr, y ); +* +* // Perform computation: +* var ptr = zswap.ndarray( N, xptr, 1, 0, yptr, 1, 0 ); +* // returns +* +* var bool = ( ptr === yptr ); +* // returns true +* +* // Read out the results: +* var viewX = zeros( N, dtype ); +* var viewY = zeros( N, dtype ); +* zswap.read( xptr, viewX ); +* zswap.read( yptr, viewY ); +* +* console.log( reinterpretComplex128( viewX, 0 ) ); +* // => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* console.log( reinterpretComplex128( viewY, 0 ) ); +* // => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +*/ +setReadOnly( Module.prototype, 'ndarray', function zswap( N, xptr, strideX, offsetX, yptr, strideY, offsetY ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + this._instance.exports.c_zswap_ndarray( N, xptr, strideX, offsetX, yptr, strideY, offsetY ); // eslint-disable-line max-len + return yptr; +}); + + +// EXPORTS // + +module.exports = Module; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js new file mode 100644 index 000000000000..eb7daed01ab4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js @@ -0,0 +1,264 @@ +/** +* @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 readDataView = require( '@stdlib/strided/base/read-dataview' ).ndarray; +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 Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Create a new routine: +* var zswap = new Routine(); +* +* // Initialize the module: +* zswap.initializeSync(); +* +* // Define strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.main( x.length, x, 1, y, 1 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -1.0 +* +* var im = imag( v ); +* // returns -2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Create a new routine: +* var zswap = new Routine(); +* +* // Initialize the module: +* zswap.initializeSync(); +* +* // Define strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -1.0 +* +* var im = imag( v ); +* // returns -2.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 ); + +/** +* Interchanges two complex double-precision floating-point vectors. +* +* @name main +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {Complex128Array} y - second input array +* @param {integer} strideY - `y` stride length +* @returns {Complex128Array} input array `y` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Create a new routine: +* var zswap = new Routine(); +* +* // Initialize the module: +* zswap.initializeSync(); +* +* // Define strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.main( x.length, x, 1, y, -1 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 5.0 +* +* var im = imag( v ); +* // returns 6.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -5.0 +* +* var im = imag( v ); +* // returns -6.0 +*/ +setReadOnly( Routine.prototype, 'main', function zswap( N, x, strideX, y, strideY ) { + return this.ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len +}); + +/** +* Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. +* +* @name ndarray +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex128Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {Complex128Array} input array `y` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* // Create a new routine: +* var zswap = new Routine(); +* +* // Initialize the module: +* zswap.initializeSync(); +* +* // Define strided arrays... +* var x = new Complex128Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] ); +* var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Perform operation: +* zswap.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* +* var v = x.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns 1.0 +* +* var im = imag( v ); +* // returns 2.0 +* +* var v = y.get( 0 ); +* // returns +* +* var re = real( v ); +* // returns -1.0 +* +* var im = imag( v ); +* // returns -2.0 +*/ +setReadOnly( Routine.prototype, 'ndarray', function zswap( N, 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: + Module.prototype.ndarray.call( this, N, p0.ptr, p0.stride, p0.offset, p1.ptr, p1.stride, p1.offset ); // eslint-disable-line max-len + + // If the input array data had to be copied to module memory, copy the results to the provided arrays... + if ( p0.copy ) { + readDataView( N, this.view, p0.stride*p0.BYTES_PER_ELEMENT, p0.ptr, x, strideX, offsetX, true ); // eslint-disable-line max-len + } + if ( p1.copy ) { + readDataView( N, this.view, p1.stride*p1.BYTES_PER_ELEMENT, p1.ptr, y, strideY, offsetY, true ); // eslint-disable-line max-len + } + return y; +}); + + +// EXPORTS // + +module.exports = Routine; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/manifest.json b/lib/node_modules/@stdlib/blas/base/zswap-wasm/manifest.json new file mode 100644 index 000000000000..cae4aa6e0873 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json b/lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json new file mode 100644 index 000000000000..440fd6c9d2a8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json @@ -0,0 +1,83 @@ +{ + "name": "@stdlib/blas/base/zswap-wasm", + "version": "0.0.0", + "description": "Interchange two complex double-precision floating-point vectors.", + "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", + "linear", + "algebra", + "subroutines", + "zswap", + "swap", + "vector", + "typed", + "array", + "ndarray", + "complex", + "complex128", + "float64", + "double", + "float64array", + "webassembly", + "wasm" + ], + "__stdlib__": { + "wasm": true + } +} diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js new file mode 100644 index 000000000000..348354d7029c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js @@ -0,0 +1,63 @@ +#!/usr/bin/env node + +/** +* @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 readFile = require( '@stdlib/fs/read-file' ).sync; +var writeFile = require( '@stdlib/fs/write-file' ).sync; +var replace = require( '@stdlib/string/replace' ); + + +// 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}}'; + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var wasm; + var tmpl; + + wasm = readFile( wpath ); + tmpl = readFile( tpath, opts ); + + tmpl = replace( tmpl, PLACEHOLDER, wasm.toString( 'base64' ) ); + + writeFile( opath, tmpl, opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt new file mode 100644 index 000000000000..12996dd89e3b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt @@ -0,0 +1,33 @@ +/** +* @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 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/zswap-wasm/src/Makefile b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile new file mode 100644 index 000000000000..87bc9420e487 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile @@ -0,0 +1,235 @@ +#/ +# @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 command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -flto \ + -Wall \ + -pedantic \ + -D CBLAS_INT=int32_t + +# Define the command-line options when compiling C files to WebAssembly and asm.js: +EMCCFLAGS ?= $(CFLAGS) + +# Define shared `emcc` flags: +EMCC_SHARED_FLAGS := \ + -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/zswap-wasm/src/exports.json b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/exports.json new file mode 100644 index 000000000000..839a2b782684 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/exports.json @@ -0,0 +1,4 @@ +[ + "_c_zswap", + "_c_zswap_ndarray" +] diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wasm b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wasm new file mode 100755 index 0000000000000000000000000000000000000000..ede2922fe3ffe1a0ca0d59f9913b3d6186f6558c GIT binary patch literal 459 zcmZ9G%}&EG41k?DX|h&m;)0O4xVs`DuDdNKB(!(PqIL(m?nhn4R5WQv-h)Tr330N* z0blHVcI*$raVvmhYU`nW+ijkng^F)+hbw@UzQll)Ntr7-6}aBLXWR95-whG~6@rjv zscyYL@it$Dw)IuN?~VZXBMXN^JNP>E!FTI+UvbM+{^NKG2N2V-^1C{8T^K;--x7Ii z@g=0bh%48h9{6h-kVq&VYcbmYB!lSk8O o!kF|`B>yjBSVWB?IEo;dKatpHo Date: Fri, 7 Feb 2025 07:13:39 +0000 Subject: [PATCH 2/4] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md | 2 +- .../@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js | 2 +- .../blas/base/zswap-wasm/benchmark/benchmark.module.main.js | 2 +- .../blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js | 2 +- .../@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js | 2 +- .../@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts | 2 +- .../@stdlib/blas/base/zswap-wasm/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js | 2 +- .../blas/base/zswap-wasm/examples/little_endian_arrays.js | 2 +- .../@stdlib/blas/base/zswap-wasm/examples/module.js | 2 +- .../@stdlib/blas/base/zswap-wasm/lib/binary.browser.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js | 2 +- .../@stdlib/blas/base/zswap-wasm/scripts/template.txt | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js | 2 +- lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js | 2 +- .../@stdlib/blas/base/zswap-wasm/test/test.module.js | 2 +- .../@stdlib/blas/base/zswap-wasm/test/test.module.main.js | 2 +- .../@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js | 2 +- .../@stdlib/blas/base/zswap-wasm/test/test.ndarray.js | 2 +- .../@stdlib/blas/base/zswap-wasm/test/test.routine.js | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md b/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md index 81e1a5e5e1e9..ac5437ad81d2 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js index 9584a6787d32..e3e18a5d38a3 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js index 4284d5fd2e43..9c0171339dae 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js index 155fe83c7766..a555f520c575 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js index 4efb241e0f6c..f09b8ae1cc0a 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js index 0108f0712e35..051fb7577a45 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts index ebe9392f76bd..3fa7328c225f 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts index c23f9c1a1f04..9fef58edea7e 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/examples/index.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js index 55b12b461d25..cdb3ca652dbe 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js index 27dfdb07802e..3c83f3fa7d2e 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/examples/module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js index 579f3e3d47b0..e9c3f9725734 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js index 033ad832d281..e4af49081751 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.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/zswap-wasm/lib/binary.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js index 6f02393f96e5..2b83fe651780 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/index.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js index 1443c6b33fdc..b42ee1fd54f4 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js index 95f14aec93b9..bb6b0053f2ad 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js index 7eea06bb165f..a0dcd274cfe1 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/lib/routine.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js index eb7daed01ab4..245dc36e7e16 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/scripts/build.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js index 348354d7029c..9a7b4afb94bd 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js @@ -3,7 +3,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/zswap-wasm/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt index 12996dd89e3b..554d4b2abe02 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt @@ -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/zswap-wasm/src/Makefile b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile index 87bc9420e487..c6976e9d0f03 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/src/main.wat b/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat index 4e61655818e2..74bed7975233 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js index 2b7329821170..f3869c27886c 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js index cd8ccdd4b182..e9898ec3ab54 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.module.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.js index 9adcb07e22fa..0cdcd97ef151 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.main.js index f7f723b64cf1..6a0d81bafa5c 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js index fe3b596647d4..d42ff6876b81 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.ndarray.js index d5fe09d6f02a..52880ab0af08 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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/zswap-wasm/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.routine.js index 56a4b67daaf0..d90a5804a8e1 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.routine.js +++ b/lib/node_modules/@stdlib/blas/base/zswap-wasm/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 6dc2130bc45c2f42fbf58b50f3be9661bacddcf9 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Fri, 7 Feb 2025 13:34:37 +0530 Subject: [PATCH 3/4] refactor: update path and name --- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed --- --- .../blas/base/{zswap-wasm => wasm/zswap}/README.md | 8 ++++---- .../zswap}/benchmark/benchmark.js | 0 .../zswap}/benchmark/benchmark.module.js | 0 .../zswap}/benchmark/benchmark.module.main.js | 0 .../zswap}/benchmark/benchmark.module.ndarray.js | 0 .../zswap}/benchmark/benchmark.ndarray.js | 0 .../base/{zswap-wasm => wasm/zswap}/docs/repl.txt | 0 .../zswap}/docs/types/index.d.ts | 0 .../{zswap-wasm => wasm/zswap}/docs/types/test.ts | 0 .../{zswap-wasm => wasm/zswap}/examples/index.js | 0 .../zswap}/examples/little_endian_arrays.js | 0 .../{zswap-wasm => wasm/zswap}/examples/module.js | 0 .../zswap}/lib/binary.browser.js | 0 .../base/{zswap-wasm => wasm/zswap}/lib/binary.js | 0 .../base/{zswap-wasm => wasm/zswap}/lib/index.js | 8 ++++---- .../base/{zswap-wasm => wasm/zswap}/lib/main.js | 0 .../base/{zswap-wasm => wasm/zswap}/lib/module.js | 0 .../base/{zswap-wasm => wasm/zswap}/lib/routine.js | 0 .../base/{zswap-wasm => wasm/zswap}/manifest.json | 0 .../base/{zswap-wasm => wasm/zswap}/package.json | 2 +- .../{zswap-wasm => wasm/zswap}/scripts/build.js | 0 .../{zswap-wasm => wasm/zswap}/scripts/template.txt | 0 .../base/{zswap-wasm => wasm/zswap}/src/Makefile | 0 .../{zswap-wasm => wasm/zswap}/src/exports.json | 0 .../base/{zswap-wasm => wasm/zswap}/src/main.wasm | Bin .../base/{zswap-wasm => wasm/zswap}/src/main.wat | 0 .../base/{zswap-wasm => wasm/zswap}/test/test.js | 0 .../{zswap-wasm => wasm/zswap}/test/test.main.js | 0 .../{zswap-wasm => wasm/zswap}/test/test.module.js | 0 .../zswap}/test/test.module.main.js | 0 .../zswap}/test/test.module.ndarray.js | 0 .../{zswap-wasm => wasm/zswap}/test/test.ndarray.js | 0 .../{zswap-wasm => wasm/zswap}/test/test.routine.js | 0 33 files changed, 9 insertions(+), 9 deletions(-) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/README.md (98%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/benchmark/benchmark.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/benchmark/benchmark.module.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/benchmark/benchmark.module.main.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/benchmark/benchmark.module.ndarray.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/benchmark/benchmark.ndarray.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/docs/repl.txt (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/docs/types/index.d.ts (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/docs/types/test.ts (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/examples/index.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/examples/little_endian_arrays.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/examples/module.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/binary.browser.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/binary.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/index.js (95%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/main.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/module.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/lib/routine.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/manifest.json (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/package.json (97%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/scripts/build.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/scripts/template.txt (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/src/Makefile (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/src/exports.json (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/src/main.wasm (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/src/main.wat (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.main.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.module.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.module.main.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.module.ndarray.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.ndarray.js (100%) rename lib/node_modules/@stdlib/blas/base/{zswap-wasm => wasm/zswap}/test/test.routine.js (100%) diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md b/lib/node_modules/@stdlib/blas/base/wasm/zswap/README.md similarity index 98% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/README.md index ac5437ad81d2..aca8f1ab94d8 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/zswap/README.md @@ -27,7 +27,7 @@ limitations under the License. ## Usage ```javascript -var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +var zswap = require( '@stdlib/blas/base/wasm/zswap' ); ``` #### zswap.main( N, x, strideX, y, strideY ) @@ -250,7 +250,7 @@ var zeros = require( '@stdlib/array/zeros' ); var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); var Complex128Array = require( '@stdlib/array/complex128' ); var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); -var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +var zswap = require( '@stdlib/blas/base/wasm/zswap' ); // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): var mem = new Memory({ @@ -321,7 +321,7 @@ var zeros = require( '@stdlib/array/zeros' ); var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); var Complex128Array = require( '@stdlib/array/complex128' ); var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); -var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +var zswap = require( '@stdlib/blas/base/wasm/zswap' ); // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): var mem = new Memory({ @@ -408,7 +408,7 @@ var oneTo = require( '@stdlib/array/one-to' ); var zeros = require( '@stdlib/array/zeros' ); var Complex128Array = require( '@stdlib/array/complex128' ); var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); -var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +var zswap = require( '@stdlib/blas/base/wasm/zswap' ); // Specify a vector length: var N = 5; diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.main.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.main.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.main.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.ndarray.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.module.ndarray.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.module.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.ndarray.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/benchmark/benchmark.ndarray.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/benchmark/benchmark.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/repl.txt rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/types/index.d.ts similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/index.d.ts rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/types/index.d.ts diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/types/test.ts similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/docs/types/test.ts rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/index.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/index.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/index.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/little_endian_arrays.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/little_endian_arrays.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/little_endian_arrays.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/module.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/examples/module.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/examples/module.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/binary.browser.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.browser.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/binary.browser.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/binary.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/binary.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/binary.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/index.js similarity index 95% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/index.js index b42ee1fd54f4..25d3f84c80f9 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/index.js @@ -21,13 +21,13 @@ /** * WebAssembly routine to interchange two complex double-precision floating-point vectors. * -* @module @stdlib/blas/base/zswap-wasm +* @module @stdlib/blas/base/wasm/zswap * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); -* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* var zswap = require( '@stdlib/blas/base/wasm/zswap' ); * * // Define strided arrays... * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); @@ -59,7 +59,7 @@ * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); -* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* var zswap = require( '@stdlib/blas/base/wasm/zswap' ); * * // Define strided arrays... * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); @@ -94,7 +94,7 @@ * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); * var Complex128Array = require( '@stdlib/array/complex128' ); * var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); -* var zswap = require( '@stdlib/blas/base/zswap-wasm' ); +* var zswap = require( '@stdlib/blas/base/wasm/zswap' ); * * // Create a new memory instance with an initial size of 10 pages (320KiB) and a maximum size of 100 pages (6.4MiB): * var mem = new Memory({ diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/main.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/main.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/module.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/module.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/module.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/routine.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/lib/routine.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/lib/routine.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/manifest.json b/lib/node_modules/@stdlib/blas/base/wasm/zswap/manifest.json similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/manifest.json rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/manifest.json diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json b/lib/node_modules/@stdlib/blas/base/wasm/zswap/package.json similarity index 97% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/package.json index 440fd6c9d2a8..d0e73d9414a3 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap-wasm/package.json +++ b/lib/node_modules/@stdlib/blas/base/wasm/zswap/package.json @@ -1,5 +1,5 @@ { - "name": "@stdlib/blas/base/zswap-wasm", + "name": "@stdlib/blas/base/wasm/zswap", "version": "0.0.0", "description": "Interchange two complex double-precision floating-point vectors.", "license": "Apache-2.0", diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/scripts/build.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/build.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/scripts/build.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/wasm/zswap/scripts/template.txt similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/scripts/template.txt rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/scripts/template.txt diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/zswap/src/Makefile similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/src/Makefile rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/src/Makefile diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/exports.json b/lib/node_modules/@stdlib/blas/base/wasm/zswap/src/exports.json similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/src/exports.json rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/src/exports.json diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wasm b/lib/node_modules/@stdlib/blas/base/wasm/zswap/src/main.wasm similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wasm rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/src/main.wasm diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat b/lib/node_modules/@stdlib/blas/base/wasm/zswap/src/main.wat similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/src/main.wat rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/src/main.wat diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.main.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.main.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.main.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.main.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.main.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.main.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.ndarray.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.module.ndarray.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.module.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.ndarray.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.ndarray.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.routine.js similarity index 100% rename from lib/node_modules/@stdlib/blas/base/zswap-wasm/test/test.routine.js rename to lib/node_modules/@stdlib/blas/base/wasm/zswap/test/test.routine.js From eb05666c6c43dd187f1b6cbffb94d3aa7b5962b8 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 7 Feb 2025 23:16:16 -0800 Subject: [PATCH 4/4] docs: fix copy --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/base/wasm/zswap/docs/repl.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt index 759fa3f3473c..80c97728bfc4 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/zswap/docs/repl.txt @@ -405,12 +405,12 @@ 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 double-precision floating-point number + 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 - double-precision floating-point numbers contained in a Float32Array as + 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. @@ -444,12 +444,12 @@ 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 double-precision floating-point number + 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 - double-precision floating-point numbers contained in a Float32Array as + 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.