From 04272d1264c1f7568b9a6d2153a7c7e04d89f0a8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Dec 2024 02:59:34 +0000 Subject: [PATCH] Auto-generated commit --- .editorconfig | 2 +- .github/.keepalive | 1 - CHANGELOG.md | 6 ++- CONTRIBUTORS | 39 ++++++++------- include.gypi | 2 +- manifest.json | 42 +++++++++++++++- package.json | 5 ++ src/addon.c | 43 +++++++++++++++++ src/addon.cpp | 117 --------------------------------------------- 9 files changed, 118 insertions(+), 139 deletions(-) delete mode 100644 .github/.keepalive create mode 100644 src/addon.c delete mode 100644 src/addon.cpp diff --git a/.editorconfig b/.editorconfig index 60d743f..0779e8a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -121,7 +121,7 @@ indent_style = tab [*.{md,md.txt}] indent_style = space indent_size = 4 -trim_trailing_whitespace = false +trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. # Set properties for `usage.txt` files: [usage.txt] diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6ffec00..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T04:46:16.822Z diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5e561..af2974e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-12-01) +## Unreleased (2024-12-21)
@@ -12,6 +12,7 @@
+- [`1a7bfb6`](https://github.com/stdlib-js/stdlib/commit/1a7bfb650c61d686bde53fda82476edb5c29cafd) - **refactor:** update `stats/base/dmeanli` native addon from C++ to C [(#4097)](https://github.com/stdlib-js/stdlib/pull/4097) _(by Aayush Khanna)_ - [`9e689ff`](https://github.com/stdlib-js/stdlib/commit/9e689ffcb7c6223afc521f1e574b42f10921cf5e) - **chore:** fix indentation in manifest.json files _(by Philipp Burckhardt)_
@@ -24,8 +25,9 @@ ### Contributors -A total of 1 person contributed to this release. Thank you to this contributor: +A total of 2 people contributed to this release. Thank you to the following contributors: +- Aayush Khanna - Philipp Burckhardt
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a8d0bb6..173c07b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,11 +2,14 @@ # # Contributors listed in alphabetical order. +Aadish Jain Aayush Khanna Abhijit Raut Adarsh Palaskar Aditya Sapra -AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> +Ahmed Atwa +Ahmed Kashkoush +Ahmed Khaled Aleksandr <112382387+alextes90@users.noreply.github.com> Ali Salesi Aman Bhansali @@ -23,6 +26,8 @@ Dan Rose Daniel Killenberger Daniel Yu <40680511+Daniel777y@users.noreply.github.com> Debashis Maharana +Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com> +Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com> Dominic Lim <46486515+domlimm@users.noreply.github.com> Dominik Moritz Dorrin Sotoudeh @@ -45,12 +50,12 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison Karthik Prakash <116057817+skoriop@users.noreply.github.com> -Khaldon Kohantika Nath <145763549+kohantikanath@users.noreply.github.com> Krishnendu Das <86651039+itskdhere@users.noreply.github.com> Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com> -Lovelin <100030865+lovelindhoni@users.noreply.github.com> +Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com> Manik Sharma +Manvith M <148960168+manvith2003@users.noreply.github.com> Marcus Fantham Matt Cochrane Mihir Pandit <129577900+MSP20086@users.noreply.github.com> @@ -59,37 +64,41 @@ Mohammad Kaif Momtchil Momtchev Muhammad Haris Naresh Jagadeesan +Naveen Kumar Neeraj Pathak -NightKnight +Nishant Shinde <97207366+nishant-s7@users.noreply.github.com> Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com> Ognjen Jevremović Oneday12323 <107678750+Oneday12323@users.noreply.github.com> +Ori Miles <97595296+orimiles5@users.noreply.github.com> Philipp Burckhardt Prajwal Kulkarni Pranav Goswami -Praneki <97080887+PraneGIT@users.noreply.github.com> -Pratik <97464067+Pratik772846@users.noreply.github.com> +Pranjal Jha <97080887+PraneGIT@users.noreply.github.com> +Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com> +Pratik Singh <97464067+Pratik772846@users.noreply.github.com> Pratyush Kumar Chouhan -Priyansh <88396544+itsspriyansh@users.noreply.github.com> +Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com> +Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com> Pushpendra Chandravanshi -RISHAV <115060907+rishav2404@users.noreply.github.com> Raunak Kumar Gupta Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com> Ricky Reusser Ridam Garg <67867319+RidamGarg@users.noreply.github.com> +Rishav <115060907+rishav2404@users.noreply.github.com> Robert Gislason Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> -Rutam <138517416+performant23@users.noreply.github.com> +Rutam Kathale <138517416+performant23@users.noreply.github.com> Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com> Ryan Seal Rylan Yang <137365285+rylany27@users.noreply.github.com> Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com> -SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com> +Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com> Saurabh Singh Seyyed Parsa Neshaei Shashank Shekhar Singh -Shivam <11shivam00@gmail.com> +Shivam Ahir <11shivam00@gmail.com> Shraddheya Shendre Shubh Mehta <93862397+Shubh942@users.noreply.github.com> Shubham Mishra @@ -98,7 +107,7 @@ Snehil Shah Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com> Spandan Barve Stephannie Jiménez Gacha -Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com> +Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com> Tirtadwipa Manunggal Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com> @@ -108,12 +117,10 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com> Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com> Varad Gupta Vinit Pandit <106718914+MeastroZI@users.noreply.github.com> +Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com> Xiaochuan Ye +Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com> Yernar Yergaziyev -naveen -nishant-s7 <97207366+nishant-s7@users.noreply.github.com> olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com> -orimiles5 <97595296+orimiles5@users.noreply.github.com> rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu -yaswanth <116426380+yaswanthkosuru@users.noreply.github.com> diff --git a/include.gypi b/include.gypi index 2fa318f..9212937 100644 --- a/include.gypi +++ b/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, 3 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, stride, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, stride, argv, 1 ); + STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dmeanli( N, X, stride ), v ); + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/src/addon.cpp b/src/addon.cpp deleted file mode 100644 index 9bdb904..0000000 --- a/src/addon.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/stats/base/dmeanli.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_stats_base_dmeanli { - - /** - * Computes the arithmetic mean of a double-precision floating-point strided array using a one-pass trial mean algorithm. - * - * ## Notes - * - * - When called from JavaScript, the function expects three arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `stride`: stride length - */ - napi_value node_dmeanli( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 3; - napi_value argv[ 3 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 3 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 3 arguments." ); - return nullptr; - } - - napi_valuetype vtype0; - status = napi_typeof( env, argv[ 0 ], &vtype0 ); - assert( status == napi_ok ); - if ( vtype0 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." ); - return nullptr; - } - - bool res; - status = napi_is_typedarray( env, argv[ 1 ], &res ); - assert( status == napi_ok ); - if ( res == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float64Array." ); - return nullptr; - } - - napi_valuetype vtype2; - status = napi_typeof( env, argv[ 2 ], &vtype2 ); - assert( status == napi_ok ); - if ( vtype2 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - int64_t stride; - status = napi_get_value_int64( env, argv[ 2 ], &stride ); - 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_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float64Array." ); - return nullptr; - } - if ( (N-1)*llabs(stride) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Second argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_value v; - status = napi_create_double( env, stdlib_strided_dmeanli( N, (double *)X, stride ), &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_dmeanli, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_stats_base_dmeanli