diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/README.md b/lib/node_modules/@stdlib/blas/base/snrm2/README.md index 42d075a337a6..b27a5b7724dd 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/README.md +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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. @@ -67,16 +67,14 @@ The function has the following parameters: - **x**: input [`Float32Array`][@stdlib/array/float32]. - **stride**: index increment for `x`. -The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [L2-norm][l2-norm] of every other element in `x`, +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [L2-norm][l2-norm] of every other element in `x`, ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] ); -var N = floor( x.length / 2 ); -var z = snrm2( N, x, 2 ); +var z = snrm2( 4, x, 2 ); // returns 5.0 ``` @@ -86,14 +84,11 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var N = floor( x0.length / 2 ); - -var z = snrm2( N, x1, 2 ); +var z = snrm2( 4, x1, 2 ); // returns 5.0 ``` @@ -117,16 +112,14 @@ The function has the following additional parameters: - **offset**: 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 calculate the [L2-norm][l2-norm] for every other value in `x` starting from the second value +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 calculate the [L2-norm][l2-norm] for every other value in `x` starting from the second value ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); -var N = floor( x.length / 2 ); -var z = snrm2.ndarray( N, x, 2, 1 ); +var z = snrm2.ndarray( 4, x, 2, 1 ); // returns 5.0 ``` @@ -152,18 +145,11 @@ var z = snrm2.ndarray( N, x, 2, 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 snrm2 = require( '@stdlib/blas/base/snrm2' ); -var x; -var i; - -x = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); var z = snrm2( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.js index 4fe56bef14bb..96389a2aea56 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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 snrm2 = require( './../lib/snrm2.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var snrm2 = require( './../lib/snrm2.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.native.js index a72785d76756..9c274bb44dd4 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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 snrm2 = tryRequire( resolve( __dirname, './../lib/snrm2.native.js' ) ); var opts = { 'skip': ( snrm2 instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.js index 1c96d014489d..cdc60816eb83 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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 snrm2 = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var snrm2 = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.native.js index 3d8e6cfabe18..71909d17690f 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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 snrm2 = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( snrm2 instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/snrm2/docs/repl.txt index 1dc15bd6235d..06f443ee8470 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/snrm2/docs/repl.txt @@ -2,8 +2,8 @@ {{alias}}( N, x, stride ) Computes the L2-norm of a single-precision floating-point vector. - The `N` and `stride` parameters determine which elements in `x` are accessed - at runtime. + 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 a typed array view. @@ -35,19 +35,18 @@ // Using `N` and `stride` parameters: > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); > var stride = 2; - > {{alias}}( N, x, stride ) + > {{alias}}( 3, x, stride ) 3.0 // Using view offsets: > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); > stride = 2; - > {{alias}}( N, x1, stride ) + > {{alias}}( 3, x1, stride ) 3.0 + {{alias}}.ndarray( N, x, stride, offset ) Computes the L2-norm of a single-precision floating-point vector using alternative indexing semantics. @@ -84,8 +83,7 @@ // Using offset parameter: > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, x, 2, 1 ) + > {{alias}}.ndarray( 3, x, 2, 1 ) 3.0 See Also diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/snrm2/docs/types/index.d.ts index 3293523c8a8d..59cbe8868e77 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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 { /** * Computes the L2-norm of a single-precision floating-point vector. * - * @param N - number of values over which to compute the L2-norm + * @param N - number of values * @param x - input array * @param stride - stride length * @returns L2-norm @@ -43,7 +43,7 @@ interface Routine { /** * Computes the L2-norm of a single-precision floating-point vector using alternative indexing semantics. * - * @param N - number of values over which to compute the L2-norm + * @param N - number of values * @param x - input array * @param stride - stride length * @param offset - starting index @@ -63,7 +63,7 @@ interface Routine { /** * Computes the L2-norm of a single-precision floating-point vector. * -* @param N - number of values over which to compute the L2-norm +* @param N - number of values * @param x - input array * @param stride - stride length * @returns L2-norm diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/examples/index.js b/lib/node_modules/@stdlib/blas/base/snrm2/examples/index.js index 3c8ccd3549d6..c2e8cf2d3fde 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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,18 +18,11 @@ '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 snrm2 = require( './../lib' ); -var x; -var i; - -x = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*10.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); var z = snrm2( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/include.gypi b/lib/node_modules/@stdlib/blas/base/snrm2/include.gypi index 22e6289c74db..f8b01bfb52cb 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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, 3 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 ); + + napi_value v; + napi_status status = napi_create_double( env, (double)c_snrm2( N, (float *)X, strideX ), &v ); + assert( status == napi_ok ); + + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/addon.cpp b/lib/node_modules/@stdlib/blas/base/snrm2/src/addon.cpp deleted file mode 100644 index 755cc9972682..000000000000 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/addon.cpp +++ /dev/null @@ -1,117 +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/snrm2.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_base_snrm2 { - - /** - * Computes the L2-norm of a single-precision floating-point vector. - * - * ## Notes - * - * - When called from JavaScript, the function expects three arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `strideX`: `X` stride length - */ - napi_value node_snrm2( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 3; - napi_value argv[ 3 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 3 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 3 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; - } - - 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 ); - - 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_value v; - status = napi_create_double( env, (double)c_snrm2( N, (float *)X, strideX ), &v ); - assert( status == napi_ok ); - - return v; - } - - 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_snrm2, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_base_snrm2 diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.c b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.c index baad15ef604b..ca97030230de 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.c +++ b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.c @@ -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,7 @@ /** * Computes the L2-norm of a single-precision floating-point vector. * -* @param N number of values over which to compute the norm +* @param N number of values * @param X input array * @param stride stride length * @return output value diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.f b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.f index 24338db6bb8e..4734f40acecc 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.f +++ b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2.f @@ -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. @@ -45,10 +45,10 @@ ! > ! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support. ! -! @param {integer} N - number of values over which to compute the norm +! @param {integer} N - number of values ! @param {Array} sx - array ! @param {integer} stride - stride length -! @returns {real} L2-norm +! @returns {real} output value !< real function snrm2( N, sx, stride ) implicit none @@ -91,4 +91,4 @@ real function snrm2( N, sx, stride ) end if end do snrm2 = scale * sqrt( ssq ) -end function snrm2 \ No newline at end of file +end function snrm2 diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_cblas.c b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_cblas.c index 6a3c9f43492f..2aa796c69961 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_cblas.c @@ -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,7 @@ /** * Computes the L2-norm of a single-precision floating-point vector. * -* @param N number of values over which to compute the norm +* @param N number of values * @param X input array * @param stride stride length * @return output value diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_f.c b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_f.c index 1cbb340d5ba6..fa425f14df91 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_f.c +++ b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2_f.c @@ -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,7 @@ /** * Computes the L2-norm of a single-precision floating-point vector. * -* @param N number of values over which to compute the norm +* @param N number of values * @param X input array * @param stride stride length * @return output value diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2sub.f b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2sub.f index 940e3a0ce848..9996f2760749 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2sub.f +++ b/lib/node_modules/@stdlib/blas/base/snrm2/src/snrm2sub.f @@ -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,7 +18,7 @@ !> Wraps `snrm2` as a subroutine. ! -! @param {integer} N - number of values over which to compute the norm +! @param {integer} N - number of values ! @param {Array} sx - input array ! @param {integer} stride - stride length ! @param {real} nrm2 - output variable reference @@ -44,4 +44,4 @@ end function snrm2 ! Compute the L2-norm: nrm2 = snrm2( N, sx, stride ) return -end subroutine snrm2sub \ No newline at end of file +end subroutine snrm2sub diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.js index dd1f2e99225c..1aafff21a194 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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. @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float32Array = require( '@stdlib/array/float32' ); var snrm2 = require( './../lib/ndarray.js' ); @@ -87,7 +86,7 @@ tape( 'the function supports a `stride` parameter', function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2, 0 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -110,7 +109,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t ) 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, -2, x.length-2 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -132,7 +131,7 @@ tape( 'the function supports an `offset` parameter', function test( t ) { 3.0, 4.0 // 3 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2, 1 ); t.strictEqual( z, 5.0, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.native.js index 83395a92f36e..d681360bf42d 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/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. @@ -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 tryRequire = require( '@stdlib/utils/try-require' ); @@ -96,7 +95,7 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2, 0 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -119,7 +118,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, -2, x.length-2 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -141,7 +140,7 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) { 3.0, 4.0 // 3 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2, 1 ); t.strictEqual( z, 5.0, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.js b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.js index eb34d9ee3d72..10a151653d5c 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.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 snrm2 = require( './../lib/snrm2.js' ); @@ -87,7 +86,7 @@ tape( 'the function supports a `stride` parameter', function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -128,7 +127,7 @@ tape( 'the function supports view offsets', function test( t ) { ]); x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); + N = 4; z = snrm2( N, x1, 2 ); t.strictEqual( z, 5.0, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.native.js b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.native.js index fbabb8ea61fd..b58590e889b1 100644 --- a/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.native.js +++ b/lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.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 tryRequire = require( '@stdlib/utils/try-require' ); @@ -96,7 +95,7 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); + N = 4; z = snrm2( N, x, 2 ); t.strictEqual( z, 5.0, 'returns expected value' ); @@ -137,7 +136,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { ]); x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); + N = 4; z = snrm2( N, x1, 2 ); t.strictEqual( z, 5.0, 'returns expected value' );