From f31ec8e387ab38eb017fe8fcefabbbf881ee2601 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Tue, 28 Jan 2025 21:34:33 +0530 Subject: [PATCH 1/4] refactor: updated stats/base/dsort2hp native addon from C++ to C --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../blas/ext/base/dsort2hp/include.gypi | 2 +- .../blas/ext/base/dsort2hp/manifest.json | 41 +++++ .../blas/ext/base/dsort2hp/src/addon.c | 46 +++++ .../blas/ext/base/dsort2hp/src/addon.cpp | 164 ------------------ 4 files changed, 88 insertions(+), 165 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.cpp diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/include.gypi index 868c5c12e852..26476a8c2655 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/include.gypi @@ -36,7 +36,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' + +/** +* Receives JavaScript callback invocation data. +* +* @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, 6 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, order, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 4 ); + API_SUFFIX(stdlib_strided_dsort2hp)( N, order, X, strideX, Y, strideY ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.cpp b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.cpp deleted file mode 100644 index 84e4cacc9ab4..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.cpp +++ /dev/null @@ -1,164 +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/ext/base/dsort2hp.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_ext_base_dsort2hp { - - /** - * Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first array using heapsort. - * - * ## Notes - * - * - When called from JavaScript, the function expects six arguments: - * - * - `N`: number of indexed elements - * - `order`: sort order - * - `X`: first input array - * - `strideX`: `X` stride length - * - `Y`: second input array - * - `strideY`: `Y` stride length - */ - napi_value node_dsort2hp( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 6; - napi_value argv[ 6 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 6 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 6 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; - } - - napi_valuetype vtype1; - status = napi_typeof( env, argv[ 1 ], &vtype1 ); - assert( status == napi_ok ); - if ( vtype1 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a number." ); - return nullptr; - } - - bool res2; - status = napi_is_typedarray( env, argv[ 2 ], &res2 ); - assert( status == napi_ok ); - if ( res2 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float64Array." ); - return nullptr; - } - - napi_valuetype vtype3; - status = napi_typeof( env, argv[ 3 ], &vtype3 ); - assert( status == napi_ok ); - if ( vtype3 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a number." ); - return nullptr; - } - - bool res4; - status = napi_is_typedarray( env, argv[ 4 ], &res4 ); - assert( status == napi_ok ); - if ( res4 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float64Array." ); - return nullptr; - } - - napi_valuetype vtype5; - status = napi_typeof( env, argv[ 5 ], &vtype5 ); - assert( status == napi_ok ); - if ( vtype5 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Sixth argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - double order; - status = napi_get_value_double( env, argv[ 1 ], &order ); - assert( status == napi_ok ); - - int64_t strideX; - status = napi_get_value_int64( env, argv[ 3 ], &strideX ); - assert( status == napi_ok ); - - int64_t strideY; - status = napi_get_value_int64( env, argv[ 5 ], &strideY ); - assert( status == napi_ok ); - - napi_typedarray_type vtype2; - size_t xlen; - void *X; - status = napi_get_typedarray_info( env, argv[ 2 ], &vtype2, &xlen, &X, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype2 != napi_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float64Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideX) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Third argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_typedarray_type vtype4; - size_t ylen; - void *Y; - status = napi_get_typedarray_info( env, argv[ 4 ], &vtype4, &ylen, &Y, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype4 != napi_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float64Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideY) >= (int64_t)ylen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Fifth argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - c_dsort2hp( N, order, (double *)X, strideX, (double *)Y, strideY ); - - return nullptr; - } - - napi_value Init( napi_env env, napi_value exports ) { - napi_status status; - napi_value fcn; - status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_dsort2hp, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_ext_base_dsort2hp From 891b3d1dd727d2471153159cb116822de5ec6469 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Tue, 28 Jan 2025 21:39:22 +0530 Subject: [PATCH 2/4] fix: changed tab with spaces --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../blas/ext/base/dsort2hp/manifest.json | 164 +++++++++--------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json index 02819e332825..6904c8769174 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json @@ -1,84 +1,84 @@ { - "options": {}, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/dsort2hp.c" - ], - "include": [ - "./include" - ], - "libraries": [ - "-lm" - ], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-positive-zero", - "@stdlib/napi/export", - "@stdlib/napi/argv", - "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-float", - "@stdlib/napi/argv-strided-float32array", - "@stdlib/napi/create-double" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/dsort2hp.c" - ], - "include": [ - "./include" - ], - "libraries": [ - "-lm" - ], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-positive-zero" - ] - }, - { - "task": "examples", - "src": [ - "./src/dsort2hp.c" - ], - "include": [ - "./include" - ], - "libraries": [ - "-lm" - ], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-positive-zero" - ] - } - ] + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/dsort2hp.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-float", + "@stdlib/napi/argv-strided-float32array", + "@stdlib/napi/create-double" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/dsort2hp.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-positive-zero" + ] + }, + { + "task": "examples", + "src": [ + "./src/dsort2hp.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-positive-zero" + ] + } + ] } From c2cd95983fee6d04296fdeb08a78f5bb02eecbcb Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Sun, 2 Feb 2025 13:21:20 +0530 Subject: [PATCH 3/4] chore: updated manifest file --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json | 3 ++- lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json index 6904c8769174..0c541ee8d306 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json @@ -39,10 +39,11 @@ "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/assert/is-positive-zero", "@stdlib/napi/export", + "@stdlib/blas/base/shared", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-float", - "@stdlib/napi/argv-strided-float32array", + "@stdlib/napi/argv-strided-float64array", "@stdlib/napi/create-double" ] }, diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c index ffc31bc2ffed..39766919f7fe 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c @@ -39,7 +39,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 4 ); - API_SUFFIX(stdlib_strided_dsort2hp)( N, order, X, strideX, Y, strideY ); + c_dsort2hp( N, order, X, strideX, Y, strideY ); return NULL; } From d6f506d3be5d5e5482ecd209c2ec5e0c8b0cc6f1 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Wed, 26 Feb 2025 11:08:13 +0530 Subject: [PATCH 4/4] chore: add argv double --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json | 2 +- lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json index 0c541ee8d306..3a52bbc349de 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/manifest.json @@ -42,7 +42,7 @@ "@stdlib/blas/base/shared", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-float", + "@stdlib/napi/argv-double", "@stdlib/napi/argv-strided-float64array", "@stdlib/napi/create-double" ] diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c index 39766919f7fe..c72462ae0c52 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/addon.c @@ -21,6 +21,7 @@ #include "stdlib/napi/export.h" #include "stdlib/napi/argv.h" #include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_double.h" #include "stdlib/napi/argv_strided_float64array.h" #include @@ -34,9 +35,9 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); - STDLIB_NAPI_ARGV_INT64( env, order, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 4 ); c_dsort2hp( N, order, X, strideX, Y, strideY );