From c79ce362d3dd7a7c331bcc3b2a8eccef23c7e675 Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 09:50:41 +0530 Subject: [PATCH 01/13] update readme --- .../@stdlib/blas/base/sdot/README.md | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) 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 ); From e9027b7e899f945d00a41cdd14c76533a8451cae Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:31:57 +0530 Subject: [PATCH 02/13] refactor src/ --- .../@stdlib/blas/base/sdot/src/addon.c | 50 ++++++ .../@stdlib/blas/base/sdot/src/addon.cpp | 153 ------------------ .../@stdlib/blas/base/sdot/src/sdot.c | 4 +- .../@stdlib/blas/base/sdot/src/sdot.f | 6 +- .../@stdlib/blas/base/sdot/src/sdot_cblas.c | 4 +- .../@stdlib/blas/base/sdot/src/sdot_f.c | 4 +- .../@stdlib/blas/base/sdot/src/sdotsub.f | 6 +- 7 files changed, 62 insertions(+), 165 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/sdot/src/addon.c delete mode 100644 lib/node_modules/@stdlib/blas/base/sdot/src/addon.cpp diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c new file mode 100644 index 000000000000..695843ac1f76 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_strided_float32array.h" +#include + + +/** +* 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 ); + + 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 From 6f15ab28c7d7c06d0457ea84f62b106f77e3c187 Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:32:35 +0530 Subject: [PATCH 03/13] update include.gypi --- lib/node_modules/@stdlib/blas/base/sdot/include.gypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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', ' Date: Sun, 22 Jan 2023 10:33:25 +0530 Subject: [PATCH 04/13] update manifest.json --- .../@stdlib/blas/base/sdot/manifest.json | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sdot/manifest.json b/lib/node_modules/@stdlib/blas/base/sdot/manifest.json index 3d8ee29336d1..08a51810ce79 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/sdot/manifest.json @@ -39,7 +39,12 @@ ], "libraries": [], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] }, { "os": "linux", @@ -55,7 +60,12 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] }, { "os": "mac", @@ -70,7 +80,12 @@ ], "libraries": [], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] }, { "os": "mac", @@ -85,7 +100,12 @@ "-lblas" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] }, { "os": "mac", @@ -101,7 +121,12 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] }, { "os": "win", @@ -114,7 +139,12 @@ ], "libraries": [], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float32array" + ] } ] } From 6ca4bb32a506b46aca98c11f0417eceb4302bb8c Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:33:58 +0530 Subject: [PATCH 05/13] update package.json --- lib/node_modules/@stdlib/blas/base/sdot/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/sdot/package.json b/lib/node_modules/@stdlib/blas/base/sdot/package.json index 41ee676f175a..db8707591822 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/package.json +++ b/lib/node_modules/@stdlib/blas/base/sdot/package.json @@ -77,5 +77,8 @@ "float", "single", "float32array" - ] + ], + "__stdlib__": { + "wasm": false + } } From 534c32f9cd3d0dc83165d83644021eb7e138188c Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:36:05 +0530 Subject: [PATCH 06/13] update addon.c --- lib/node_modules/@stdlib/blas/base/sdot/src/addon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c index 695843ac1f76..784ed8c71234 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c @@ -33,6 +33,8 @@ * @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 ); From 1d10ae9c40333fcac228d33156dad30972cc7499 Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:39:21 +0530 Subject: [PATCH 07/13] refactor lib/ --- .../@stdlib/blas/base/sdot/lib/ndarray.js | 6 ++--- .../blas/base/sdot/lib/ndarray.native.js | 24 +++++++++---------- .../@stdlib/blas/base/sdot/lib/sdot.js | 6 ++--- .../@stdlib/blas/base/sdot/lib/sdot.native.js | 6 ++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js index bf20d7c7cbb3..d956a6535d7c 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/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. @@ -28,14 +28,14 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); /** * Computes the dot product of `x` and `y`. * -* @param {integer} N - number of values over which to compute the dot product +* @param {integer} N - number of values * @param {Float32Array} x - first input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting index for `y` -* @returns {number} dot product of `x` and `y` +* @returns {number} output array * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js index fd8852f9f84b..83337576720e 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/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. @@ -20,7 +20,8 @@ // MODULES // -var Float32Array = require( '@stdlib/array/float32' ); +var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' ); +var offsetView = require( '@stdlib/strided/base/offset-view' ); var addon = require( './sdot.native.js' ); @@ -29,14 +30,14 @@ var addon = require( './sdot.native.js' ); /** * Computes the dot product of `x` and `y`. * -* @param {integer} N - number of values over which to compute the dot product +* @param {integer} N - number of values * @param {Float32Array} x - first input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting index for `y` -* @returns {number} dot product of `x` and `y` +* @returns {number} output array * * @example * var Float32Array = require( '@stdlib/array/float32' ); @@ -50,14 +51,13 @@ var addon = require( './sdot.native.js' ); function sdot( N, x, strideX, offsetX, y, strideY, offsetY ) { var viewX; var viewY; - if ( strideX < 0 ) { - offsetX += (N-1) * strideX; - } - if ( strideY < 0 ) { - offsetY += (N-1) * strideY; - } - viewX = new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offsetX), x.length-offsetX ); // eslint-disable-line max-len - viewY = new Float32Array( y.buffer, y.byteOffset+(y.BYTES_PER_ELEMENT*offsetY), y.length-offsetY ); // eslint-disable-line max-len + + offsetX = minViewBufferIndex( N, strideX, offsetX ); + offsetY = minViewBufferIndex( N, strideY, offsetY ); + + viewX = offsetView( x, offsetX ); + viewY = offsetView( y, offsetY ); + return addon( N, viewX, strideX, viewY, strideY ); } diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js index 3805f8dfe640..7dba08103434 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.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. @@ -28,12 +28,12 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); /** * Computes the dot product of `x` and `y`. * -* @param {PositiveInteger} N - number of values over which to compute the dot product +* @param {PositiveInteger} N - number of values * @param {Float32Array} x - first input array * @param {integer} strideX - `x` stride length * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length -* @returns {number} dot product of `x` and `y` +* @returns {number} output array * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js index 890a10cdf605..c66aaa9ba428 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.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. @@ -28,12 +28,12 @@ var addon = require( './../src/addon.node' ); /** * Computes the dot product of `x` and `y`. * -* @param {PositiveInteger} N - number of values over which to compute the dot product +* @param {PositiveInteger} N - number of values * @param {Float32Array} x - first input array * @param {integer} strideX - `x` stride length * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length -* @returns {number} dot product of `x` and `y` +* @returns {number} output array * * @example * var Float32Array = require( '@stdlib/array/float32' ); From 97bac795083ee02e1a386305e02802972b1ec19a Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:40:39 +0530 Subject: [PATCH 08/13] refactor examples/ --- .../@stdlib/blas/base/sdot/examples/index.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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..e1f801e2e485 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js @@ -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 ); From 25b2056d13ef02d9b35c35c6d6640361fe023b0b Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:43:53 +0530 Subject: [PATCH 09/13] refactor benchmarks/ --- .../blas/base/sdot/benchmark/benchmark.js | 23 ++++++++----------- .../base/sdot/benchmark/benchmark.native.js | 19 +++++---------- .../base/sdot/benchmark/benchmark.ndarray.js | 23 ++++++++----------- .../benchmark/benchmark.ndarray.native.js | 19 +++++---------- .../@stdlib/blas/base/sdot/examples/index.js | 2 +- 5 files changed, 33 insertions(+), 53 deletions(-) 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/examples/index.js b/lib/node_modules/@stdlib/blas/base/sdot/examples/index.js index e1f801e2e485..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. From fd27143b2368900c0dbfc01a39e86f55cd110143 Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 22 Jan 2023 10:49:39 +0530 Subject: [PATCH 10/13] refactor docs/ --- .../@stdlib/blas/base/sdot/docs/repl.txt | 22 ++++++++----------- .../blas/base/sdot/docs/types/index.d.ts | 14 ++++++------ 2 files changed, 16 insertions(+), 20 deletions(-) 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..eceb2b52fa9d 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`. + Output array. 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,8 +51,7 @@ > 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 ) @@ -61,7 +59,7 @@ 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 + 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`. + Output array. 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..dc5f8a0b37c0 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 output array * * @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 output array * * @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 output array * * @example * var Float32Array = require( `@stdlib/array/float32` ); From 8a50e5b9f871b73b07dc085d8e4b4239bc7bd17f Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Wed, 22 Feb 2023 14:22:07 +0530 Subject: [PATCH 11/13] update description --- lib/node_modules/@stdlib/blas/base/sdot/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js | 2 +- lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js | 2 +- lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js | 2 +- lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 dc5f8a0b37c0..7b279707eca7 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 @@ -30,7 +30,7 @@ interface Routine { * @param strideX - `x` stride length * @param y - second input array * @param strideY - `y` stride length - * @returns output array + * @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js index d956a6535d7c..512bbcbeb61e 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.js @@ -35,7 +35,7 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting index for `y` -* @returns {number} output array +* @returns {number} dot product * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js index 83337576720e..2458a7b1517a 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/ndarray.native.js @@ -37,7 +37,7 @@ var addon = require( './sdot.native.js' ); * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting index for `y` -* @returns {number} output array +* @returns {number} dot product * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js index 7dba08103434..7dcf05835286 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.js @@ -33,7 +33,7 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); * @param {integer} strideX - `x` stride length * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length -* @returns {number} output array +* @returns {number} dot product * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js index c66aaa9ba428..a359647cd5fa 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js +++ b/lib/node_modules/@stdlib/blas/base/sdot/lib/sdot.native.js @@ -33,7 +33,7 @@ var addon = require( './../src/addon.node' ); * @param {integer} strideX - `x` stride length * @param {Float32Array} y - second input array * @param {integer} strideY - `y` stride length -* @returns {number} output array +* @returns {number} dot product * * @example * var Float32Array = require( '@stdlib/array/float32' ); From 659b8043974afbf6571c1b7a15162bbd0d321b2f Mon Sep 17 00:00:00 2001 From: Pranavchiku Date: Sun, 26 Feb 2023 14:34:46 +0530 Subject: [PATCH 12/13] add missing code review changes --- lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 eceb2b52fa9d..994cc2d51f04 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` and stride parameters determine which elements in the - strided arrays 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. @@ -54,13 +54,13 @@ > 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 offset parameters support indexing based on a - starting index. + buffer, the offset parameters support indexing based on a starting index. Parameters ---------- From ef4211e3dfba483135ce3c71aad0aeda58dc7611 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 28 Feb 2023 16:21:42 -0800 Subject: [PATCH 13/13] Apply suggestions from code review --- lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt | 4 ++-- lib/node_modules/@stdlib/blas/base/sdot/docs/types/index.d.ts | 4 ++-- lib/node_modules/@stdlib/blas/base/sdot/src/addon.c | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) 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 994cc2d51f04..60b3a63e1408 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sdot/docs/repl.txt @@ -30,7 +30,7 @@ Returns ------- dot: float - Output array. + The dot product. Examples -------- @@ -88,7 +88,7 @@ Returns ------- dot: float - Output array. + The dot product. Examples -------- 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 7b279707eca7..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 @@ -53,7 +53,7 @@ interface Routine { * @param y - second input array * @param strideY - `y` stride length * @param offsetY - starting index for `y` - * @returns output array + * @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); @@ -75,7 +75,7 @@ interface Routine { * @param strideX - `x` stride length * @param y - second input array * @param strideY - `y` stride length -* @returns output array +* @returns dot product * * @example * var Float32Array = require( `@stdlib/array/float32` ); diff --git a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c index 784ed8c71234..b0ccd29cd5c3 100644 --- a/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/sdot/src/addon.c @@ -23,7 +23,6 @@ #include "stdlib/napi/argv_strided_float32array.h" #include - /** * Receives JavaScript callback invocation data. *