-
-
Notifications
You must be signed in to change notification settings - Fork 907
refactor: update stats/base/snanvariancepn native addon from C++ to C #4515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,5 +1,7 @@ | ||||
{ | ||||
"options": {}, | ||||
"options": { | ||||
"task": "build" | ||||
}, | ||||
"fields": [ | ||||
{ | ||||
"field": "src", | ||||
|
@@ -24,6 +26,42 @@ | |||
], | ||||
"confs": [ | ||||
{ | ||||
"task": "build", | ||||
"src": [ | ||||
"./src/snanvariancepn.c" | ||||
], | ||||
"include": [ | ||||
"./include" | ||||
], | ||||
"libraries": [ | ||||
"-lm" | ||||
], | ||||
"libpath": [], | ||||
"dependencies": [ | ||||
"@stdlib/stats/base/snanvariancepn", | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This introduces a circular dependency. |
||||
"@stdlib/napi/export", | ||||
"@stdlib/napi/argv", | ||||
"@stdlib/napi/argv-int64", | ||||
"@stdlib/napi/argv-strided-float32array", | ||||
"@stdlib/napi/create-double" | ||||
] | ||||
}, | ||||
{ | ||||
"task": "benchmark", | ||||
"src": [ | ||||
"./src/snanvariancepn.c" | ||||
], | ||||
"include": [ | ||||
"./include" | ||||
], | ||||
"libraries": [ | ||||
"-lm" | ||||
], | ||||
"libpath": [], | ||||
"dependencies": [] | ||||
}, | ||||
{ | ||||
"task": "examples", | ||||
"src": [ | ||||
"./src/snanvariancepn.c" | ||||
], | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2025 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/snanvariancepn.h" | ||
#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 "stdlib/napi/create_double.h" | ||
#include <node_api.h> | ||
|
||
/** | ||
* 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, 5 ); | ||
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); | ||
STDLIB_NAPI_ARGV_INT64( env, stride, argv, 4 ); | ||
STDLIB_NAPI_ARGV_DOUBLE( env, mean, argv, 1 ); | ||
STDLIB_NAPI_ARGV_DOUBLE( env, correction, argv, 2 ); | ||
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, stride, argv, 3 ); | ||
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dvarmpn( N, mean, correction, X, stride ), v ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is very clearly incorrect. The function is not the right function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please study the original |
||
return v; | ||
} | ||
|
||
STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.