Skip to content

Commit f2d9539

Browse files
feat: updated stats/base/dsmeanors native addon from C++ to C
--- 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 ---
1 parent a3cd058 commit f2d9539

File tree

4 files changed

+82
-118
lines changed

4 files changed

+82
-118
lines changed

lib/node_modules/@stdlib/stats/base/dsmeanors/include.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Source files:
3838
'src_files': [
39-
'<(src_dir)/addon.cpp',
39+
'<(src_dir)/addon.c',
4040
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
4141
],
4242

lib/node_modules/@stdlib/stats/base/dsmeanors/manifest.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,44 @@
2424
],
2525
"confs": [
2626
{
27+
"task": "build",
28+
"src": [
29+
"./src/dsmeanors.c"
30+
],
31+
"include": [
32+
"./include"
33+
],
34+
"libraries": [
35+
"-lm"
36+
],
37+
"libpath": [],
38+
"dependencies": [
39+
"@stdlib/blas/ext/base/dssumors",
40+
"@stdlib/napi/export",
41+
"@stdlib/napi/argv",
42+
"@stdlib/napi/argv-int64",
43+
"@stdlib/napi/argv-strided-float32array",
44+
"@stdlib/napi/create-double"
45+
]
46+
},
47+
{
48+
"task": "benchmark",
49+
"src": [
50+
"./src/dsmeanors.c"
51+
],
52+
"include": [
53+
"./include"
54+
],
55+
"libraries": [
56+
"-lm"
57+
],
58+
"libpath": [],
59+
"dependencies": [
60+
"@stdlib/blas/ext/base/dssumors"
61+
]
62+
},
63+
{
64+
"task": "examples",
2765
"src": [
2866
"./src/dsmeanors.c"
2967
],
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "stdlib/stats/base/dsmeanors.h"
20+
#include "stdlib/napi/export.h"
21+
#include "stdlib/napi/argv.h"
22+
#include "stdlib/napi/argv_int64.h"
23+
#include "stdlib/napi/argv_strided_float32array.h"
24+
#include "stdlib/napi/create_double.h"
25+
#include <node_api.h>
26+
27+
/**
28+
* Receives JavaScript callback invocation data.
29+
*
30+
* @param env environment under which the function is invoked
31+
* @param info callback data
32+
* @return Node-API value
33+
*/
34+
static napi_value addon( napi_env env, napi_callback_info info ) {
35+
STDLIB_NAPI_ARGV( env, info, argv, argc, 3 );
36+
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
37+
STDLIB_NAPI_ARGV_INT64( env, stride, argv, 2 );
38+
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, stride, argv, 1 );
39+
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dsmeanors( N, X, stride ), v );
40+
return v;
41+
}
42+
43+
STDLIB_NAPI_MODULE_EXPORT_FCN( addon )

lib/node_modules/@stdlib/stats/base/dsmeanors/src/addon.cpp

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)