diff --git a/lib/node_modules/@stdlib/blas/base/sswap/README.md b/lib/node_modules/@stdlib/blas/base/sswap/README.md index 3baacf534d7f..ec7ebf5e3236 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/README.md +++ b/lib/node_modules/@stdlib/blas/base/sswap/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2020 The Stdlib Authors. +Copyright (c) 2023 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. @@ -53,7 +53,7 @@ The function has the following parameters: - **y**: second input [`Float32Array`][mdn-float32array]. - **strideY**: index increment for `y`. -The `N` and `stride` parameters determine how values from `x` and `y` are accessed at runtime. For example, to swap in reverse order every other value in `x` with the first `N` elements of `y`, +The `N` and stride parameters determine how values from the strided arrays are accessed at runtime. For example, to swap in reverse order every other value in `x` with the first `N` elements of `y`, ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -107,7 +107,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetY**: starting index for `y`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offsetX` and `offsetY` parameters support indexing semantics based on starting indices. For example, to swap every other value in `x` starting from the second value with the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,..., +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the offset parameters support indexing semantics based on starting indices. For example, to swap every other value in `x` starting from the second value with the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,..., ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -142,22 +142,14 @@ sswap.ndarray( 3, x, 2, 1, y, -1, y.length-1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var sswap = require( '@stdlib/blas/base/sswap' ); -var x; -var y; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*500.0 ); - y[ i ] = round( randu()*255.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 500 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 255 ) ); console.log( y ); // Swap elements in `x` and `y` starting from the end of `y`: diff --git a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.js index 5ea44f4e68e8..573593c12255 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -21,14 +21,19 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var sswap = require( './../lib/sswap.js' ); +// VARIABLES // + +var rand = uniform( -10000.0, 10000.0 ); + + // FUNCTIONS // /** @@ -39,15 +44,8 @@ var sswap = require( './../lib/sswap.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.native.js index 756bfa2a1dcf..10527c1cf256 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -22,10 +22,10 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var sswap = tryRequire( resolve( __dirname, './../lib/sswap.native.js' ) ); var opts = { 'skip': ( sswap instanceof Error ) }; +var rand = uniform( -10000.0, 10000.0 ); // FUNCTIONS // @@ -48,15 +49,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.js index 322e02f02fbd..cdd3f68a568b 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -21,14 +21,19 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var sswap = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -10000.0, 10000.0 ); + + // FUNCTIONS // /** @@ -39,15 +44,8 @@ var sswap = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.native.js index 29fa8c46cf9c..2a9c04d96cad 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/benchmark/benchmark.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -22,10 +22,10 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var sswap = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( sswap instanceof Error ) }; +var rand = uniform( -10000.0, 10000.0 ); // FUNCTIONS // @@ -48,15 +49,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/sswap/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sswap/docs/repl.txt index edb9775f8f31..caaf9a3bf19a 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sswap/docs/repl.txt @@ -13,7 +13,7 @@ Parameters ---------- N: integer - Number of values to swap. + Number of values. x: Float32Array First input array. @@ -30,7 +30,7 @@ Returns ------- y: Float32Array - Input array `y`. + Second input array. Examples -------- @@ -43,8 +43,7 @@ // Advanced indexing: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}( N, x, -2, y, 1 ) + > {{alias}}( 3, x, -2, y, 1 ) [ 5.0, 3.0, 1.0, 10.0, 11.0, 12.0 ] // Using typed array views: @@ -52,8 +51,7 @@ > var y0 = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > {{alias}}( N, x1, -2, y1, 1 ) + > {{alias}}( 3, x1, -2, y1, 1 ) [ 6.0, 4.0, 2.0 ] > y0 [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] @@ -64,13 +62,13 @@ indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offset` parameters support indexing semantics based on starting + buffer, the offset parameters support indexing semantics based on starting indices. Parameters ---------- N: integer - Number of values to swap. + Number of values. x: Float32Array First input array. @@ -93,7 +91,7 @@ Returns ------- y: Float32Array - Input array `y`. + Second input array. Examples -------- @@ -106,8 +104,7 @@ // Advanced indexing: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) + > {{alias}}.ndarray( 3, x, 2, 1, y, -1, y.length-1 ) [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/base/sswap/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sswap/docs/types/index.d.ts index ead3108951c5..28e201f3d489 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/sswap/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -25,7 +25,7 @@ interface Routine { /** * Interchanges two single-precision floating-point vectors. * - * @param N - number of values to swap + * @param N - number of values * @param x - first input array * @param strideX - `x` stride length * @param y - second input array @@ -47,7 +47,7 @@ interface Routine { /** * Interchanges two single-precision floating-point vectors using alternative indexing semantics. * - * @param N - number of values to swap + * @param N - number of values * @param x - first input array * @param strideX - `x` stride length * @param offsetX - starting index for `x` diff --git a/lib/node_modules/@stdlib/blas/base/sswap/examples/index.js b/lib/node_modules/@stdlib/blas/base/sswap/examples/index.js index a162163d96e0..59582df8fd60 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -18,22 +18,14 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var sswap = require( './../lib' ); -var x; -var y; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*500.0 ); - y[ i ] = round( randu()*255.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 500 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 255 ) ); console.log( y ); // Swap elements in `x` and `y` starting from the end of `y`: diff --git a/lib/node_modules/@stdlib/blas/base/sswap/include.gypi b/lib/node_modules/@stdlib/blas/base/sswap/include.gypi index 22e6289c74db..f8b01bfb52cb 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/sswap/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2018 The Stdlib Authors. +# Copyright (c) 2023 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. @@ -52,7 +52,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' + +/** +* Receives JavaScript callback invocation data. +* +* @private +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 3 ); + c_sswap( N, (float *)X, strideX, (float *)Y, strideY ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/base/sswap/src/addon.cpp b/lib/node_modules/@stdlib/blas/base/sswap/src/addon.cpp deleted file mode 100644 index c494cc834161..000000000000 --- a/lib/node_modules/@stdlib/blas/base/sswap/src/addon.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/base/sswap.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_base_sswap { - - /** - * Interchanges two single-precision floating-point vectors. - * - * ## Notes - * - * - When called from JavaScript, the function expects five arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `strideX`: `X` stride length - * - `Y`: destination array - * - `strideY`: `Y` stride length - */ - napi_value node_sswap( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 5; - napi_value argv[ 5 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 5 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 5 arguments." ); - return nullptr; - } - - napi_valuetype vtype0; - status = napi_typeof( env, argv[ 0 ], &vtype0 ); - assert( status == napi_ok ); - if ( vtype0 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." ); - return nullptr; - } - - bool res1; - status = napi_is_typedarray( env, argv[ 1 ], &res1 ); - assert( status == napi_ok ); - if ( res1 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype2; - status = napi_typeof( env, argv[ 2 ], &vtype2 ); - assert( status == napi_ok ); - if ( vtype2 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a number." ); - return nullptr; - } - - bool res3; - status = napi_is_typedarray( env, argv[ 3 ], &res3 ); - assert( status == napi_ok ); - if ( res3 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype4; - status = napi_typeof( env, argv[ 4 ], &vtype4 ); - assert( status == napi_ok ); - if ( vtype4 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - int64_t strideX; - status = napi_get_value_int64( env, argv[ 2 ], &strideX ); - assert( status == napi_ok ); - - int64_t strideY; - status = napi_get_value_int64( env, argv[ 4 ], &strideY ); - assert( status == napi_ok ); - - napi_typedarray_type vtype1; - size_t xlen; - void *X; - status = napi_get_typedarray_info( env, argv[ 1 ], &vtype1, &xlen, &X, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype1 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideX) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Second argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_typedarray_type vtype3; - size_t ylen; - void *Y; - status = napi_get_typedarray_info( env, argv[ 3 ], &vtype3, &ylen, &Y, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype3 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideY) >= (int64_t)ylen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Fourth argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - c_sswap( N, (float *)X, strideX, (float *)Y, strideY ); - - return nullptr; - } - - napi_value Init( napi_env env, napi_value exports ) { - napi_status status; - napi_value fcn; - status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_sswap, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_base_sswap diff --git a/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.js index cd5cfcbca178..c13f56403090 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -56,10 +56,10 @@ tape( 'the function interchanges vectors `x` and `y`', function test( t ) { sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); @@ -73,10 +73,10 @@ tape( 'the function interchanges vectors `x` and `y`', function test( t ) { sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); @@ -110,8 +110,8 @@ tape( 'the function supports an `x` stride', function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -143,8 +143,8 @@ tape( 'the function supports an `x` offset', function test( t ) { xe = new Float32Array( [ 1.0, 2.0, 6.0, 7.0, 8.0 ] ); ye = new Float32Array( [ 3.0, 4.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -176,8 +176,8 @@ tape( 'the function supports a `y` stride', function test( t ) { xe = new Float32Array( [ 6.0, 8.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 1.0, 7.0, 2.0, 9.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -209,8 +209,8 @@ tape( 'the function supports a `y` offset', function test( t ) { xe = new Float32Array( [ 8.0, 9.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 6.0, 7.0, 1.0, 2.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -282,8 +282,8 @@ tape( 'the function supports negative strides', function test( t ) { xe = new Float32Array( [ 7.0, 2.0, 8.0, 4.0, 9.0 ] ); ye = new Float32Array( [ 6.0, 1.0, 3.0, 5.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -317,8 +317,8 @@ tape( 'the function supports complex access patterns', function test( t ) { xe = new Float32Array( [ 1.0, 12.0, 3.0, 11.0, 5.0, 10.0 ] ); ye = new Float32Array( [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -343,10 +343,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( 120 ); @@ -363,10 +363,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.native.js index a28bf115c57e..59e570304e46 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -65,10 +65,10 @@ tape( 'the function interchanges vectors `x` and `y`', opts, function test( t ) sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); @@ -82,10 +82,10 @@ tape( 'the function interchanges vectors `x` and `y`', opts, function test( t ) sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); @@ -119,8 +119,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -152,8 +152,8 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { xe = new Float32Array( [ 1.0, 2.0, 6.0, 7.0, 8.0 ] ); ye = new Float32Array( [ 3.0, 4.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -185,8 +185,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { xe = new Float32Array( [ 6.0, 8.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 1.0, 7.0, 2.0, 9.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -218,8 +218,8 @@ tape( 'the function supports a `y` offset', opts, function test( t ) { xe = new Float32Array( [ 8.0, 9.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 6.0, 7.0, 1.0, 2.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -291,8 +291,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { xe = new Float32Array( [ 7.0, 2.0, 8.0, 4.0, 9.0 ] ); ye = new Float32Array( [ 6.0, 1.0, 3.0, 5.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -326,8 +326,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) xe = new Float32Array( [ 1.0, 12.0, 3.0, 11.0, 5.0, 10.0 ] ); ye = new Float32Array( [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -352,10 +352,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( 120 ); @@ -372,10 +372,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, 0, y, 1, 0 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.js b/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.js index d28e3a23afc7..953de9f35aca 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float32Array = require( '@stdlib/array/float32' ); var scopy = require( '@stdlib/blas/base/scopy' ); var sswap = require( './../lib/sswap.js' ); @@ -57,10 +56,10 @@ tape( 'the function interchanges vectors `x` and `y`', function test( t ) { sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); @@ -74,10 +73,10 @@ tape( 'the function interchanges vectors `x` and `y`', function test( t ) { sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); @@ -111,8 +110,8 @@ tape( 'the function supports an `x` stride', function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -144,8 +143,8 @@ tape( 'the function supports a `y` stride', function test( t ) { xe = new Float32Array( [ 6.0, 8.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 1.0, 7.0, 2.0, 9.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -217,8 +216,8 @@ tape( 'the function supports negative strides', function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -252,8 +251,8 @@ tape( 'the function supports complex access patterns', function test( t ) { xe = new Float32Array( [ 9.0, 2.0, 8.0, 4.0, 7.0, 6.0 ] ); ye = new Float32Array( [ 5.0, 3.0, 1.0, 10.0, 11.0, 12.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -288,15 +287,15 @@ tape( 'the function supports view offsets', function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); + N = 3; sswap( N, x1, -2, y1, 1 ); xe = new Float32Array( [ 1.0, 12.0, 3.0, 11.0, 5.0, 10.0 ] ); ye = new Float32Array( [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] ); - t.deepEqual( x0, xe, 'deep equal' ); - t.deepEqual( y0, ye, 'deep equal' ); + t.deepEqual( x0, xe, 'returns expected value' ); + t.deepEqual( y0, ye, 'returns expected value' ); t.end(); }); @@ -321,10 +320,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( 120 ); @@ -341,10 +340,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.native.js b/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.native.js index 5cd30d12669c..23d8ff4fa4d7 100644 --- a/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.native.js +++ b/lib/node_modules/@stdlib/blas/base/sswap/test/test.sswap.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float32Array = require( '@stdlib/array/float32' ); var scopy = require( '@stdlib/blas/base/scopy' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -66,10 +65,10 @@ tape( 'the function interchanges vectors `x` and `y`', opts, function test( t ) sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); @@ -83,10 +82,10 @@ tape( 'the function interchanges vectors `x` and `y`', opts, function test( t ) sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end(); @@ -120,8 +119,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -153,8 +152,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { xe = new Float32Array( [ 6.0, 8.0, 10.0, 4.0, 5.0 ] ); ye = new Float32Array( [ 1.0, 7.0, 2.0, 9.0, 3.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -226,8 +225,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] ); ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -261,8 +260,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) xe = new Float32Array( [ 9.0, 2.0, 8.0, 4.0, 7.0, 6.0 ] ); ye = new Float32Array( [ 5.0, 3.0, 1.0, 10.0, 11.0, 12.0 ] ); - t.deepEqual( x, xe, 'deep equal' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); t.end(); }); @@ -297,15 +296,15 @@ tape( 'the function supports view offsets', opts, function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); + N = 3; sswap( N, x1, -2, y1, 1 ); xe = new Float32Array( [ 1.0, 12.0, 3.0, 11.0, 5.0, 10.0 ] ); ye = new Float32Array( [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] ); - t.deepEqual( x0, xe, 'deep equal' ); - t.deepEqual( y0, ye, 'deep equal' ); + t.deepEqual( x0, xe, 'returns expected value' ); + t.deepEqual( y0, ye, 'returns expected value' ); t.end(); }); @@ -330,10 +329,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); x = new Float32Array( 120 ); @@ -350,10 +349,10 @@ tape( 'if both strides are equal to `1`, the function efficiently swaps elements sswap( x.length, x, 1, y, 1 ); - t.deepEqual( x, xe, 'deep equal' ); + t.deepEqual( x, xe, 'returns expected value' ); t.notEqual( x, xe, 'different references' ); - t.deepEqual( y, ye, 'deep equal' ); + t.deepEqual( y, ye, 'returns expected value' ); t.notEqual( y, ye, 'different references' ); t.end();