diff --git a/lib/node_modules/@stdlib/blas/base/sdot/README.md b/lib/node_modules/@stdlib/blas/base/sdot/README.md index 67b854746721..7fd5f45cfbdb 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/README.md +++ b/lib/node_modules/@stdlib/blas/base/sdot/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2019 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. @@ -69,18 +69,15 @@ The function has the following parameters: - **y**: input [`Float32Array`][@stdlib/array/float32]. - **strideY**: index increment for `y`. -The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to calculate the dot product of every other value in `x` and the first `N` elements of `y` in reverse order, +The `N` and stride parameters determine which elements in `x` and `y` are accessed at runtime. For example, to calculate the dot product of every other value in `x` and the first `N` elements of `y` in reverse order, ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); -var N = floor( x.length / 2 ); - -var z = sdot( N, x, 2, y, -1 ); +var z = sdot( 3, x, 2, y, -1 ); // returns 9.0 ``` @@ -90,7 +87,6 @@ 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' ); // Initial arrays... var x0 = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); @@ -100,9 +96,7 @@ var y0 = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element -var N = floor( x0.length / 2 ); - -var z = sdot( N, x1, -2, y1, 1 ); +var z = sdot( 3, x1, -2, y1, 1 ); // returns 128.0 ``` @@ -125,18 +119,15 @@ 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 calculate the dot product of every other value in `x` starting from the second value with the last 3 elements in `y` in reverse order +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the offset parameters support indexing semantics based on starting indices. For example, to calculate the dot product of every other value in `x` starting from the second value with the last 3 elements in `y` in reverse order ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); var y = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -var N = floor( x.length / 2 ); - -var z = sdot.ndarray( N, x, 2, 1, y, -1, y.length-1 ); +var z = sdot.ndarray( 3, x, 2, 1, y, -1, y.length-1 ); // returns 128.0 ``` @@ -162,22 +153,14 @@ var z = sdot.ndarray( N, 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 sdot = require( '@stdlib/blas/base/sdot' ); -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()*100.0 ); - y[ i ] = round( randu()*10.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 10 ) ); console.log( y ); var z = sdot( x.length, x, 1, y, -1 ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.js index aa87e92692cf..98019e86d76c 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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 sdot = require( './../lib/sdot.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,16 +44,8 @@ var sdot = require( './../lib/sdot.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()*20.0 ) - 10.0; - y[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.native.js index 7b6c77e535e9..846be9df2702 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/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 sdot = tryRequire( resolve( __dirname, './../lib/sdot.native.js' ) ); var opts = { 'skip': ( sdot instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,16 +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()*20.0 ) - 10.0; - y[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.js index 6c898f55fad2..61203375e7c3 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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 sdot = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,16 +44,8 @@ var sdot = 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()*20.0 ) - 10.0; - y[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.native.js index 944c4cc6f829..b1ea98d0a109 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/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 sdot = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( sdot instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,16 +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()*20.0 ) - 10.0; - y[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt index 6438ba28b705..60b3a63e1408 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt @@ -2,8 +2,8 @@ {{alias}}( N, x, strideX, y, strideY ) Computes the dot product of two single-precision floating-point vectors. - The `N`, `strideX`, and `strideY` parameters determine which elements in `x` - and `y` 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. @@ -30,7 +30,7 @@ Returns ------- dot: float - The dot product of `x` and `y`. + The dot product. Examples -------- @@ -43,8 +43,7 @@ // Strides: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > dot = {{alias}}( N, x, 2, y, -1 ) + > dot = {{alias}}( 3, x, 2, y, -1 ) 9.0 // Using view offsets: @@ -52,17 +51,16 @@ > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); > var x1 = new {{alias:@stdlib/array/float32}}( x.buffer, x.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float32}}( y.buffer, y.BYTES_PER_ELEMENT*3 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > dot = {{alias}}( N, x1, -2, y1, 1 ) + > dot = {{alias}}( 3, x1, -2, y1, 1 ) 128.0 + {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) Computes the dot product of two single-precision floating-point vectors using alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offsetX` and `offsetY` parameters support indexing based on a - starting index. + buffer, the offset parameters support indexing based on a starting index. Parameters ---------- @@ -90,7 +88,7 @@ Returns ------- dot: float - The dot product of `x` and `y`. + The dot product. Examples -------- @@ -103,15 +101,13 @@ // Strides: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > dot = {{alias}}.ndarray( N, x, 2, 0, y, 2, 0 ) + > dot = {{alias}}.ndarray( 3, x, 2, 0, y, 2, 0 ) 9.0 // Using offset indices: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); - > N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > dot = {{alias}}.ndarray( N, x, -2, x.length-1, y, 1, 3 ) + > dot = {{alias}}.ndarray( 3, x, -2, x.length-1, y, 1, 3 ) 128.0 See Also diff --git a/lib/node_modules/@stdlib/blas/base/sdot/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sdot/docs/types/index.d.ts index 373e8f0906cb..7b51b6b17440 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/sdot/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,12 +25,12 @@ interface Routine { /** * Computes the dot product of two single-precision floating-point vectors. * - * @param N - number of values over which to compute the dot product + * @param N - number of values * @param x - first input array * @param strideX - `x` stride length * @param y - second input array * @param strideY - `y` stride length - * @returns dot product of `x` and `y` + * @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); @@ -46,14 +46,14 @@ interface Routine { /** * Computes the dot product of `x` and `y` using alternative indexing semantics. * - * @param N - number of values over which to compute the dot product + * @param N - number of values * @param x - first input array * @param strideX - `x` stride length * @param offsetX - starting index for `x` * @param y - second input array * @param strideY - `y` stride length * @param offsetY - starting index for `y` - * @returns dot product of `x` and `y` + * @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); @@ -70,12 +70,12 @@ interface Routine { /** * Computes the dot product of `x` and `y`. * -* @param N - number of values over which to compute the dot product +* @param N - number of values * @param x - first input array * @param strideX - `x` stride length * @param y - second input array * @param strideY - `y` stride length -* @returns dot product of `x` and `y` +* @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js b/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js index 897ebbdbf5b9..cb7605e29a93 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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 sdot = 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()*100.0 ); - y[ i ] = round( randu()*10.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 10 ) ); console.log( y ); var dot = sdot.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/include.gypi b/lib/node_modules/@stdlib/blas/base/sdot/include.gypi index 22e6289c74db..f8b01bfb52cb 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/sdot/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 ) { + napi_status status; + + 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 ); + + napi_value v; + status = napi_create_double( env, (double)c_sdot( N, (float *)X, strideX, (float *)Y, strideY ), &v ); + assert( status == napi_ok ); + + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.cpp b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.cpp deleted file mode 100644 index 73d4549e853c..000000000000 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.cpp +++ /dev/null @@ -1,153 +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/sdot.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_base_sdot { - - /** - * Computes the dot product of 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_sdot( 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; - } - - napi_value v; - status = napi_create_double( env, (double)c_sdot( N, (float *)X, strideX, (float *)Y, strideY ), &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_sdot, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_base_sdot diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.c b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.c index e8bb93270b41..8dc564c8fe43 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.c +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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. @@ -26,7 +26,7 @@ /** * Computes the dot product of two single-precision floating-point vectors. * -* @param N number of values over which to compute the dot product +* @param N number of values * @param X first array * @param strideX X stride length * @param Y second array diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.f b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.f index 19ba4aa50370..f988e0b5d97c 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.f +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot.f @@ -1,7 +1,7 @@ !> ! @license Apache-2.0 ! -! Copyright (c) 2019 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. @@ -47,7 +47,7 @@ ! > ! > * 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 dot product +! @param {integer} N - number of values ! @param {Array} sx - first array ! @param {integer} strideX - `sx` stride length ! @param {Array} sy - second array @@ -119,4 +119,4 @@ real function sdot( N, sx, strideX, sy, strideY ) endif sdot = stemp return -end function sdot \ No newline at end of file +end function sdot diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_cblas.c b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_cblas.c index 5c2210726b57..6a7341ad396a 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_cblas.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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 dot product of two single-precision floating-point vectors. * -* @param N number of values over which to compute the dot product +* @param N number of values * @param X first array * @param strideX X stride length * @param Y second array diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_f.c b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_f.c index b06dd4bb26b9..de6503795422 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_f.c +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/sdot_f.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 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. @@ -29,7 +29,7 @@ * * Arguments are passed by reference to a Fortran subroutine implementing `sdot`. * -* @param N number of values over which to compute the dot product +* @param N number of values * @param X first array * @param strideX X stride length * @param Y second array diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/sdotsub.f b/lib/node_modules/@stdlib/blas/base/sdot/src/sdotsub.f index 9d81f38ae811..d0b8c87dd6f2 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/sdotsub.f +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/sdotsub.f @@ -1,7 +1,7 @@ !> ! @license Apache-2.0 ! -! Copyright (c) 2019 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 `sdot` as a subroutine. ! -! @param {integer} N - number of values over which to compute the dot product +! @param {integer} N - number of values ! @param {Array} sx - first array ! @param {integer} strideX - `sx` stride length ! @param {Array} sy - second array @@ -46,4 +46,4 @@ end function sdot ! Compute the dot product: dot = sdot( N, sx, strideX, sy, strideY ) return -end subroutine sdotsub \ No newline at end of file +end subroutine sdotsub