From 1d7b69641f2ba8f8d4fcfb26d7794bb70f20e0e7 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 25 Apr 2025 13:02:41 +0530 Subject: [PATCH 1/4] feat: add blas/base/wasm/zscal --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/zscal/README.md | 380 ++++++++++++ .../base/wasm/zscal/benchmark/benchmark.js | 115 ++++ .../wasm/zscal/benchmark/benchmark.module.js | 66 +++ .../zscal/benchmark/benchmark.module.main.js | 144 +++++ .../benchmark/benchmark.module.ndarray.js | 144 +++++ .../wasm/zscal/benchmark/benchmark.ndarray.js | 115 ++++ .../blas/base/wasm/zscal/docs/repl.txt | 549 ++++++++++++++++++ .../base/wasm/zscal/docs/types/index.d.ts | 467 +++++++++++++++ .../blas/base/wasm/zscal/docs/types/test.ts | 426 ++++++++++++++ .../blas/base/wasm/zscal/examples/index.js | 51 ++ .../zscal/examples/little_endian_arrays.js | 71 +++ .../blas/base/wasm/zscal/examples/module.js | 80 +++ .../base/wasm/zscal/lib/binary.browser.js | 33 ++ .../blas/base/wasm/zscal/lib/binary.js | 34 ++ .../@stdlib/blas/base/wasm/zscal/lib/index.js | 127 ++++ .../@stdlib/blas/base/wasm/zscal/lib/main.js | 68 +++ .../blas/base/wasm/zscal/lib/module.js | 274 +++++++++ .../blas/base/wasm/zscal/lib/routine.js | 195 +++++++ .../blas/base/wasm/zscal/manifest.json | 36 ++ .../@stdlib/blas/base/wasm/zscal/package.json | 84 +++ .../blas/base/wasm/zscal/scripts/build.js | 66 +++ .../blas/base/wasm/zscal/scripts/template.txt | 33 ++ .../@stdlib/blas/base/wasm/zscal/src/Makefile | 235 ++++++++ .../blas/base/wasm/zscal/src/exports.json | 4 + .../blas/base/wasm/zscal/src/main.wasm | Bin 0 -> 640 bytes .../@stdlib/blas/base/wasm/zscal/src/main.wat | 299 ++++++++++ .../@stdlib/blas/base/wasm/zscal/test/test.js | 53 ++ .../blas/base/wasm/zscal/test/test.main.js | 276 +++++++++ .../blas/base/wasm/zscal/test/test.module.js | 154 +++++ .../base/wasm/zscal/test/test.module.main.js | 295 ++++++++++ .../wasm/zscal/test/test.module.ndarray.js | 423 ++++++++++++++ .../blas/base/wasm/zscal/test/test.ndarray.js | 331 +++++++++++ .../blas/base/wasm/zscal/test/test.routine.js | 71 +++ .../complex/float64/base/mul/manifest.json | 22 +- 34 files changed, 5720 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.browser.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/build.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/template.txt create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/src/exports.json create mode 100755 lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wasm create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wat create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md new file mode 100644 index 000000000000..d54c05bb4980 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md @@ -0,0 +1,380 @@ + + +# zscal + +> Scale a double-precision complex floating-point vector by a double-precision complex floating-point constant. + +
+ +## Usage + +```javascript +var zscal = require( '@stdlib/blas/base/wasm/zscal' ); +``` + +#### zscal.main( N, za, zx, strideX ) + +Scales values from `zx` by `za`. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +// Define a strided array: +var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Define a scalar constant: +var za = new Complex128( 2.0, 2.0 ); + +// Perform operation: +zscal.main( zx.length, za, zx, 1 ); +// zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. +- **zx**: input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `zx`. + +The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to scale every other value in `zx` by `za`, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +// Define a strided array: +var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Define a scalar constant: +var za = new Complex128( 2.0, 2.0 ); + +// Perform operation: +zscal.main( 2, za, zx, 2 ); +// zx => [ -2.0, 6.0, 3.0, 4.0, -2.0, 22.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 Complex128 = require( '@stdlib/complex/float64/ctor' ); + +// Initial array: +var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + +// Define a scalar constant: +var za = new Complex128( 2.0, 2.0 ); + +// Create an offset view: +var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Scales every other value from `zx1` by `za`... +zscal.main( 3, za, zx1, 1 ); +// zx0 => [ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ] +``` + +#### zscal.ndarray( N, za, zx, strideX, offsetX ) + +Scales values from `zx` by `za` using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +// Define a strided array: +var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Define a scalar constant: +var za = new Complex128( 2.0, 2.0 ); + +// Perform operation: +zscal.ndarray( zx.length, za, zx, 1, 0 ); +// zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `zx`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to scale every other value in the input strided array starting from the second element, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var za = new Complex128( 2.0, 2.0 ); + +zscal.ndarray( 2, za, zx, 2, 1 ); +// zx => [ 1.0, 2.0, -2.0, 14.0, 5.0, 6.0, -2.0, 30.0 ] +``` + +* * * + +### Module + +#### zscal.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 zscal.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); +``` + +#### zscal.Module.prototype.main( N, zap, zxp, sx ) + +Scales values from `zx` by `za` . + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ones = require( '@stdlib/array/ones' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zscal = require( '@stdlib/blas/base/wasm/zscal' ); + +// 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 zscal.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex128'; + +// Specify a vector length: +var N = 5; + +// Define a pointer (i.e., byte offset) for storing the input vector: +var xptr = 0; + +// Define a pointer for storing a complex number: +var zptr = 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 ); + +// Write a complex number to module memory: +mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + +// Perform computation: +mod.main( N, zptr, xptr, 1 ); + +// Read out the results: +var view = zeros( N, dtype ); +mod.read( xptr, view ); + +console.log( reinterpretComplex64( view, 0 ) ); +// => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **zap**: pointer (i.e., byte offset) to a scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. +- **zxp**: input [`Complex128Array`][@stdlib/array/complex128] pointer (i.e., byte offset). +- **sx**: index increment for `zx`. + +#### zscal.Module.prototype.ndarray( N, zap, zxp, sx, ox ) + +Scales values from `zx` by `za` using alternative indexing semantics. + + + +```javascript +var Memory = require( '@stdlib/wasm/memory' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ones = require( '@stdlib/array/ones' ); +var zeros = require( '@stdlib/array/zeros' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zscal = require( '@stdlib/blas/base/wasm/zscal' ); + +// 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 zscal.Module( mem ); +// returns + +// Initialize the routine: +mod.initializeSync(); + +// Define a vector data type: +var dtype = 'complex128'; + +// Specify a vector length: +var N = 5; + +// Define a pointer (i.e., byte offset) for storing the input vector: +var xptr = 0; + +// Define a pointer for storing a complex number: +var zptr = 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 ); + +// Write a complex number to module memory: +mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + +// Perform computation: +mod.ndarray( N, zptr, xptr, 1, 0 ); + +// Read out the results: +var view = zeros( N, dtype ); +mod.read( xptr, view ); + +console.log( reinterpretComplex64( view, 0 ) ); +// => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +``` + +The function has the following additional parameters: + +- **ox**: starting index for `x`. + +
+ + + +
+ +* * * + +## Notes + +- If `N <= 0`, `zx` is left unchanged. +- This package implements routines using WebAssembly. When provided arrays which are not allocated on a `zscal` 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/zscal`][@stdlib/blas/base/zscal]. 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/zscal`][@stdlib/blas/base/zscal]. 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. +- `zscal()` corresponds to the [BLAS][blas] level 1 function [`zscal`][zscal]. + +
+ + + +
+ +* * * + +## Examples + + + +```javascript +var hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); +var oneTo = require( '@stdlib/array/one-to' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zscal = require( '@stdlib/blas/base/wasm/zscal' ); + +// Specify a vector length: +var N = 5; + +// Create an input array: +var xbuf = oneTo( N*2, 'float64' ); +var x = new Complex128Array( xbuf.buffer ); + +// Create a complex number: +var z = new Complex128( 2.0, 2.0 ); + +// Perform computation: +zscal.ndarray( N, z, x, 1, 0 ); + +// Print the results: +console.log( reinterpretComplex64( x, 0 ) ); +// => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js new file mode 100644 index 000000000000..f25eb1a4abd2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js @@ -0,0 +1,115 @@ +/** +* @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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zscal = 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 x; + var z; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + + z = new Complex128( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zscal.main( x.length, z, x, 1 ); + if ( isnan( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js new file mode 100644 index 000000000000..808c6880f675 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/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 zscal = 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 zscal.Module( values[ i%values.length ] ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( typeof v !== 'object' ) { + b.fail( 'should return an object' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js new file mode 100644 index 000000000000..8957df205d18 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js @@ -0,0 +1,144 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var zscal = 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 zptr; + 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 zscal.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing one vector and a complex number: + nb = bytesPerElement( 'complex128' ); + mod.realloc( (N*nb)+nb ); + + // Define a pointer (i.e., byte offset) to the first vector element: + xptr = 0; + + // Define a pointer to a complex number: + zptr = N * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( N, -100.0, 100.0, options ) ); + mod.write( zptr, new Float64Array( [ 1.0, 0.0 ] ) ); + + // Retrieve a DataView of module memory: + view = mod.view; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mod.main( len, zptr, xptr, 1 ); + byteOffset = xptr + ( (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/wasm/zscal/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js new file mode 100644 index 000000000000..2462f710733e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js @@ -0,0 +1,144 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var cscal = 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 zptr; + 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 cscal.Module( mem ); + + // Initialize the module: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Reallocate the underlying memory to allow storing one vector and a complex number: + nb = bytesPerElement( 'complex128' ); + mod.realloc( (N*nb)+nb ); + + // Define a pointer (i.e., byte offset) to the first vector element: + xptr = 0; + + // Define a pointer to a complex number: + zptr = N * nb; + + // Write random values to module memory: + mod.write( xptr, uniform( N, -100.0, 100.0, options ) ); + mod.write( zptr, new Float64Array( [ 1.0, 0.0 ] ) ); + + // Retrieve a DataView of module memory: + view = mod.view; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mod.ndarray( len, zptr, xptr, 1, 0 ); + byteOffset = xptr + ( (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/wasm/zscal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..2337f20fdc24 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js @@ -0,0 +1,115 @@ +/** +* @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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zscal = 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 x; + var z; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + + z = new Complex128( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zscal.ndarray( x.length, z, x, 1, 0 ); + if ( isnan( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( xbuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt new file mode 100644 index 000000000000..41c4b3911ffd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt @@ -0,0 +1,549 @@ + +{{alias}}.main( N, za, zx, strideX ) + Scales a double-precision complex floating-point vector by a double- + precision complex floating-point constant. + + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N <= 0`, the function returns `zx` unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + za: Complex128 + Complex constant. + + zx: Complex128Array + Input array. + + strideX: integer + Index increment for `zx`. + + Returns + ------- + zx: Complex128Array + Input array. + + Examples + -------- + // Standard usage: + > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}.main( 2, za, zx, 1 ) + [ -3.0, 4.0, -5.0, 10.0 ] + + // Advanced indexing: + > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 1.0 ); + > {{alias}}.main( 2, za, zx, 2 ) + [ -1.0, 3.0, 3.0, 4.0, -1.0, 11.0 ] + + // Using typed array views: + > var zx0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var zx1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); + > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}.main( 2, za, zx1, 1 ) + [ -2.0, 14.0, -2.0, 22.0 ] + > zx0 + [ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0 ] + + +{{alias}}.ndarray( N, za, zx, strideX, offsetX ) + Scales a double-precision complex floating-point vector by a double- + precision complex floating-point constant 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. + + za: Complex128 + Complex constant. + + zx: Complex128Array + Input array. + + strideX: integer + Index increment for `zx`. + + offsetX: integer + Starting index for `zx`. + + Returns + ------- + zx: Complex128Array + Input array. + + Examples + -------- + // Standard usage: + > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}.ndarray( 2, za, zx, 1, 0 ) + [ -2.0, 6.0, -2.0, 14.0 ] + + // Advanced indexing: + > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}.ndarray( 2, za, zx, 1, 2 ) + [ 1.0, 2.0, 3.0, 4.0, -7.0, 16.0, -9.0, 22.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 Float64Array, + 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 Float64Array as + signed 32-bit integers, you must first convert the Float64Array 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 Float64Array, + 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 Float64Array as + signed 32-bit integers, you must convert the Float64Array 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, zap, zxp, dx ) + Scales a double-precision complex floating-point vector by a double- + precision complex floating-point constant. + + Parameters + ---------- + N: integer + Number of indexed elements. + + zap: integer + Pointer (i.e., byte offset) to a scalar complex constant. + + zxp: integer + Input array pointer (i.e., byte offset). + + dx: integer + Index increment for `zx`. + + Returns + ------- + zxp: integer + Input array pointer (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 zptr = 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 ); + + // Write a complex number to module memory: + > mod.write( zptr, new {{alias:@stdlib/array/float64}}( [ 2.0, 2.0 ] ) ); + + // Perform computation: + > mod.main( 5, zptr, xptr, 1 ); + + // Extract results from module memory: + > var view = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > mod.read( xptr, view ); + + > var v = view.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + -2.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 6.0 + + +{{alias}}.Module.prototype.ndarray( N, zap, zxp, dx, ox ) + Scales a double-precision complex floating-point vector by a double- + precision complex floating-point constant using alternative indexing + semantics. + + Parameters + ---------- + N: integer + Number of indexed elements. + + zap: integer + Pointer (i.e., byte offset) to a scalar complex constant. + + zxp: integer + Input array pointer (i.e., byte offset). + + dx: integer + Index increment for `zx`. + + ox: integer + Starting index for `zx`. + + Returns + ------- + zxp: integer + Input array pointer (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 zptr = 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 ); + + // Write a complex number to module memory: + > mod.write( zptr, new {{alias:@stdlib/array/float64}}( [ 2.0, 2.0 ] ) ); + + // Perform computation: + > mod.main( 5, zptr, xptr, 1, 0 ); + + // Extract results from module memory: + > var view = {{alias:@stdlib/array/zeros}}( 5, 'complex128' ); + > mod.read( xptr, view ); + + > var v = view.get( 0 ); + > var re = {{alias:@stdlib/complex/float64/real}}( v ) + -2.0 + > var im = {{alias:@stdlib/complex/float64/imag}}( v ) + 6.0 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts new file mode 100644 index 000000000000..5a44bcdae651 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts @@ -0,0 +1,467 @@ +/* +* @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'; +import { Complex128 } from '@stdlib/types/complex'; + +/** +* Interface defining a module constructor which is both "newable" and "callable". +*/ +interface ModuleConstructor { + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Float64Array = require( '@stdlib/array/float64' ); + * 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 zscal.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define a pointer (i.e., byte offset) for storing the input vector: + * var xptr = 0; + * + * // Define a pointer for storing a complex number: + * var zptr = 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 ); + * + * // Write a complex number to module memory: + * mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + * + * // Perform computation: + * var ptr = mod.main( N, zptr, xptr, 1 ); + * // returns + * + * var bool = ( ptr === xptr ); + * // returns true + * + * // Read out the results: + * var view = zeros( N, dtype ); + * mod.read( xptr, view ); + * + * console.log( reinterpretComplex128( view, 0 ) ); + * // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] + */ + new( mem: Memory ): Module; // newable + + /** + * Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory. + * + * @param mem - WebAssembly memory instance + * @returns module wrapper instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * var oneTo = require( '@stdlib/array/one-to' ); + * var ones = require( '@stdlib/array/ones' ); + * var zeros = require( '@stdlib/array/zeros' ); + * var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); + * var Float64Array = require( '@stdlib/array/float64' ); + * 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 = zscal.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define a pointer (i.e., byte offset) for storing the input vector: + * var xptr = 0; + * + * // Define a pointer for storing a complex number: + * var zptr = 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 ); + * + * // Write a complex number to module memory: + * mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + * + * // Perform computation: + * var ptr = mod.main( N, zptr, xptr, 1 ); + * // returns + * + * var bool = ( ptr === xptr ); + * // returns true + * + * // Read out the results: + * var view = zeros( N, dtype ); + * mod.read( xptr, view ); + * + * console.log( reinterpretComplex128( view, 0 ) ); + * // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] + */ + ( mem: Memory ): Module; // callable +} + +/** +* Interface describing a `zscal` WebAssembly module. +*/ +interface Module extends ModuleWrapper { + /** + * Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant. + * + * @param N - number of indexed elements + * @param aptr - scalar constant pointer (i.e., byte offset) + * @param xptr - input array pointer (i.e., byte offset) + * @param strideX - `x` stride length + * @returns input array pointer (i.e., byte offset) + * + * @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 Float64Array = require( '@stdlib/array/float64' ); + * 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 zscal.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define a pointer (i.e., byte offset) for storing the input vector: + * var xptr = 0; + * + * // Define a pointer for storing a complex number: + * var zptr = 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 ); + * + * // Write a complex number to module memory: + * mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + * + * // Perform computation: + * var ptr = mod.main( N, zptr, xptr, 1 ); + * // returns + * + * var bool = ( ptr === xptr ); + * // returns true + * + * // Read out the results: + * var view = zeros( N, dtype ); + * mod.read( xptr, view ); + * + * console.log( reinterpretComplex128( view, 0 ) ); + * // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] + */ + main( N: number, aptr: number, xptr: number, strideX: number ): number; + + /** + * Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param aptr - scalar constant pointer (i.e., byte offset) + * @param xptr - input array pointer (i.e., byte offset) + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @returns input array pointer (i.e., byte offset) + * + * @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 Float64Array = require( '@stdlib/array/float64' ); + * 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 zscal.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define a pointer (i.e., byte offset) for storing the input vector: + * var xptr = 0; + * + * // Define a pointer for storing a complex number: + * var zptr = 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 ); + * + * // Write a complex number to module memory: + * mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + * + * // Perform computation: + * var ptr = mod.ndarray( N, zptr, xptr, 1, 0 ); + * // returns + * + * var bool = ( ptr === xptr ); + * // returns true + * + * // Read out the results: + * var view = zeros( N, dtype ); + * mod.read( xptr, view ); + * + * console.log( reinterpretComplex128( view, 0 ) ); + * // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] + */ + ndarray( N: number, aptr: number, xptr: number, strideX: number, offsetX: number ): number; +} + +/** +* Interface describing `zscal`. +*/ +interface Routine extends ModuleWrapper { + /** + * Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant. + * + * @param N - number of indexed elements + * @param alpha - constant + * @param x - input array + * @param strideX - `x` stride length + * @returns input array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * // Define a strided array: + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * // Define a scalar constant: + * var z = new Complex128( 2.0, 2.0 ); + * + * // Perform operation: + * zscal.main( x.length, z, x, 1 ); + * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] + */ + main( N: number, alpha: Complex128, x: Complex128Array, strideX: number ): Complex128Array; + + /** + * Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param alpha - constant + * @param x - input array + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @returns input array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * // Define a strided array: + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * // Define a scalar constant: + * var z = new Complex128( 2.0, 2.0 ); + * + * // Perform operation: + * zscal.ndarray( x.length, z, x, 1, 0 ); + * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] + */ + ndarray( N: number, alpha: Complex128, x: Complex128Array, strideX: number, offsetX: 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 Float64Array = require( '@stdlib/array/float64' ); + * 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 zscal.Module( mem ); + * // returns + * + * // Initialize the routine: + * mod.initializeSync(); + * + * // Define a vector data type: + * var dtype = 'complex128'; + * + * // Specify a vector length: + * var N = 5; + * + * // Define a pointer (i.e., byte offset) for storing the input vector: + * var xptr = 0; + * + * // Define a pointer for storing a complex number: + * var zptr = 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 ); + * + * // Write a complex number to module memory: + * mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + * + * // Perform computation: + * var ptr = mod.main( N, zptr, xptr, 1 ); + * // returns + * + * var bool = ( ptr === xptr ); + * // returns true + * + * // Read out the results: + * var view = zeros( N, dtype ); + * mod.read( xptr, view ); + * + * console.log( reinterpretComplex128( view, 0 ) ); + * // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] + */ + Module: ModuleConstructor; +} + +/** +* Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant. +* +* @param N - number of indexed elements +* @param alpha - constant +* @param x - input array +* @param strideX - `x` stride length +* @returns input array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.main( x.length, z, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.ndarray( x.length, z, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +*/ +declare var zscal: Routine; + + +// EXPORTS // + +export = zscal; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts new file mode 100644 index 000000000000..22bf8a3f7c07 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts @@ -0,0 +1,426 @@ +/* +* @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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +import Memory = require( '@stdlib/wasm/memory' ); +import zscal = require( './index' ); + + +// TESTS // + +// Attached to the main export is a `main` method which returns a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.main( zx.length, za, zx, 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 za = new Complex128( 2.0, 2.0 ); + + zscal.main( '10', za, zx, 1 ); // $ExpectError + zscal.main( true, za, zx, 1 ); // $ExpectError + zscal.main( false, za, zx, 1 ); // $ExpectError + zscal.main( null, za, zx, 1 ); // $ExpectError + zscal.main( undefined, za, zx, 1 ); // $ExpectError + zscal.main( [], za, zx, 1 ); // $ExpectError + zscal.main( {}, za, zx, 1 ); // $ExpectError + zscal.main( ( x: number ): number => x, za, zx, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a second argument which is not a complex number... +{ + const zx = new Complex128Array( 10 ); + + zscal.main( zx.length, '10', zx, 1 ); // $ExpectError + zscal.main( zx.length, true, zx, 1 ); // $ExpectError + zscal.main( zx.length, false, zx, 1 ); // $ExpectError + zscal.main( zx.length, null, zx, 1 ); // $ExpectError + zscal.main( zx.length, undefined, zx, 1 ); // $ExpectError + zscal.main( zx.length, [], zx, 1 ); // $ExpectError + zscal.main( zx.length, {}, zx, 1 ); // $ExpectError + zscal.main( zx.length, ( x: number ): number => x, zx, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a third argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.main( zx.length, za, 10, 1 ); // $ExpectError + zscal.main( zx.length, za, '10', 1 ); // $ExpectError + zscal.main( zx.length, za, true, 1 ); // $ExpectError + zscal.main( zx.length, za, false, 1 ); // $ExpectError + zscal.main( zx.length, za, null, 1 ); // $ExpectError + zscal.main( zx.length, za, undefined, 1 ); // $ExpectError + zscal.main( zx.length, za, [], 1 ); // $ExpectError + zscal.main( zx.length, za, {}, 1 ); // $ExpectError + zscal.main( zx.length, za, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the `main` method is provided a fourth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.main( zx.length, za, zx, '10' ); // $ExpectError + zscal.main( zx.length, za, zx, true ); // $ExpectError + zscal.main( zx.length, za, zx, false ); // $ExpectError + zscal.main( zx.length, za, zx, null ); // $ExpectError + zscal.main( zx.length, za, zx, undefined ); // $ExpectError + zscal.main( zx.length, za, zx, [] ); // $ExpectError + zscal.main( zx.length, za, zx, {} ); // $ExpectError + zscal.main( zx.length, za, zx, ( 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 za = new Complex128( 2.0, 2.0 ); + + zscal.main(); // $ExpectError + zscal.main( zx.length ); // $ExpectError + zscal.main( zx.length, za ); // $ExpectError + zscal.main( zx.length, za, x ); // $ExpectError + zscal.main( zx.length, za, zx, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( zx.length, za, zx, 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 za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( '10', za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( true, za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( false, za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( null, za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( undefined, za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( [], za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( {}, za, zx, 1, 0 ); // $ExpectError + zscal.ndarray( ( x: number ): number => x, za, zx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a complex number... +{ + const zx = new Complex128Array( 10 ); + + zscal.ndarray( zx.length, '10', zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, true, zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, false, zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, null, zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, undefined, zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, [], zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, {}, zx, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, ( x: number ): number => x, zx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Complex128Array... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( zx.length, za, 10, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, '10', 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, true, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, false, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, null, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, undefined, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, [], 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, {}, 1, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( zx.length, za, zx, '10', 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, true, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, false, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, null, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, undefined, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, [], 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, {}, 0 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const zx = new Complex128Array( 10 ); + const za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( zx.length, za, zx, 1, '10' ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, true ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, false ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, null ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, undefined ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, [] ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, {} ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 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 za = new Complex128( 2.0, 2.0 ); + + zscal.ndarray(); // $ExpectError + zscal.ndarray( zx.length ); // $ExpectError + zscal.ndarray( zx.length, za ); // $ExpectError + zscal.ndarray( zx.length, za, x ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1 ); // $ExpectError + zscal.ndarray( zx.length, za, zx, 1, 0, 10 ); // $ExpectError +} + +// Attached to the main export is a `Module` constructor which returns a module... +{ + const mem = new Memory({ + 'initial': 0 + }); + + zscal.Module( mem ); // $ExpectType Module +} + +// The compiler throws an error if the `Module` constructor is not provided a WebAssembly memory instance... +{ + zscal.Module( '10' ); // $ExpectError + zscal.Module( true ); // $ExpectError + zscal.Module( false ); // $ExpectError + zscal.Module( null ); // $ExpectError + zscal.Module( undefined ); // $ExpectError + zscal.Module( [] ); // $ExpectError + zscal.Module( {} ); // $ExpectError + zscal.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 = zscal.Module( mem ); + + mod.main( 10, 80, 0, 1 ); // $ExpectType number +} + +// The compiler throws an error if the `main` method of a module instance is provided a first argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.main( '10', 80, 10, 1 ); // $ExpectError + mod.main( true, 80, 10, 1 ); // $ExpectError + mod.main( false, 80, 10, 1 ); // $ExpectError + mod.main( null, 80, 10, 1 ); // $ExpectError + mod.main( undefined, 80, 10, 1 ); // $ExpectError + mod.main( [], 80, 10, 1 ); // $ExpectError + mod.main( {}, 80, 10, 1 ); // $ExpectError + mod.main( ( x: number ): number => x, 80, 10, 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 = zscal.Module( mem ); + + mod.main( 10, '10', 0, 1 ); // $ExpectError + mod.main( 10, true, 0, 1 ); // $ExpectError + mod.main( 10, false, 0, 1 ); // $ExpectError + mod.main( 10, null, 0, 1 ); // $ExpectError + mod.main( 10, undefined, 0, 1 ); // $ExpectError + mod.main( 10, [], 0, 1 ); // $ExpectError + mod.main( 10, {}, 0, 1 ); // $ExpectError + mod.main( 10, ( x: number ): number => x, 0, 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 = zscal.Module( mem ); + + mod.main( 10, 80, '10', 1 ); // $ExpectError + mod.main( 10, 80, true, 1 ); // $ExpectError + mod.main( 10, 80, false, 1 ); // $ExpectError + mod.main( 10, 80, null, 1 ); // $ExpectError + mod.main( 10, 80, undefined, 1 ); // $ExpectError + mod.main( 10, 80, [], 1 ); // $ExpectError + mod.main( 10, 80, {}, 1 ); // $ExpectError + mod.main( 10, 80, ( x: number ): number => x, 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 = zscal.Module( mem ); + + mod.main( 10, 80, 0, '10' ); // $ExpectError + mod.main( 10, 80, 0, true ); // $ExpectError + mod.main( 10, 80, 0, false ); // $ExpectError + mod.main( 10, 80, 0, null ); // $ExpectError + mod.main( 10, 80, 0, undefined ); // $ExpectError + mod.main( 10, 80, 0, [] ); // $ExpectError + mod.main( 10, 80, 0, {} ); // $ExpectError + mod.main( 10, 80, 0, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `main` method of a module instance is provided an unsupported number of arguments... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.main(); // $ExpectError + mod.main( 10 ); // $ExpectError + mod.main( 10, 80 ); // $ExpectError + mod.main( 10, 80, 0 ); // $ExpectError + mod.main( 10, 80, 0, 1, 10 ); // $ExpectError +} + +// The `Module` constructor returns a module instance having an `ndarray` method which returns a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.ndarray( 10, 80, 0, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a first argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.ndarray( '10', 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( true, 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( false, 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( null, 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( undefined, 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( [], 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( {}, 80, 0, 1, 0 ); // $ExpectError + mod.ndarray( ( x: number ): number => x, 80, 0, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided a second argument which is not a number... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.ndarray( 10, '10', 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, true, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, false, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, null, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, undefined, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, [], 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, {}, 0, 1, 0 ); // $ExpectError + mod.ndarray( 10, ( x: number ): number => x, 0, 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 = zscal.Module( mem ); + + mod.ndarray( 10, 80, '10', 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, true, 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, false, 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, null, 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, undefined, 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, [], 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, {}, 1, 0 ); // $ExpectError + mod.ndarray( 10, 80, ( x: number ): number => x, 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 = zscal.Module( mem ); + + mod.ndarray( 10, 80, 0, '10', 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, true, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, false, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, null, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, undefined, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, [], 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, {}, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, ( x: number ): number => x, 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 = zscal.Module( mem ); + + mod.ndarray( 10, 80, 0, 1, '10' ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, true ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, false ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, null ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, undefined ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, [] ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, {} ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method of a module instance is provided an unsupported number of arguments... +{ + const mem = new Memory({ + 'initial': 1 + }); + const mod = zscal.Module( mem ); + + mod.ndarray(); // $ExpectError + mod.ndarray( 10 ); // $ExpectError + mod.ndarray( 10, 80 ); // $ExpectError + mod.ndarray( 10, 80, 0 ); // $ExpectError + mod.ndarray( 10, 80, 0, 1 ); // $ExpectError + mod.ndarray( 10, 80, 0, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js new file mode 100644 index 000000000000..c74c72a9fe39 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js @@ -0,0 +1,51 @@ +/** +* @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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zscal = require( './../lib' ); + +function main() { + if ( !hasWebAssemblySupport() ) { + console.error( 'Environment does not support WebAssembly.' ); + return; + } + // Specify a vector length: + var N = 5; + + // Create an input array: + var xbuf = oneTo( N*2, 'float64' ); + var x = new Complex128Array( xbuf.buffer ); + + // Create a complex number: + var z = new Complex128( 2.0, 2.0 ); + + // Perform computation: + zscal.ndarray( N, z, x, 1, 0 ); + + // Print the results: + console.log( reinterpretComplex64( x, 0 ) ); + // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js new file mode 100644 index 000000000000..b05c8e26791a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +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 zscal = 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 zscal.Module( mem ); + // returns + + // Initialize the routine: + mod.initializeSync(); // eslint-disable-line node/no-sync + + // Specify a vector length: + var N = 5; + + // Define a pointer (i.e., byte offset) for storing the input vector: + var xptr = 0; + + // Define a pointer for storing a complex number: + var zptr = N * bytesPerElement( 'complex128' ); + + // Create typed array views over module memory: + var x = new Float64ArrayLE( mod.memory.buffer, xptr, N*2 ); + var z = new Float64ArrayLE( mod.memory.buffer, zptr, 2 ); + + // Write values to module memory: + gfillBy( N*2, x, 1, discreteUniform( -10.0, 10.0 ) ); + gfillBy( 2, z, 1, discreteUniform( -10.0, 10.0 ) ); + + // Perform computation: + mod.ndarray( N, zptr, xptr, 1, 0 ); + + // Print the result: + console.log( 'x[:] = [%s]', x.toString() ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js new file mode 100644 index 000000000000..6b379c1275cd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js @@ -0,0 +1,80 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var zscal = 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 zscal.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 a pointer (i.e., byte offset) for storing the input vector: + var xptr = 0; + + // Define a pointer for storing a complex number: + var zptr = 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 ); + + // Write complex number components to module memory: + mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); + + // Perform computation: + mod.ndarray( N, zptr, xptr, 1, 0 ); + + // Read out the results: + var view = zeros( N, dtype ); + mod.read( xptr, view ); + + console.log( reinterpretComplex64( view, 0 ) ); + // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.browser.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.browser.js new file mode 100644 index 000000000000..17731aea93e4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.browser.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); + + +// MAIN // + +var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAEf39/fwBgBX9/f39/AAIPAQNlbnYGbWVtb3J5AgAAAwQDAAECBzEDEV9fd2FzbV9jYWxsX2N0b3JzAAAHY196c2NhbAABD2NfenNjYWxfbmRhcnJheQACCoUEAwMAAQuFAgIEfAN+AkAgAEEATA0AIAErAwghBCABKwMAIQUgAkEBIABrIANsQQAgA0EATBtBBHRqIQEgAK0iCEIBgyEJIABBAUcEQCAIQv7///8HgyEKQgAhCCADQQR0IQIDQCABQQhqIAUgASsDCCIGoiABKwMAIgcgBKKgOQMAIAEgBSAHoiAEIAaioTkDACABIAJqIgBBCGogBSAAKwMIIgaiIAArAwAiByAEoqA5AwAgACAFIAeiIAQgBqKhOQMAIAAgAmohASAIQgJ8IgggClINAAsLIAlQDQAgAUEIaiAFIAErAwgiBqIgASsDACIHIASioDkDACABIAUgB6IgBCAGoqE5AwALC/cBAgR8A34CQCAAQQBMDQAgAK0iCUIBgyEKIAIgBEEEdGohBCABKwMIIQUgASsDACEGIABBAUcEQCAJQv7///8HgyELQgAhCSADQQR0IQEDQCAEQQhqIAYgBCsDCCIHoiAEKwMAIgggBaKgOQMAIAQgBiAIoiAFIAeioTkDACABIARqIgBBCGogBiAAKwMIIgeiIAArAwAiCCAFoqA5AwAgACAGIAiiIAUgB6KhOQMAIAAgAWohBCAJQgJ8IgkgC1INAAsLIApQDQAgBEEIaiAGIAQrAwgiB6IgBCsDACIIIAWioDkDACAEIAYgCKIgBSAHoqE5AwALCw==' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js new file mode 100644 index 000000000000..6f02393f96e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js @@ -0,0 +1,34 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var readWASM = require( '@stdlib/fs/read-wasm' ).sync; + + +// MAIN // + +var wasm = readWASM( resolve( __dirname, '..', 'src', 'main.wasm' ) ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js new file mode 100644 index 000000000000..0bfd03057db8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js @@ -0,0 +1,127 @@ +/** +* @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 scale a double-precision complex floating-point vector by a double-precision complex floating-point constant. +* +* @module @stdlib/blas/base/wasm/zscal +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var zscal = require( '@stdlib/blas/base/wasm/zscal' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.main( x.length, z, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var zscal = require( '@stdlib/blas/base/wasm/zscal' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.ndarray( x.length, z, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.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 Float64Array = require( '@stdlib/array/float64' ); +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +* var zscal = require( '@stdlib/blas/base/wasm/zscal' ); +* +* // 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 zscal.Module( mem ); +* // returns +* +* // Initialize the routine: +* mod.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Define a pointer for storing a complex number: +* var zptr = 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 ); +* +* // Write a complex number to module memory: +* mod.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); +* +* // Perform computation: +* mod.main( N, zptr, xptr, 1 ); +* +* // Read out the results: +* var view = zeros( N, dtype ); +* mod.read( xptr, view ); +* +* console.log( reinterpretComplex128( view, 0 ) ); +* // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var Module = require( './module.js' ); + + +// MAIN // + +setReadOnly( main, 'Module', Module ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "Module": "main.Module" } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js new file mode 100644 index 000000000000..5230b177aa9a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js @@ -0,0 +1,68 @@ +/** +* @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 scale a double-precision complex floating-point vector by a double-precision complex floating-point constant. +* +* @name zscal +* @type {Routine} +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.main( x.length, z, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Define a scalar constant: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.ndarray( x.length, z, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +*/ +var zscal = new Routine(); +zscal.initializeSync(); // eslint-disable-line node/no-sync + + +// EXPORTS // + +module.exports = zscal; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js new file mode 100644 index 000000000000..e3b62ac87d4b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js @@ -0,0 +1,274 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var isWebAssemblyMemory = require( '@stdlib/assert/is-wasm-memory' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherits = require( '@stdlib/utils/inherit' ); +var WasmModule = require( '@stdlib/wasm/module-wrapper' ); +var format = require( '@stdlib/string/format' ); +var wasmBinary = require( './binary.js' ); + + +// MAIN // + +/** +* BLAS routine WebAssembly module wrapper constructor. +* +* @constructor +* @param {Object} memory - WebAssembly memory instance +* @throws {TypeError} must provide a WebAssembly memory instance +* @returns {Module} module instance +* +* @example +* var Memory = require( '@stdlib/wasm/memory' ); +* var oneTo = require( '@stdlib/array/one-to' ); +* var ones = require( '@stdlib/array/ones' ); +* var zeros = require( '@stdlib/array/zeros' ); +* var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* 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 zscal = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zscal.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Define a pointer for storing a complex number: +* var zptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zscal.write( xptr, x ); +* +* // Write a complex number to module memory: +* zscal.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); +* +* // Perform computation: +* var ptr = zscal.main( N, zptr, xptr, 1 ); +* // returns +* +* var bool = ( ptr === xptr ); +* // returns true +* +* // Read out the results: +* var view = zeros( N, dtype ); +* zscal.read( xptr, view ); +* +* console.log( reinterpretComplex128( view, 0 ) ); +* // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.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 ); + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. +* +* @name main +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {NonNegativeInteger} aptr - scalar constant pointer (i.e., byte offset) +* @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) +* @param {integer} strideX - `x` stride length +* @returns {NonNegativeInteger} input array pointer (i.e., byte offset) +* +* @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 Float64Array = require( '@stdlib/array/float64' ); +* 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 zscal = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zscal.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Define a pointer for storing a complex number: +* var zptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zscal.write( xptr, x ); +* +* // Write a complex number to module memory: +* zscal.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); +* +* // Perform computation: +* var ptr = zscal.main( N, zptr, xptr, 1 ); +* // returns +* +* var bool = ( ptr === xptr ); +* // returns true +* +* // Read out the results: +* var view = zeros( N, dtype ); +* zscal.read( xptr, view ); +* +* console.log( reinterpretComplex128( view, 0 ) ); +* // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +*/ +setReadOnly( Module.prototype, 'main', function zscal( N, aptr, xptr, strideX ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + this._instance.exports.c_zscal( N, aptr, xptr, strideX ); + return xptr; +}); + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. +* +* @name ndarray +* @memberof Module.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {NonNegativeInteger} aptr - scalar constant pointer (i.e., byte offset) +* @param {NonNegativeInteger} xptr - input array pointer (i.e., byte offset) +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @returns {NonNegativeInteger} input array pointer (i.e., byte offset) +* +* @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 Float64Array = require( '@stdlib/array/float64' ); +* 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 zscal = new Module( mem ); +* // returns +* +* // Initialize the routine: +* zscal.initializeSync(); +* +* // Define a vector data type: +* var dtype = 'complex128'; +* +* // Specify a vector length: +* var N = 5; +* +* // Define a pointer (i.e., byte offset) for storing the input vector: +* var xptr = 0; +* +* // Define a pointer for storing a complex number: +* var zptr = N * bytesPerElement( dtype ); +* +* // Write vector values to module memory: +* var xbuf = oneTo( N*2, 'float64' ); +* var x = new Complex128Array( xbuf.buffer ); +* zscal.write( xptr, x ); +* +* // Write a complex number to module memory: +* zscal.write( zptr, new Float64Array( [ 2.0, 2.0 ] ) ); +* +* // Perform computation: +* var ptr = zscal.ndarray( N, zptr, xptr, 1, 0 ); +* // returns +* +* var bool = ( ptr === xptr ); +* // returns true +* +* // Read out the results: +* var view = zeros( N, dtype ); +* zscal.read( xptr, view ); +* +* console.log( reinterpretComplex128( view, 0 ) ); +* // => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0, -2.0, 38.0 ] +*/ +setReadOnly( Module.prototype, 'ndarray', function zscal( N, aptr, xptr, strideX, offsetX ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + this._instance.exports.c_zscal_ndarray( N, aptr, xptr, strideX, offsetX ); + return xptr; +}); + + +// EXPORTS // + +module.exports = Module; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js new file mode 100644 index 000000000000..f6d33bf02f7b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js @@ -0,0 +1,195 @@ +/** +* @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 reim = require( '@stdlib/complex/float64/reim' ); +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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Create a new routine: +* var zscal = new Routine(); +* +* // Initialize the module: +* zscal.initializeSync(); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Create a complex number: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.main( x.length, z, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Create a new routine: +* var zscal = new Routine(); +* +* // Initialize the module: +* zscal.initializeSync(); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Create a complex number: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.ndarray( x.length, z, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.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 ); + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. +* +* @name main +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128} alpha - scalar +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @returns {Complex128Array} input array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Create a new routine: +* var zscal = new Routine(); +* +* // Initialize the module: +* zscal.initializeSync(); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Create a complex number: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.main( x.length, z, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +*/ +setReadOnly( Routine.prototype, 'main', function zscal( N, alpha, x, strideX ) { + return this.ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) ); +}); + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. +* +* @name ndarray +* @memberof Routine.prototype +* @readonly +* @type {Function} +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128} alpha - scalar +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @returns {Complex128Array} input array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* // Create a new routine: +* var zscal = new Routine(); +* +* // Initialize the module: +* zscal.initializeSync(); +* +* // Define a strided array: +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* // Create a complex number: +* var z = new Complex128( 2.0, 2.0 ); +* +* // Perform operation: +* zscal.ndarray( x.length, z, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +*/ +setReadOnly( Routine.prototype, 'ndarray', function zscal( N, alpha, x, strideX, offsetX ) { + 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( 2, reim( alpha ), 1, 0 ) + ]); + p0 = ptrs[0]; + p1 = ptrs[1]; + + // Perform computation by calling the corresponding parent method: + Module.prototype.ndarray.call( this, N, p1.ptr, p0.ptr, p0.stride, p0.offset ); // eslint-disable-line max-len + + // If the input array data had to be copied to module memory, copy the results to the provided input array... + if ( p0.copy ) { + readDataView( N, this.view, p0.stride*p0.BYTES_PER_ELEMENT, p0.ptr, x, strideX, offsetX, true ); // eslint-disable-line max-len + } + return x; +}); + + +// EXPORTS // + +module.exports = Routine; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/manifest.json b/lib/node_modules/@stdlib/blas/base/wasm/zscal/manifest.json new file mode 100644 index 000000000000..d60b8ffd73e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/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/zscal" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/package.json b/lib/node_modules/@stdlib/blas/base/wasm/zscal/package.json new file mode 100644 index 000000000000..aa38678db0d8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/package.json @@ -0,0 +1,84 @@ +{ + "name": "@stdlib/blas/base/wasm/zscal", + "version": "0.0.0", + "description": "Scale a double-precision complex floating-point vector by a double-precision complex floating-point constant.", + "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", + "zscal", + "scale", + "vector", + "typed", + "array", + "ndarray", + "complex", + "complex128", + "float", + "float64", + "double", + "float64array", + "webassembly", + "wasm" + ], + "__stdlib__": { + "wasm": true + } +} diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/build.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/build.js new file mode 100644 index 000000000000..66bf9650b6d6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/build.js @@ -0,0 +1,66 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var readFile = require( '@stdlib/fs/read-file' ).sync; +var writeFile = require( '@stdlib/fs/write-file' ).sync; +var replace = require( '@stdlib/string/replace' ); +var currentYear = require( '@stdlib/time/current-year' ); + + +// VARIABLES // + +var wpath = resolve( __dirname, '..', 'src', 'main.wasm' ); +var tpath = resolve( __dirname, 'template.txt' ); +var opath = resolve( __dirname, '..', 'lib', 'binary.browser.js' ); + +var opts = { + 'encoding': 'utf8' +}; + +var PLACEHOLDER = '{{WASM_BASE64}}'; +var YEAR = '{{YEAR}}'; + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var wasm; + var tmpl; + + wasm = readFile( wpath ); + tmpl = readFile( tpath, opts ); + + tmpl = replace( tmpl, YEAR, currentYear().toString() ); + tmpl = replace( tmpl, PLACEHOLDER, wasm.toString( 'base64' ) ); + + writeFile( opath, tmpl, opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/template.txt b/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/template.txt new file mode 100644 index 000000000000..f66cdb9735b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/scripts/template.txt @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) {{YEAR}} The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); + + +// MAIN // + +var wasm = base64ToUint8Array( '{{WASM_BASE64}}' ); + + +// EXPORTS // + +module.exports = wasm; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile new file mode 100644 index 000000000000..87bc9420e487 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/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/wasm/zscal/src/exports.json b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/exports.json new file mode 100644 index 000000000000..5ebda4bd5cce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/exports.json @@ -0,0 +1,4 @@ +[ + "_c_zscal", + "_c_zscal_ndarray" +] diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wasm b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wasm new file mode 100755 index 0000000000000000000000000000000000000000..be1a6968b66b9c9561ba4c981533030df0cba1b9 GIT binary patch literal 640 zcmb8su};G<5C-70eMy{HRfQN?E?JQfjBHI776!x%q*2>}G;O7{0u@zssQMm|o#$ht zoShV;Ze(%n_`mb#K(U+&;HR(0>*{Gfy}A}?=i*!q0fxBc2Zo*(;JMZE+FM)~WK7eMs8w|qV>>bh8ijP|HFYW7m%M!m@a zK??UhAaSX5jCO$7Bbf?EPJGxo($m@ZSWSBp6uoZwf6uB-6qp3;$1JV}1a!e{muJ literal 0 HcmV?d00001 diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wat b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wat new file mode 100644 index 000000000000..2c6f0215e00f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/main.wat @@ -0,0 +1,299 @@ +;; @license Apache-2.0 +;; +;; Copyright (c) 2025 The Stdlib Authors. +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. + +(module + (type (;0;) (func)) + (type (;1;) (func (param i32 i32 i32 i32))) + (type (;2;) (func (param i32 i32 i32 i32 i32))) + (import "env" "memory" (memory (;0;) 0)) + (func (;0;) (type 0) + nop) + (func (;1;) (type 1) (param i32 i32 i32 i32) + (local f64 f64 f64 f64 i64 i64 i64) + block ;; label = @1 + local.get 0 + i32.const 0 + i32.le_s + br_if 0 (;@1;) + local.get 1 + f64.load offset=8 + local.set 4 + local.get 1 + f64.load + local.set 5 + local.get 2 + i32.const 1 + local.get 0 + i32.sub + local.get 3 + i32.mul + i32.const 0 + local.get 3 + i32.const 0 + i32.le_s + select + i32.const 4 + i32.shl + i32.add + local.set 1 + local.get 0 + i64.extend_i32_u + local.tee 8 + i64.const 1 + i64.and + local.set 9 + local.get 0 + i32.const 1 + i32.ne + if ;; label = @2 + local.get 8 + i64.const 2147483646 + i64.and + local.set 10 + i64.const 0 + local.set 8 + local.get 3 + i32.const 4 + i32.shl + local.set 2 + loop ;; label = @3 + local.get 1 + i32.const 8 + i32.add + local.get 5 + local.get 1 + f64.load offset=8 + local.tee 6 + f64.mul + local.get 1 + f64.load + local.tee 7 + local.get 4 + f64.mul + f64.add + f64.store + local.get 1 + local.get 5 + local.get 7 + f64.mul + local.get 4 + local.get 6 + f64.mul + f64.sub + f64.store + local.get 1 + local.get 2 + i32.add + local.tee 0 + i32.const 8 + i32.add + local.get 5 + local.get 0 + f64.load offset=8 + local.tee 6 + f64.mul + local.get 0 + f64.load + local.tee 7 + local.get 4 + f64.mul + f64.add + f64.store + local.get 0 + local.get 5 + local.get 7 + f64.mul + local.get 4 + local.get 6 + f64.mul + f64.sub + f64.store + local.get 0 + local.get 2 + i32.add + local.set 1 + local.get 8 + i64.const 2 + i64.add + local.tee 8 + local.get 10 + i64.ne + br_if 0 (;@3;) + end + end + local.get 9 + i64.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 8 + i32.add + local.get 5 + local.get 1 + f64.load offset=8 + local.tee 6 + f64.mul + local.get 1 + f64.load + local.tee 7 + local.get 4 + f64.mul + f64.add + f64.store + local.get 1 + local.get 5 + local.get 7 + f64.mul + local.get 4 + local.get 6 + f64.mul + f64.sub + f64.store + end) + (func (;2;) (type 2) (param i32 i32 i32 i32 i32) + (local f64 f64 f64 f64 i64 i64 i64) + block ;; label = @1 + local.get 0 + i32.const 0 + i32.le_s + br_if 0 (;@1;) + local.get 0 + i64.extend_i32_u + local.tee 9 + i64.const 1 + i64.and + local.set 10 + local.get 2 + local.get 4 + i32.const 4 + i32.shl + i32.add + local.set 4 + local.get 1 + f64.load offset=8 + local.set 5 + local.get 1 + f64.load + local.set 6 + local.get 0 + i32.const 1 + i32.ne + if ;; label = @2 + local.get 9 + i64.const 2147483646 + i64.and + local.set 11 + i64.const 0 + local.set 9 + local.get 3 + i32.const 4 + i32.shl + local.set 1 + loop ;; label = @3 + local.get 4 + i32.const 8 + i32.add + local.get 6 + local.get 4 + f64.load offset=8 + local.tee 7 + f64.mul + local.get 4 + f64.load + local.tee 8 + local.get 5 + f64.mul + f64.add + f64.store + local.get 4 + local.get 6 + local.get 8 + f64.mul + local.get 5 + local.get 7 + f64.mul + f64.sub + f64.store + local.get 1 + local.get 4 + i32.add + local.tee 0 + i32.const 8 + i32.add + local.get 6 + local.get 0 + f64.load offset=8 + local.tee 7 + f64.mul + local.get 0 + f64.load + local.tee 8 + local.get 5 + f64.mul + f64.add + f64.store + local.get 0 + local.get 6 + local.get 8 + f64.mul + local.get 5 + local.get 7 + f64.mul + f64.sub + f64.store + local.get 0 + local.get 1 + i32.add + local.set 4 + local.get 9 + i64.const 2 + i64.add + local.tee 9 + local.get 11 + i64.ne + br_if 0 (;@3;) + end + end + local.get 10 + i64.eqz + br_if 0 (;@1;) + local.get 4 + i32.const 8 + i32.add + local.get 6 + local.get 4 + f64.load offset=8 + local.tee 7 + f64.mul + local.get 4 + f64.load + local.tee 8 + local.get 5 + f64.mul + f64.add + f64.store + local.get 4 + local.get 6 + local.get 8 + f64.mul + local.get 5 + local.get 7 + f64.mul + f64.sub + f64.store + end) + (export "__wasm_call_ctors" (func 0)) + (export "c_zscal" (func 1)) + (export "c_zscal_ndarray" (func 2))) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js new file mode 100644 index 000000000000..b3afa1be6b2e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var zscal = require( './../lib' ); + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zscal, 'object', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is a `main` method', function test( t ) { + t.strictEqual( typeof zscal.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is an `ndarray` method', function test( t ) { + t.strictEqual( typeof zscal.ndarray, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is a `Module` constructor', function test( t ) { + t.strictEqual( typeof zscal.Module, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the main export is a `Module` instance', function test( t ) { + t.strictEqual( zscal instanceof zscal.Module, true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js new file mode 100644 index 000000000000..9e1d698ef28e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js @@ -0,0 +1,276 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var zscal = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zscal, 'object', 'main export is an object' ); + t.end(); +}); + +tape( 'the `main` method has an arity of 4', function test( t ) { + t.strictEqual( zscal.main.length, 4, 'arity of 4' ); + t.end(); +}); + +tape( 'the `main` method scales elements from `zx` by `za`', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.3, // 1 + 0.1, // 1 + 0.5, // 2 + 0.0, // 2 + 0.0, // 3 + 0.5, // 3 + 0.0, // 4 + 0.2 // 4 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.main( 4, za, zx, 1 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.19, // 1 + -0.17, // 1 + 0.2, // 2 + -0.35, // 2 + 0.35, // 3 + 0.2, // 3 + 0.14, // 4 + 0.08 // 4 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `main` method supports specifying a `zx` stride', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 1 + 0.1, // 1 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 3 + -0.3, // 3 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.main( 3, za, zx, 2 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 1 + -0.03, // 1 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 3 + -0.19, // 3 + 7.0, + 2.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `main` method supports specifying a negative `zx` stride', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.main( 3, za, zx, -2 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `main` method returns a reference to the input array', function test( t ) { + var out; + var za; + var zx; + + zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + za = new Complex128( 2.0, 2.0 ); + + out = zscal.main( 4, za, zx, 1 ); + + t.strictEqual( out, zx, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns the input array unchanged', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + za = new Complex128( 2.0, 2.0 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + zscal.main( -1, za, zx, 1 ); + t.deepEqual( viewX, expected, 'returns expected value' ); + + zscal.main( 0, za, zx, 1 ); + t.deepEqual( viewX, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the `main` method supports view offsets', function test( t ) { + var expected; + var viewX; + var zx0; + var zx1; + var za; + + // Initial arrays... + zx0 = new Complex128Array([ + 0.1, + -0.3, + 8.0, // 1 + 9.0, // 1 + 0.5, // 2 + -0.1, // 2 + 2.0, // 3 + 5.0, // 3 + 2.0, + 3.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + // Create offset views... + zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + + zscal.main( 3, za, zx1, 1 ); + + viewX = new Float64Array( zx0.buffer ); + expected = new Float64Array([ + 0.1, + -0.3, + 9.5, // 1 + -2.0, // 1 + 0.13, // 2 + -0.39, // 2 + 4.3, // 3 + 0.6, // 3 + 2.0, + 3.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js new file mode 100644 index 000000000000..9adcb07e22fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Memory = require( '@stdlib/wasm/memory' ); +var ModuleWrapper = require( '@stdlib/wasm/module-wrapper' ); +var Module = require( './../lib' ).Module; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor which does not require `new`', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = Module( mem ); // eslint-disable-line new-cap + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module constructor throws an error if provided a first argument which is not a WebAssembly memory instance (new)', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return new Module( value ); + }; + } +}); + +tape( 'the module constructor throws an error if provided a first argument which is not a WebAssembly memory instance (no new)', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return Module( value ); // eslint-disable-line new-cap + }; + } +}); + +tape( 'the module instance returned by the module constructor inherits from a module wrapper', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( mod instanceof ModuleWrapper, true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is a `main` method', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( typeof mod.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is an `ndarray` method', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + + t.strictEqual( typeof mod.ndarray, 'function', 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js new file mode 100644 index 000000000000..d1850db682d5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js @@ -0,0 +1,295 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable node/no-sync */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Memory = require( '@stdlib/wasm/memory' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Module = require( './../lib' ).Module; + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'a module instance has a `main` method which has an arity of 4', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod.main.length, 4, 'returns expected value' ); + t.end(); +}); + +tape( 'a module instance has a `main` method which scales elements from `zx` by `za`', function test( t ) { + var actualX; + var viewX; + var zap; + var zxe; + var zxp; + var mem; + var mod; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); + + mod.main( 3, zap, zxp, 1 ); + + actualX = new Complex128Array( 3 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has a `main` method which supports specifying a `zx` stride', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, // 1 + 0.1, // 1 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 3 + -0.3, // 3 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.11, // 1 + -0.03, // 1 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 3 + -0.19, // 3 + 7.0, + 2.0 + ]); + + mod.main( 3, zap, zxp, 2 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has a `main` method which supports specifying a negative `zx` stride', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + mod.main( 3, zap, zxp, -2 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has a `main` method which returns a reference to the input array', function test( t ) { + var zap; + var zxp; + var mem; + var mod; + var out; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + out = mod.main( 3, zap, zxp, 1 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has a `main` method which leaves the input array unchanged', function test( t ) { + var zap; + var zxp; + var mem; + var mod; + var out; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + out = mod.main( 0, zap, zxp, 1 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + out = mod.main( -1, zap, zxp, 1 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js new file mode 100644 index 000000000000..686612f68286 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js @@ -0,0 +1,423 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable node/no-sync */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Memory = require( '@stdlib/wasm/memory' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Module = require( './../lib' ).Module; + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Module, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which has an arity of 5', function test( t ) { + var mem; + var mod; + + mem = new Memory({ + 'initial': 0 + }); + mod = new Module( mem ); + t.strictEqual( mod.ndarray.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which scales elements from `zx` by `za`', function test( t ) { + var actualX; + var viewX; + var zap; + var zxe; + var zxp; + var mem; + var mod; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); + + mod.ndarray( 3, zap, zxp, 1, 0 ); + + actualX = new Complex128Array( 3 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports a `zx` stride', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, // 1 + 0.1, // 1 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 3 + -0.3, // 3 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.11, // 1 + -0.03, // 1 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 3 + -0.19, // 3 + 7.0, + 2.0 + ]); + + mod.ndarray( 3, zap, zxp, 2, 0 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports a negative `zx` stride', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + mod.ndarray( 3, zap, zxp, -2, 4 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports a `zx` offset', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, // 1 + 0.1, // 1 + 4.0, + 7.0, + 0.1, // 2 + -0.3, // 2 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.17, // 1 + 0.46, // 1 + 4.0, + 7.0, + -0.17, // 2 + -0.19, // 2 + 7.0, + 2.0 + ]); + + mod.ndarray( 2, zap, zxp, 2, 2 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which returns a reference to the input array', function test( t ) { + var zap; + var zxp; + var mem; + var mod; + var out; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + out = mod.ndarray( 3, zap, zxp, 1, 0 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has an `ndarray` method which leaves the input array unchanged', function test( t ) { + var zap; + var zxp; + var mem; + var mod; + var out; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 24; + + mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + out = mod.ndarray( 0, zap, zxp, 1, 0 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + out = mod.ndarray( -1, zap, zxp, 1, 0 ); + t.strictEqual( out, zxp, 'returns expected value' ); + + t.end(); +}); + +tape( 'a module instance has an `ndarray` method which supports complex access patterns', function test( t ) { + var actualX; + var viewX; + var xbuf; + var zap; + var zxe; + var zxp; + var mem; + var mod; + var zx; + + mem = new Memory({ + 'initial': 1 + }); + mod = new Module( mem ); + mod.initializeSync(); + + zxp = 0; + zap = 48; + + xbuf = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + zx = new Complex128Array( xbuf.buffer ); + + mod.write( zxp, zx ); + mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + + zxe = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + mod.ndarray( 2, zap, zxp, -2, 4 ); + + actualX = new Complex128Array( 6 ); + mod.read( zxp, actualX ); + viewX = new Float64Array( actualX.buffer ); + isApprox( t, viewX, zxe, 1.0 ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js new file mode 100644 index 000000000000..169cf4dee00a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js @@ -0,0 +1,331 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var zscal = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zscal, 'object', 'main export is an object' ); + t.end(); +}); + +tape( 'the `ndarray` method has an arity of 5', function test( t ) { + t.strictEqual( zscal.ndarray.length, 5, 'arity of 5' ); + t.end(); +}); + +tape( 'the `ndarray` method scales elements from `zx` by `za`', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.3, // 1 + 0.1, // 1 + 0.5, // 2 + 0.0, // 2 + 0.0, // 3 + 0.5, // 3 + 0.0, // 4 + 0.2, // 4 + 2.0, + 3.0, + 2.0, + 3.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.ndarray( 4, za, zx, 1, 0 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.19, // 1 + -0.17, // 1 + 0.2, // 2 + -0.35, // 2 + 0.35, // 3 + 0.2, // 3 + 0.14, // 4 + 0.08, // 4 + 2.0, + 3.0, + 2.0, + 3.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `ndarray` method supports specifying a `zx` stride', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 1 + 0.1, // 1 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 3 + -0.3, // 3 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.ndarray( 3, za, zx, 2, 0 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 1 + -0.03, // 1 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 3 + -0.19, // 3 + 7.0, + 2.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `ndarray` method supports specifying a negative `zx` stride', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.ndarray( 3, za, zx, -2, 4 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + isApprox( t, viewX, expected, 1.0 ); + + t.end(); +}); + +tape( 'the `ndarray` method supports a `zx` offset', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, + 0.1, + 4.0, // 1 + 6.0, // 1 + 0.1, // 2 + -0.3, // 2 + 7.0, // 3 + 2.0 // 3 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.ndarray( 3, za, zx, 1, 3 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, + 0.1, + 5.8, // 1 + -0.4, // 1 + -0.17, // 2 + -0.19, // 2 + 4.2, // 3 + -4.1 // 3 + ]); + isApprox( t, viewX, expected, 5.0 ); + + t.end(); +}); + +tape( 'the `ndarray` method returns a reference to the input array', function test( t ) { + var out; + var za; + var zx; + + zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + za = new Complex128( 2.0, 2.0 ); + + out = zscal.ndarray( 4, za, zx, 1, 0 ); + + t.strictEqual( out, zx, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` method returns the input array unchanged', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + za = new Complex128( 2.0, 2.0 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + zscal.ndarray( -1, za, zx, 1, 0 ); + t.deepEqual( viewX, expected, 'returns expected value' ); + + zscal.ndarray( 0, za, zx, 1, 0 ); + t.deepEqual( viewX, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the `ndarray` method supports complex access patterns', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, + 0.1, + 4.0, // 1 + 6.0, // 1 + 0.1, + -0.3, + 7.0, + 2.0, + 2.0, // 2 + 3.0 // 2 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal.ndarray( 2, za, zx, 3, 3 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.1, + 0.1, + 3.0, + 6.0, + -0.6, + 0.1, + 5.8, // 1 + -0.4, // 1 + 0.1, + -0.3, + 7.0, + 2.0, + 2.9, // 2 + -0.2 // 2 + ]); + isApprox( t, viewX, expected, 5.0 ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js new file mode 100644 index 000000000000..56a4b67daaf0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var ModuleWrapper = require( '@stdlib/wasm/module-wrapper' ); +var Module = require( './../lib/module.js' ); +var Routine = require( './../lib/routine.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Routine, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof Routine, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function is a constructor which does not require `new`', function test( t ) { + var mod = Routine(); // eslint-disable-line new-cap + t.strictEqual( mod instanceof Routine, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module instance returned by the constructor inherits from a module wrapper', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof ModuleWrapper, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the module instance returned by the constructor inherits from a BLAS routine module', function test( t ) { + var mod = new Routine(); + t.strictEqual( mod instanceof Module, true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is a `main` method', function test( t ) { + var mod = new Routine(); + t.strictEqual( typeof mod.main, 'function', 'returns expected value' ); + t.end(); +}); + +tape( 'attached to a module instance is an `ndarray` method', function test( t ) { + var mod = new Routine(); + t.strictEqual( typeof mod.ndarray, 'function', 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/complex/float64/base/mul/manifest.json b/lib/node_modules/@stdlib/complex/float64/base/mul/manifest.json index 48efffba21db..8f4352d27050 100644 --- a/lib/node_modules/@stdlib/complex/float64/base/mul/manifest.json +++ b/lib/node_modules/@stdlib/complex/float64/base/mul/manifest.json @@ -1,6 +1,7 @@ { "options": { - "task": "build" + "task": "build", + "wasm": false }, "fields": [ { @@ -27,6 +28,7 @@ "confs": [ { "task": "build", + "wasm": false, "src": [ "./src/main.c" ], @@ -43,6 +45,7 @@ }, { "task": "benchmark", + "wasm": false, "src": [ "./src/main.c" ], @@ -58,6 +61,23 @@ }, { "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/complex/float64/ctor", + "@stdlib/complex/float64/reim" + ] + }, + { + "task": "build", + "wasm": true, "src": [ "./src/main.c" ], From 68586da3d54052f9d33c47edd44f162eb88b581d Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 25 Apr 2025 15:04:26 +0530 Subject: [PATCH 2/4] chore: update test cases --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/zscal/test/test.main.js | 4 ++-- .../blas/base/wasm/zscal/test/test.module.main.js | 14 +++++++------- .../base/wasm/zscal/test/test.module.ndarray.js | 14 +++++++------- .../blas/base/wasm/zscal/test/test.ndarray.js | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js index 9e1d698ef28e..d3ca7df030bd 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js @@ -146,7 +146,7 @@ tape( 'the `main` method supports specifying a `zx` stride', function test( t ) 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, 3.0 ); t.end(); }); @@ -190,7 +190,7 @@ tape( 'the `main` method supports specifying a negative `zx` stride', function t 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, 3.0 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js index d1850db682d5..55b202c48afc 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js @@ -96,7 +96,7 @@ tape( 'a module instance has a `main` method which scales elements from `zx` by mod.initializeSync(); zxp = 0; - zap = 24; + zap = 48; mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); @@ -131,7 +131,7 @@ tape( 'a module instance has a `main` method which supports specifying a `zx` st mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, // 1 @@ -172,7 +172,7 @@ tape( 'a module instance has a `main` method which supports specifying a `zx` st actualX = new Complex128Array( 6 ); mod.read( zxp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, zxe, 3.0 ); t.end(); }); @@ -195,7 +195,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, // 3 @@ -236,7 +236,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ actualX = new Complex128Array( 6 ); mod.read( zxp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, zxe, 3.0 ); t.end(); }); @@ -255,7 +255,7 @@ tape( 'a module instance has a `main` method which returns a reference to the in mod.initializeSync(); zxp = 0; - zap = 24; + zap = 48; mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); @@ -280,7 +280,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance mod.initializeSync(); zxp = 0; - zap = 24; + zap = 48; mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js index 686612f68286..deafe42616f8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js @@ -96,7 +96,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `zx` mod.initializeSync(); zxp = 0; - zap = 24; + zap = 48; mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); @@ -131,7 +131,7 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` stride', mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, // 1 @@ -172,7 +172,7 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` stride', actualX = new Complex128Array( 6 ); mod.read( zxp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, zxe, 3.0 ); t.end(); }); @@ -195,7 +195,7 @@ tape( 'a module instance has an `ndarray` method which supports a negative `zx` mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, // 3 @@ -236,7 +236,7 @@ tape( 'a module instance has an `ndarray` method which supports a negative `zx` actualX = new Complex128Array( 6 ); mod.read( zxp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, zxe, 3.0 ); t.end(); }); @@ -259,7 +259,7 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` offset', mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, @@ -376,7 +376,7 @@ tape( 'a module instance has an `ndarray` method which supports complex access p mod.initializeSync(); zxp = 0; - zap = 48; + zap = 96; xbuf = new Float64Array([ 0.1, diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js index 169cf4dee00a..5591b45823ce 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js @@ -154,7 +154,7 @@ tape( 'the `ndarray` method supports specifying a `zx` stride', function test( t 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, 3.0 ); t.end(); }); @@ -198,7 +198,7 @@ tape( 'the `ndarray` method supports specifying a negative `zx` stride', functio 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, 3.0 ); t.end(); }); @@ -242,7 +242,7 @@ tape( 'the `ndarray` method supports a `zx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - isApprox( t, viewX, expected, 5.0 ); + isApprox( t, viewX, expected, 7.0 ); t.end(); }); @@ -325,7 +325,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.9, // 2 -0.2 // 2 ]); - isApprox( t, viewX, expected, 5.0 ); + isApprox( t, viewX, expected, 7.0 ); t.end(); }); From 5400b42e7af0e64505072b12b53fe7c95e7f24e2 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 25 Apr 2025 09:36:17 +0000 Subject: [PATCH 3/4] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md | 2 +- .../@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js | 2 +- .../blas/base/wasm/zscal/benchmark/benchmark.module.main.js | 2 +- .../blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts | 2 +- .../@stdlib/blas/base/wasm/zscal/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js | 2 +- .../blas/base/wasm/zscal/examples/little_endian_arrays.js | 2 +- .../@stdlib/blas/base/wasm/zscal/examples/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js | 2 +- lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js | 2 +- .../@stdlib/blas/base/wasm/zscal/test/test.module.js | 2 +- .../@stdlib/blas/base/wasm/zscal/test/test.module.main.js | 2 +- .../@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/zscal/test/test.ndarray.js | 2 +- .../@stdlib/blas/base/wasm/zscal/test/test.routine.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md index d54c05bb4980..b935c21fa980 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 The Stdlib Authors. +Copyright (c) 2025 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js index f25eb1a4abd2..1946ffd452ea 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js index 808c6880f675..02c1140b1b06 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js index 8957df205d18..81b221e6641d 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js index 2462f710733e..9ef106b26b4f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js index 2337f20fdc24..163020a27150 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts index 5a44bcdae651..9ae49cdbd7cc 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts index 22bf8a3f7c07..4165b83077f7 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js index c74c72a9fe39..ee6ac329b9e2 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js index b05c8e26791a..34153d6978d2 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js index 6b379c1275cd..57435f0c5a3d 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js index 6f02393f96e5..2b83fe651780 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/binary.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js index 0bfd03057db8..8854a7ef3355 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js index 5230b177aa9a..704f95c19417 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js index e3b62ac87d4b..8a739be8fd20 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js index f6d33bf02f7b..817ac7b17415 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile index 87bc9420e487..c6976e9d0f03 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js index b3afa1be6b2e..7e9bd209d21c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js index d3ca7df030bd..b48aebf3bf7e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js index 9adcb07e22fa..0cdcd97ef151 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js index 55b202c48afc..7108c7318021 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js index deafe42616f8..6991032ae0fe 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js index 5591b45823ce..884d2e96d68b 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js index 56a4b67daaf0..d90a5804a8e1 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/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 148041c6a4019815a8162c65e533b21dde1a4ee4 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 25 Apr 2025 19:18:41 +0530 Subject: [PATCH 4/4] chore: update variable names --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/wasm/zscal/README.md | 74 +++--- .../base/wasm/zscal/benchmark/benchmark.js | 6 +- .../wasm/zscal/benchmark/benchmark.ndarray.js | 6 +- .../blas/base/wasm/zscal/docs/repl.txt | 64 ++--- .../base/wasm/zscal/docs/types/index.d.ts | 16 +- .../blas/base/wasm/zscal/docs/types/test.ts | 236 +++++++++--------- .../blas/base/wasm/zscal/examples/index.js | 4 +- .../zscal/examples/little_endian_arrays.js | 4 +- .../@stdlib/blas/base/wasm/zscal/lib/index.js | 8 +- .../@stdlib/blas/base/wasm/zscal/lib/main.js | 8 +- .../blas/base/wasm/zscal/lib/routine.js | 16 +- .../blas/base/wasm/zscal/test/test.main.js | 84 +++---- .../base/wasm/zscal/test/test.module.main.js | 116 ++++----- .../wasm/zscal/test/test.module.ndarray.js | 170 ++++++------- .../blas/base/wasm/zscal/test/test.ndarray.js | 94 +++---- 15 files changed, 453 insertions(+), 453 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md index b935c21fa980..bd9b3942db1c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/README.md @@ -30,47 +30,47 @@ limitations under the License. var zscal = require( '@stdlib/blas/base/wasm/zscal' ); ``` -#### zscal.main( N, za, zx, strideX ) +#### zscal.main( N, alpha, x, strideX ) -Scales values from `zx` by `za`. +Scales values from `x` by `alpha`. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); // Define a strided array: -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // Define a scalar constant: -var za = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Perform operation: -zscal.main( zx.length, za, zx, 1 ); -// zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +zscal.main( x.length, alpha, x, 1 ); +// x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] ``` The function has the following parameters: - **N**: number of indexed elements. -- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. -- **zx**: input [`Complex128Array`][@stdlib/array/complex128]. -- **strideX**: index increment for `zx`. +- **alpha**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. +- **x**: input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `x`. -The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to scale every other value in `zx` by `za`, +The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to scale every other value in `x` by `alpha`, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); // Define a strided array: -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // Define a scalar constant: -var za = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Perform operation: -zscal.main( 2, za, zx, 2 ); -// zx => [ -2.0, 6.0, 3.0, 4.0, -2.0, 22.0 ] +zscal.main( 2, alpha, x, 2 ); +// x => [ -2.0, 6.0, 3.0, 4.0, -2.0, 22.0 ] ``` Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. @@ -82,41 +82,41 @@ var Complex128Array = require( '@stdlib/array/complex128' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); // Initial array: -var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); // Define a scalar constant: -var za = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Create an offset view: -var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -// Scales every other value from `zx1` by `za`... -zscal.main( 3, za, zx1, 1 ); -// zx0 => [ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ] +// Scales every other value from `x1` by `alpha`... +zscal.main( 3, alpha, x1, 1 ); +// x0 => [ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ] ``` -#### zscal.ndarray( N, za, zx, strideX, offsetX ) +#### zscal.ndarray( N, alpha, x, strideX, offsetX ) -Scales values from `zx` by `za` using alternative indexing semantics. +Scales values from `x` by `alpha` using alternative indexing semantics. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); // Define a strided array: -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // Define a scalar constant: -var za = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Perform operation: -zscal.ndarray( zx.length, za, zx, 1, 0 ); -// zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +zscal.ndarray( x.length, alpha, x, 1, 0 ); +// x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] ``` The function has the following additional parameters: -- **offsetX**: starting index for `zx`. +- **offsetX**: starting index for `x`. While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to scale every other value in the input strided array starting from the second element, @@ -124,11 +124,11 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the var Complex128Array = require( '@stdlib/array/complex128' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -var za = new Complex128( 2.0, 2.0 ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var alpha = new Complex128( 2.0, 2.0 ); -zscal.ndarray( 2, za, zx, 2, 1 ); -// zx => [ 1.0, 2.0, -2.0, 14.0, 5.0, 6.0, -2.0, 30.0 ] +zscal.ndarray( 2, alpha, x, 2, 1 ); +// x => [ 1.0, 2.0, -2.0, 14.0, 5.0, 6.0, -2.0, 30.0 ] ``` * * * @@ -160,7 +160,7 @@ mod.initializeSync(); #### zscal.Module.prototype.main( N, zap, zxp, sx ) -Scales values from `zx` by `za` . +Scales values from `x` by `alpha` . @@ -224,11 +224,11 @@ The function has the following parameters: - **N**: number of indexed elements. - **zap**: pointer (i.e., byte offset) to a scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. - **zxp**: input [`Complex128Array`][@stdlib/array/complex128] pointer (i.e., byte offset). -- **sx**: index increment for `zx`. +- **sx**: index increment for `x`. #### zscal.Module.prototype.ndarray( N, zap, zxp, sx, ox ) -Scales values from `zx` by `za` using alternative indexing semantics. +Scales values from `x` by `alpha` using alternative indexing semantics. @@ -301,7 +301,7 @@ The function has the following additional parameters: ## Notes -- If `N <= 0`, `zx` is left unchanged. +- If `N <= 0`, `x` is left unchanged. - This package implements routines using WebAssembly. When provided arrays which are not allocated on a `zscal` 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/zscal`][@stdlib/blas/base/zscal]. 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/zscal`][@stdlib/blas/base/zscal]. 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. - `zscal()` corresponds to the [BLAS][blas] level 1 function [`zscal`][zscal]. @@ -333,10 +333,10 @@ var xbuf = oneTo( N*2, 'float64' ); var x = new Complex128Array( xbuf.buffer ); // Create a complex number: -var z = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Perform computation: -zscal.ndarray( N, z, x, 1, 0 ); +zscal.ndarray( N, alpha, x, 1, 0 ); // Print the results: console.log( reinterpretComplex64( x, 0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js index 1946ffd452ea..9449f9b240b3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.js @@ -51,14 +51,14 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { + var alpha; var xbuf; var x; - var z; xbuf = uniform( len*2, -100.0, 100.0, options ); x = new Complex128Array( xbuf.buffer ); - z = new Complex128( 1.0, 0.0 ); + alpha = new Complex128( 1.0, 0.0 ); return benchmark; @@ -73,7 +73,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - zscal.main( x.length, z, x, 1 ); + zscal.main( x.length, alpha, x, 1 ); if ( isnan( xbuf[ i%(len*2) ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js index 163020a27150..e8be3583d39a 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.ndarray.js @@ -51,14 +51,14 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { + var alpha; var xbuf; var x; - var z; xbuf = uniform( len*2, -100.0, 100.0, options ); x = new Complex128Array( xbuf.buffer ); - z = new Complex128( 1.0, 0.0 ); + alpha = new Complex128( 1.0, 0.0 ); return benchmark; @@ -73,7 +73,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - zscal.ndarray( x.length, z, x, 1, 0 ); + zscal.ndarray( x.length, alpha, x, 1, 0 ); if ( isnan( xbuf[ i%(len*2) ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt index 41c4b3911ffd..c231903245f2 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}.main( N, za, zx, strideX ) +{{alias}}.main( N, alpha, x, strideX ) Scales a double-precision complex floating-point vector by a double- precision complex floating-point constant. @@ -9,52 +9,52 @@ Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N <= 0`, the function returns `zx` unchanged. + If `N <= 0`, the function returns `x` unchanged. Parameters ---------- N: integer Number of indexed elements. - za: Complex128 + alpha: Complex128 Complex constant. - zx: Complex128Array + x: Complex128Array Input array. strideX: integer - Index increment for `zx`. + Index increment for `x`. Returns ------- - zx: Complex128Array + x: Complex128Array Input array. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); - > {{alias}}.main( 2, za, zx, 1 ) + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}.main( 2, alpha, x, 1 ) [ -3.0, 4.0, -5.0, 10.0 ] // Advanced indexing: - > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 1.0 ); - > {{alias}}.main( 2, za, zx, 2 ) + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 1.0 ); + > {{alias}}.main( 2, alpha, x, 2 ) [ -1.0, 3.0, 3.0, 4.0, -1.0, 11.0 ] // Using typed array views: - > var zx0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > var zx1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); - > {{alias}}.main( 2, za, zx1, 1 ) + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}.main( 2, alpha, x1, 1 ) [ -2.0, 14.0, -2.0, 22.0 ] - > zx0 + > x0 [ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0 ] -{{alias}}.ndarray( N, za, zx, strideX, offsetX ) +{{alias}}.ndarray( N, alpha, x, strideX, offsetX ) Scales a double-precision complex floating-point vector by a double- precision complex floating-point constant using alternative indexing semantics. @@ -68,35 +68,35 @@ N: integer Number of indexed elements. - za: Complex128 + alpha: Complex128 Complex constant. - zx: Complex128Array + x: Complex128Array Input array. strideX: integer - Index increment for `zx`. + Index increment for `x`. offsetX: integer - Starting index for `zx`. + Starting index for `x`. Returns ------- - zx: Complex128Array + x: Complex128Array Input array. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); - > {{alias}}.ndarray( 2, za, zx, 1, 0 ) + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}.ndarray( 2, alpha, x, 1, 0 ) [ -2.0, 6.0, -2.0, 14.0 ] // Advanced indexing: - > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); - > {{alias}}.ndarray( 2, za, zx, 1, 2 ) + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}.ndarray( 2, alpha, x, 1, 2 ) [ 1.0, 2.0, 3.0, 4.0, -7.0, 16.0, -9.0, 22.0 ] @@ -447,7 +447,7 @@ Input array pointer (i.e., byte offset). dx: integer - Index increment for `zx`. + Index increment for `x`. Returns ------- @@ -503,10 +503,10 @@ Input array pointer (i.e., byte offset). dx: integer - Index increment for `zx`. + Index increment for `x`. ox: integer - Starting index for `zx`. + Starting index for `x`. Returns ------- diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts index 9ae49cdbd7cc..8111ac2c50d4 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/index.d.ts @@ -322,10 +322,10 @@ interface Routine extends ModuleWrapper { * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: - * var z = new Complex128( 2.0, 2.0 ); + * var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: - * zscal.main( x.length, z, x, 1 ); + * zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ main( N: number, alpha: Complex128, x: Complex128Array, strideX: number ): Complex128Array; @@ -348,10 +348,10 @@ interface Routine extends ModuleWrapper { * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: - * var z = new Complex128( 2.0, 2.0 ); + * var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: - * zscal.ndarray( x.length, z, x, 1, 0 ); + * zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ ndarray( N: number, alpha: Complex128, x: Complex128Array, strideX: number, offsetX: number ): Complex128Array; @@ -439,10 +439,10 @@ interface Routine extends ModuleWrapper { * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.main( x.length, z, x, 1 ); +* zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example @@ -453,10 +453,10 @@ interface Routine extends ModuleWrapper { * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.ndarray( x.length, z, x, 1, 0 ); +* zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ declare var zscal: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts index 4165b83077f7..807e3b4922aa 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/docs/types/test.ts @@ -28,178 +28,178 @@ import zscal = require( './index' ); // Attached to the main export is a `main` method which returns a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); - zscal.main( zx.length, za, zx, 1 ); // $ExpectType Complex128Array + zscal.main( x.length, alpha, x, 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 za = new Complex128( 2.0, 2.0 ); - - zscal.main( '10', za, zx, 1 ); // $ExpectError - zscal.main( true, za, zx, 1 ); // $ExpectError - zscal.main( false, za, zx, 1 ); // $ExpectError - zscal.main( null, za, zx, 1 ); // $ExpectError - zscal.main( undefined, za, zx, 1 ); // $ExpectError - zscal.main( [], za, zx, 1 ); // $ExpectError - zscal.main( {}, za, zx, 1 ); // $ExpectError - zscal.main( ( x: number ): number => x, za, zx, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.main( '10', alpha, x, 1 ); // $ExpectError + zscal.main( true, alpha, x, 1 ); // $ExpectError + zscal.main( false, alpha, x, 1 ); // $ExpectError + zscal.main( null, alpha, x, 1 ); // $ExpectError + zscal.main( undefined, alpha, x, 1 ); // $ExpectError + zscal.main( [], alpha, x, 1 ); // $ExpectError + zscal.main( {}, alpha, x, 1 ); // $ExpectError + zscal.main( ( x: number ): number => x, alpha, x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method is provided a second argument which is not a complex number... { - const zx = new Complex128Array( 10 ); - - zscal.main( zx.length, '10', zx, 1 ); // $ExpectError - zscal.main( zx.length, true, zx, 1 ); // $ExpectError - zscal.main( zx.length, false, zx, 1 ); // $ExpectError - zscal.main( zx.length, null, zx, 1 ); // $ExpectError - zscal.main( zx.length, undefined, zx, 1 ); // $ExpectError - zscal.main( zx.length, [], zx, 1 ); // $ExpectError - zscal.main( zx.length, {}, zx, 1 ); // $ExpectError - zscal.main( zx.length, ( x: number ): number => x, zx, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + + zscal.main( x.length, '10', x, 1 ); // $ExpectError + zscal.main( x.length, true, x, 1 ); // $ExpectError + zscal.main( x.length, false, x, 1 ); // $ExpectError + zscal.main( x.length, null, x, 1 ); // $ExpectError + zscal.main( x.length, undefined, x, 1 ); // $ExpectError + zscal.main( x.length, [], x, 1 ); // $ExpectError + zscal.main( x.length, {}, x, 1 ); // $ExpectError + zscal.main( x.length, ( x: number ): number => x, x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method is provided a third argument which is not a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.main( zx.length, za, 10, 1 ); // $ExpectError - zscal.main( zx.length, za, '10', 1 ); // $ExpectError - zscal.main( zx.length, za, true, 1 ); // $ExpectError - zscal.main( zx.length, za, false, 1 ); // $ExpectError - zscal.main( zx.length, za, null, 1 ); // $ExpectError - zscal.main( zx.length, za, undefined, 1 ); // $ExpectError - zscal.main( zx.length, za, [], 1 ); // $ExpectError - zscal.main( zx.length, za, {}, 1 ); // $ExpectError - zscal.main( zx.length, za, ( x: number ): number => x, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.main( x.length, alpha, 10, 1 ); // $ExpectError + zscal.main( x.length, alpha, '10', 1 ); // $ExpectError + zscal.main( x.length, alpha, true, 1 ); // $ExpectError + zscal.main( x.length, alpha, false, 1 ); // $ExpectError + zscal.main( x.length, alpha, null, 1 ); // $ExpectError + zscal.main( x.length, alpha, undefined, 1 ); // $ExpectError + zscal.main( x.length, alpha, [], 1 ); // $ExpectError + zscal.main( x.length, alpha, {}, 1 ); // $ExpectError + zscal.main( x.length, alpha, ( x: number ): number => x, 1 ); // $ExpectError } // The compiler throws an error if the `main` method is provided a fourth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.main( zx.length, za, zx, '10' ); // $ExpectError - zscal.main( zx.length, za, zx, true ); // $ExpectError - zscal.main( zx.length, za, zx, false ); // $ExpectError - zscal.main( zx.length, za, zx, null ); // $ExpectError - zscal.main( zx.length, za, zx, undefined ); // $ExpectError - zscal.main( zx.length, za, zx, [] ); // $ExpectError - zscal.main( zx.length, za, zx, {} ); // $ExpectError - zscal.main( zx.length, za, zx, ( x: number ): number => x ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.main( x.length, alpha, x, '10' ); // $ExpectError + zscal.main( x.length, alpha, x, true ); // $ExpectError + zscal.main( x.length, alpha, x, false ); // $ExpectError + zscal.main( x.length, alpha, x, null ); // $ExpectError + zscal.main( x.length, alpha, x, undefined ); // $ExpectError + zscal.main( x.length, alpha, x, [] ); // $ExpectError + zscal.main( x.length, alpha, x, {} ); // $ExpectError + zscal.main( x.length, alpha, x, ( 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 za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); zscal.main(); // $ExpectError - zscal.main( zx.length ); // $ExpectError - zscal.main( zx.length, za ); // $ExpectError - zscal.main( zx.length, za, x ); // $ExpectError - zscal.main( zx.length, za, zx, 1, 10 ); // $ExpectError + zscal.main( x.length ); // $ExpectError + zscal.main( x.length, alpha ); // $ExpectError + zscal.main( x.length, alpha, x ); // $ExpectError + zscal.main( x.length, alpha, x, 1, 10 ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); - zscal.ndarray( zx.length, za, zx, 1, 0 ); // $ExpectType Complex128Array + zscal.ndarray( x.length, alpha, x, 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 za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( '10', za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( true, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( false, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( null, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( undefined, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( [], za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( {}, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( ( x: number ): number => x, za, zx, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( '10', alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( true, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( false, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( null, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( undefined, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( [], alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( {}, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( ( x: number ): number => x, alpha, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a second argument which is not a complex number... { - const zx = new Complex128Array( 10 ); - - zscal.ndarray( zx.length, '10', zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, true, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, false, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, null, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, undefined, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, [], zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, {}, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, ( x: number ): number => x, zx, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + + zscal.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, true, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, false, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, null, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, [], x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, ( x: number ): number => x, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a third argument which is not a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( zx.length, za, 10, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, '10', 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, true, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, false, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, null, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, undefined, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, [], 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, {}, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, ( x: number ): number => x, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( x.length, alpha, 10, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, '10', 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, true, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, false, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, null, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, undefined, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, [], 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, {}, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, ( x: number ): number => x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( zx.length, za, zx, '10', 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, true, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, false, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, null, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, undefined, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, [], 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, {}, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, ( x: number ): number => x, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( x.length, alpha, x, '10', 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, true, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, false, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, null, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, undefined, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, [], 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, {}, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, ( x: number ): number => x, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( zx.length, za, zx, 1, '10' ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, true ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, false ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, null ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, undefined ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, [] ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, {} ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, ( x: number ): number => x ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( x.length, alpha, x, 1, '10' ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, true ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, false ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, null ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, undefined ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, [] ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, {} ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); zscal.ndarray(); // $ExpectError - zscal.ndarray( zx.length ); // $ExpectError - zscal.ndarray( zx.length, za ); // $ExpectError - zscal.ndarray( zx.length, za, x ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, 0, 10 ); // $ExpectError + zscal.ndarray( x.length ); // $ExpectError + zscal.ndarray( x.length, alpha ); // $ExpectError + zscal.ndarray( x.length, alpha, x ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, 0, 10 ); // $ExpectError } // Attached to the main export is a `Module` constructor which returns a module... diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js index ee6ac329b9e2..69c76bc39d3d 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/index.js @@ -38,10 +38,10 @@ function main() { var x = new Complex128Array( xbuf.buffer ); // Create a complex number: - var z = new Complex128( 2.0, 2.0 ); + var alpha = new Complex128( 2.0, 2.0 ); // Perform computation: - zscal.ndarray( N, z, x, 1, 0 ); + zscal.ndarray( N, alpha, x, 1, 0 ); // Print the results: console.log( reinterpretComplex64( x, 0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js index 34153d6978d2..46d09398324e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/examples/little_endian_arrays.js @@ -55,11 +55,11 @@ function main() { // Create typed array views over module memory: var x = new Float64ArrayLE( mod.memory.buffer, xptr, N*2 ); - var z = new Float64ArrayLE( mod.memory.buffer, zptr, 2 ); + var alpha = new Float64ArrayLE( mod.memory.buffer, zptr, 2 ); // Write values to module memory: gfillBy( N*2, x, 1, discreteUniform( -10.0, 10.0 ) ); - gfillBy( 2, z, 1, discreteUniform( -10.0, 10.0 ) ); + gfillBy( 2, alpha, 1, discreteUniform( -10.0, 10.0 ) ); // Perform computation: mod.ndarray( N, zptr, xptr, 1, 0 ); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js index 8854a7ef3355..9094828f0e18 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/index.js @@ -32,10 +32,10 @@ * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.main( x.length, z, x, 1 ); +* zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example @@ -47,10 +47,10 @@ * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.ndarray( x.length, z, x, 1, 0 ); +* zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js index 704f95c19417..f553595b14a8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/main.js @@ -39,10 +39,10 @@ var Routine = require( './routine.js' ); * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.main( x.length, z, x, 1 ); +* zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example @@ -53,10 +53,10 @@ var Routine = require( './routine.js' ); * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Define a scalar constant: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.ndarray( x.length, z, x, 1, 0 ); +* zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ var zscal = new Routine(); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js index 817ac7b17415..6bb4dee39b2e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/lib/routine.js @@ -56,10 +56,10 @@ var Module = require( './module.js' ); * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Create a complex number: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.main( x.length, z, x, 1 ); +* zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example @@ -76,10 +76,10 @@ var Module = require( './module.js' ); * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Create a complex number: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.ndarray( x.length, z, x, 1, 0 ); +* zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ function Routine() { @@ -122,10 +122,10 @@ inherits( Routine, Module ); * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Create a complex number: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.main( x.length, z, x, 1 ); +* zscal.main( x.length, alpha, x, 1 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ setReadOnly( Routine.prototype, 'main', function zscal( N, alpha, x, strideX ) { @@ -160,10 +160,10 @@ setReadOnly( Routine.prototype, 'main', function zscal( N, alpha, x, strideX ) { * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * * // Create a complex number: -* var z = new Complex128( 2.0, 2.0 ); +* var alpha = new Complex128( 2.0, 2.0 ); * * // Perform operation: -* zscal.ndarray( x.length, z, x, 1, 0 ); +* zscal.ndarray( x.length, alpha, x, 1, 0 ); * // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ setReadOnly( Routine.prototype, 'ndarray', function zscal( N, alpha, x, strideX, offsetX ) { diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js index b48aebf3bf7e..bcf545e4996f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.main.js @@ -71,13 +71,13 @@ tape( 'the `main` method has an arity of 4', function test( t ) { t.end(); }); -tape( 'the `main` method scales elements from `zx` by `za`', function test( t ) { +tape( 'the `main` method scales elements from `x` by `alpha`', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.3, // 1 0.1, // 1 0.5, // 2 @@ -87,11 +87,11 @@ tape( 'the `main` method scales elements from `zx` by `za`', function test( t ) 0.0, // 4 0.2 // 4 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.main( 4, za, zx, 1 ); + zscal.main( 4, alpha, x, 1 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.19, // 1 -0.17, // 1 @@ -107,13 +107,13 @@ tape( 'the `main` method scales elements from `zx` by `za`', function test( t ) t.end(); }); -tape( 'the `main` method supports specifying a `zx` stride', function test( t ) { +tape( 'the `main` method supports specifying a `x` stride', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, // 1 0.1, // 1 3.0, @@ -127,11 +127,11 @@ tape( 'the `main` method supports specifying a `zx` stride', function test( t ) 7.0, 2.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.main( 3, za, zx, 2 ); + zscal.main( 3, alpha, x, 2 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.11, // 1 -0.03, // 1 @@ -151,13 +151,13 @@ tape( 'the `main` method supports specifying a `zx` stride', function test( t ) t.end(); }); -tape( 'the `main` method supports specifying a negative `zx` stride', function test( t ) { +tape( 'the `main` method supports specifying a negative `x` stride', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, // 3 0.1, // 3 3.0, @@ -171,11 +171,11 @@ tape( 'the `main` method supports specifying a negative `zx` stride', function t 7.0, 2.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.main( 3, za, zx, -2 ); + zscal.main( 3, alpha, x, -2 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.11, // 3 -0.03, // 3 @@ -196,35 +196,35 @@ tape( 'the `main` method supports specifying a negative `zx` stride', function t }); tape( 'the `main` method returns a reference to the input array', function test( t ) { + var alpha; var out; - var za; - var zx; + var x; - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + alpha = new Complex128( 2.0, 2.0 ); - out = zscal.main( 4, za, zx, 1 ); + out = zscal.main( 4, alpha, x, 1 ); - t.strictEqual( out, zx, 'same reference' ); + t.strictEqual( out, x, 'same reference' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method returns the input array unchanged', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + alpha = new Complex128( 2.0, 2.0 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - zscal.main( -1, za, zx, 1 ); + zscal.main( -1, alpha, x, 1 ); t.deepEqual( viewX, expected, 'returns expected value' ); - zscal.main( 0, za, zx, 1 ); + zscal.main( 0, alpha, x, 1 ); t.deepEqual( viewX, expected, 'returns expected value' ); t.end(); @@ -233,12 +233,12 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `main` method tape( 'the `main` method supports view offsets', function test( t ) { var expected; var viewX; - var zx0; - var zx1; - var za; + var alpha; + var x0; + var x1; // Initial arrays... - zx0 = new Complex128Array([ + x0 = new Complex128Array([ 0.1, -0.3, 8.0, // 1 @@ -250,14 +250,14 @@ tape( 'the `main` method supports view offsets', function test( t ) { 2.0, 3.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); // Create offset views... - zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element - zscal.main( 3, za, zx1, 1 ); + zscal.main( 3, alpha, x1, 1 ); - viewX = new Float64Array( zx0.buffer ); + viewX = new Float64Array( x0.buffer ); expected = new Float64Array([ 0.1, -0.3, diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js index 7108c7318021..2200a13c2e54 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js @@ -80,14 +80,14 @@ tape( 'a module instance has a `main` method which has an arity of 4', function t.end(); }); -tape( 'a module instance has a `main` method which scales elements from `zx` by `za`', function test( t ) { +tape( 'a module instance has a `main` method which scales elements from `x` by `alpha`', function test( t ) { var actualX; var viewX; - var zap; - var zxe; - var zxp; var mem; var mod; + var ap; + var xe; + var xp; mem = new Memory({ 'initial': 1 @@ -95,34 +95,34 @@ tape( 'a module instance has a `main` method which scales elements from `zx` by mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 48; + xp = 0; + ap = 48; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); + xe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); - mod.main( 3, zap, zxp, 1 ); + mod.main( 3, ap, xp, 1 ); actualX = new Complex128Array( 3 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, xe, 1.0 ); t.end(); }); -tape( 'a module instance has a `main` method which supports specifying a `zx` stride', function test( t ) { +tape( 'a module instance has a `main` method which supports specifying a `x` stride', function test( t ) { var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -130,8 +130,8 @@ tape( 'a module instance has a `main` method which supports specifying a `zx` st mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, // 1 @@ -147,12 +147,12 @@ tape( 'a module instance has a `main` method which supports specifying a `zx` st 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.11, // 1 -0.03, // 1 3.0, @@ -167,26 +167,26 @@ tape( 'a module instance has a `main` method which supports specifying a `zx` st 2.0 ]); - mod.main( 3, zap, zxp, 2 ); + mod.main( 3, ap, xp, 2 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 3.0 ); + isApprox( t, viewX, xe, 3.0 ); t.end(); }); -tape( 'a module instance has a `main` method which supports specifying a negative `zx` stride', function test( t ) { +tape( 'a module instance has a `main` method which supports specifying a negative `x` stride', function test( t ) { var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -194,8 +194,8 @@ tape( 'a module instance has a `main` method which supports specifying a negativ mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, // 3 @@ -211,12 +211,12 @@ tape( 'a module instance has a `main` method which supports specifying a negativ 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.11, // 3 -0.03, // 3 3.0, @@ -231,22 +231,22 @@ tape( 'a module instance has a `main` method which supports specifying a negativ 2.0 ]); - mod.main( 3, zap, zxp, -2 ); + mod.main( 3, ap, xp, -2 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 3.0 ); + isApprox( t, viewX, xe, 3.0 ); t.end(); }); tape( 'a module instance has a `main` method which returns a reference to the input array', function test( t ) { - var zap; - var zxp; var mem; var mod; var out; + var ap; + var xp; mem = new Memory({ 'initial': 1 @@ -254,24 +254,24 @@ tape( 'a module instance has a `main` method which returns a reference to the in mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 48; + xp = 0; + ap = 48; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - out = mod.main( 3, zap, zxp, 1 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.main( 3, ap, xp, 1 ); + t.strictEqual( out, xp, 'returns expected value' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has a `main` method which leaves the input array unchanged', function test( t ) { - var zap; - var zxp; var mem; var mod; var out; + var ap; + var xp; mem = new Memory({ 'initial': 1 @@ -279,17 +279,17 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 48; + xp = 0; + ap = 48; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - out = mod.main( 0, zap, zxp, 1 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.main( 0, ap, xp, 1 ); + t.strictEqual( out, xp, 'returns expected value' ); - out = mod.main( -1, zap, zxp, 1 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.main( -1, ap, xp, 1 ); + t.strictEqual( out, xp, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js index 6991032ae0fe..7f5187e738e7 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js @@ -80,14 +80,14 @@ tape( 'a module instance has an `ndarray` method which has an arity of 5', funct t.end(); }); -tape( 'a module instance has an `ndarray` method which scales elements from `zx` by `za`', function test( t ) { +tape( 'a module instance has an `ndarray` method which scales elements from `x` by `alpha`', function test( t ) { var actualX; var viewX; - var zap; - var zxe; - var zxp; var mem; var mod; + var ap; + var xe; + var xp; mem = new Memory({ 'initial': 1 @@ -95,34 +95,34 @@ tape( 'a module instance has an `ndarray` method which scales elements from `zx` mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 48; + xp = 0; + ap = 48; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); + xe = new Float64Array( [ 0.19, -0.17, 0.2, -0.35, 0.35, 0.2 ] ); - mod.ndarray( 3, zap, zxp, 1, 0 ); + mod.ndarray( 3, ap, xp, 1, 0 ); actualX = new Complex128Array( 3 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, xe, 1.0 ); t.end(); }); -tape( 'a module instance has an `ndarray` method which supports a `zx` stride', function test( t ) { +tape( 'a module instance has an `ndarray` method which supports a `x` stride', function test( t ) { var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -130,8 +130,8 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` stride', mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, // 1 @@ -147,12 +147,12 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` stride', 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.11, // 1 -0.03, // 1 3.0, @@ -167,26 +167,26 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` stride', 2.0 ]); - mod.ndarray( 3, zap, zxp, 2, 0 ); + mod.ndarray( 3, ap, xp, 2, 0 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 3.0 ); + isApprox( t, viewX, xe, 3.0 ); t.end(); }); -tape( 'a module instance has an `ndarray` method which supports a negative `zx` stride', function test( t ) { +tape( 'a module instance has an `ndarray` method which supports a negative `x` stride', function test( t ) { var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -194,8 +194,8 @@ tape( 'a module instance has an `ndarray` method which supports a negative `zx` mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, // 3 @@ -211,12 +211,12 @@ tape( 'a module instance has an `ndarray` method which supports a negative `zx` 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.11, // 3 -0.03, // 3 3.0, @@ -231,26 +231,26 @@ tape( 'a module instance has an `ndarray` method which supports a negative `zx` 2.0 ]); - mod.ndarray( 3, zap, zxp, -2, 4 ); + mod.ndarray( 3, ap, xp, -2, 4 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 3.0 ); + isApprox( t, viewX, xe, 3.0 ); t.end(); }); -tape( 'a module instance has an `ndarray` method which supports a `zx` offset', function test( t ) { +tape( 'a module instance has an `ndarray` method which supports a `x` offset', function test( t ) { var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -258,8 +258,8 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` offset', mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, @@ -275,12 +275,12 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` offset', 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.1, 0.1, 3.0, @@ -295,22 +295,22 @@ tape( 'a module instance has an `ndarray` method which supports a `zx` offset', 2.0 ]); - mod.ndarray( 2, zap, zxp, 2, 2 ); + mod.ndarray( 2, ap, xp, 2, 2 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, xe, 1.0 ); t.end(); }); tape( 'a module instance has an `ndarray` method which returns a reference to the input array', function test( t ) { - var zap; - var zxp; var mem; var mod; var out; + var ap; + var xp; mem = new Memory({ 'initial': 1 @@ -318,24 +318,24 @@ tape( 'a module instance has an `ndarray` method which returns a reference to th mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 24; + xp = 0; + ap = 24; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - out = mod.ndarray( 3, zap, zxp, 1, 0 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.ndarray( 3, ap, xp, 1, 0 ); + t.strictEqual( out, xp, 'returns expected value' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has an `ndarray` method which leaves the input array unchanged', function test( t ) { - var zap; - var zxp; var mem; var mod; var out; + var ap; + var xp; mem = new Memory({ 'initial': 1 @@ -343,17 +343,17 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 24; + xp = 0; + ap = 24; - mod.write( zxp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - out = mod.ndarray( 0, zap, zxp, 1, 0 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.ndarray( 0, ap, xp, 1, 0 ); + t.strictEqual( out, xp, 'returns expected value' ); - out = mod.ndarray( -1, zap, zxp, 1, 0 ); - t.strictEqual( out, zxp, 'returns expected value' ); + out = mod.ndarray( -1, ap, xp, 1, 0 ); + t.strictEqual( out, xp, 'returns expected value' ); t.end(); }); @@ -362,12 +362,12 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var actualX; var viewX; var xbuf; - var zap; - var zxe; - var zxp; var mem; var mod; - var zx; + var ap; + var xe; + var xp; + var x; mem = new Memory({ 'initial': 1 @@ -375,8 +375,8 @@ tape( 'a module instance has an `ndarray` method which supports complex access p mod = new Module( mem ); mod.initializeSync(); - zxp = 0; - zap = 96; + xp = 0; + ap = 96; xbuf = new Float64Array([ 0.1, @@ -392,12 +392,12 @@ tape( 'a module instance has an `ndarray` method which supports complex access p 7.0, 2.0 ]); - zx = new Complex128Array( xbuf.buffer ); + x = new Complex128Array( xbuf.buffer ); - mod.write( zxp, zx ); - mod.write( zap, new Float64Array( [ 0.4, -0.7 ] ) ); + mod.write( xp, x ); + mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) ); - zxe = new Float64Array([ + xe = new Float64Array([ 0.1, 0.1, 3.0, @@ -412,12 +412,12 @@ tape( 'a module instance has an `ndarray` method which supports complex access p 2.0 ]); - mod.ndarray( 2, zap, zxp, -2, 4 ); + mod.ndarray( 2, ap, xp, -2, 4 ); actualX = new Complex128Array( 6 ); - mod.read( zxp, actualX ); + mod.read( xp, actualX ); viewX = new Float64Array( actualX.buffer ); - isApprox( t, viewX, zxe, 1.0 ); + isApprox( t, viewX, xe, 1.0 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js index 884d2e96d68b..7f68519e71e5 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.ndarray.js @@ -71,13 +71,13 @@ tape( 'the `ndarray` method has an arity of 5', function test( t ) { t.end(); }); -tape( 'the `ndarray` method scales elements from `zx` by `za`', function test( t ) { +tape( 'the `ndarray` method scales elements from `x` by `alpha`', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.3, // 1 0.1, // 1 0.5, // 2 @@ -91,11 +91,11 @@ tape( 'the `ndarray` method scales elements from `zx` by `za`', function test( t 2.0, 3.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.ndarray( 4, za, zx, 1, 0 ); + zscal.ndarray( 4, alpha, x, 1, 0 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.19, // 1 -0.17, // 1 @@ -115,13 +115,13 @@ tape( 'the `ndarray` method scales elements from `zx` by `za`', function test( t t.end(); }); -tape( 'the `ndarray` method supports specifying a `zx` stride', function test( t ) { +tape( 'the `ndarray` method supports specifying a `x` stride', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, // 1 0.1, // 1 3.0, @@ -135,11 +135,11 @@ tape( 'the `ndarray` method supports specifying a `zx` stride', function test( t 7.0, 2.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.ndarray( 3, za, zx, 2, 0 ); + zscal.ndarray( 3, alpha, x, 2, 0 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.11, // 1 -0.03, // 1 @@ -159,13 +159,13 @@ tape( 'the `ndarray` method supports specifying a `zx` stride', function test( t t.end(); }); -tape( 'the `ndarray` method supports specifying a negative `zx` stride', function test( t ) { +tape( 'the `ndarray` method supports specifying a negative `x` stride', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, // 3 0.1, // 3 3.0, @@ -179,11 +179,11 @@ tape( 'the `ndarray` method supports specifying a negative `zx` stride', functio 7.0, 2.0 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.ndarray( 3, za, zx, -2, 4 ); + zscal.ndarray( 3, alpha, x, -2, 4 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.11, // 3 -0.03, // 3 @@ -203,13 +203,13 @@ tape( 'the `ndarray` method supports specifying a negative `zx` stride', functio t.end(); }); -tape( 'the `ndarray` method supports a `zx` offset', function test( t ) { +tape( 'the `ndarray` method supports a `x` offset', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, 0.1, 3.0, @@ -223,11 +223,11 @@ tape( 'the `ndarray` method supports a `zx` offset', function test( t ) { 7.0, // 3 2.0 // 3 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.ndarray( 3, za, zx, 1, 3 ); + zscal.ndarray( 3, alpha, x, 1, 3 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.1, 0.1, @@ -248,35 +248,35 @@ tape( 'the `ndarray` method supports a `zx` offset', function test( t ) { }); tape( 'the `ndarray` method returns a reference to the input array', function test( t ) { + var alpha; var out; - var za; - var zx; + var x; - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + alpha = new Complex128( 2.0, 2.0 ); - out = zscal.ndarray( 4, za, zx, 1, 0 ); + out = zscal.ndarray( 4, alpha, x, 1, 0 ); - t.strictEqual( out, zx, 'same reference' ); + t.strictEqual( out, x, 'same reference' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` method returns the input array unchanged', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + alpha = new Complex128( 2.0, 2.0 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - zscal.ndarray( -1, za, zx, 1, 0 ); + zscal.ndarray( -1, alpha, x, 1, 0 ); t.deepEqual( viewX, expected, 'returns expected value' ); - zscal.ndarray( 0, za, zx, 1, 0 ); + zscal.ndarray( 0, alpha, x, 1, 0 ); t.deepEqual( viewX, expected, 'returns expected value' ); t.end(); @@ -285,10 +285,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` met tape( 'the `ndarray` method supports complex access patterns', function test( t ) { var expected; var viewX; - var za; - var zx; + var alpha; + var x; - zx = new Complex128Array([ + x = new Complex128Array([ 0.1, 0.1, 3.0, @@ -304,11 +304,11 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.0, // 2 3.0 // 2 ]); - za = new Complex128( 0.4, -0.7 ); + alpha = new Complex128( 0.4, -0.7 ); - zscal.ndarray( 2, za, zx, 3, 3 ); + zscal.ndarray( 2, alpha, x, 3, 3 ); - viewX = new Float64Array( zx.buffer ); + viewX = new Float64Array( x.buffer ); expected = new Float64Array([ 0.1, 0.1,