Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
55ae65f
feat: add C ndarray interface and refactor implementation
aayush0325 Jan 15, 2025
483045f
fix: use CBLAS_INT instead of int32_t
aayush0325 Jan 15, 2025
35c57c4
refactor: update js implementation and tests
aayush0325 Jan 16, 2025
e49f048
fix: fix bugs
aayush0325 Jan 16, 2025
76732c8
refactor: update benchmarks, docs, examples
aayush0325 Jan 16, 2025
5352d04
docs: update readme
aayush0325 Jan 16, 2025
89874b2
chore: code review
aayush0325 Jan 17, 2025
29e4d14
docs: update examples
aayush0325 Jan 17, 2025
6905209
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
d628f06
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
8d9eb1f
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
7ce536f
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
3286c79
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
a2f5a64
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/README.md
aayush0325 Jan 17, 2025
2e6e724
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/lib/ndarray.js
aayush0325 Jan 17, 2025
696c3f2
Update lib/node_modules/@stdlib/stats/base/dnanmeanpw/src/main.c
aayush0325 Jan 17, 2025
473ceb6
chore: fix readme tests
aayush0325 Jan 18, 2025
756db93
docs: update examples
aayush0325 Jan 18, 2025
21b4bf0
style: enable lint rule
kgryte Jan 19, 2025
821d72b
style: disable ESLint rules
kgryte Jan 19, 2025
bc9fea3
refactor: avoid repeated temporary array allocation
kgryte Jan 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef STDLIB_STATS_BASE_DNANMEANPW_H
#define STDLIB_STATS_BASE_DNANMEANPW_H

#include <stdint.h>
#include "stdlib/blas/base/shared.h"

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
Expand All @@ -31,7 +31,12 @@ extern "C" {
/**
* Computes the arithmetic mean of a double-precision floating-point strided array, ignoring `NaN` values and using pairwise summation.
*/
double stdlib_strided_dnanmeanpw( const int64_t N, const double *X, const int64_t stride );
double API_SUFFIX(stdlib_strided_dnanmeanpw)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );

/**
* Computes the arithmetic mean of a double-precision floating-point strided array, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
*/
double API_SUFFIX(stdlib_strided_dnanmeanpw_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );

#ifdef __cplusplus
}
Expand Down
73 changes: 68 additions & 5 deletions lib/node_modules/@stdlib/stats/base/dnanmeanpw/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"options": {},
"options": {
"task": "build",
"wasm": false
},
"fields": [
{
"field": "src",
Expand All @@ -24,17 +27,77 @@
],
"confs": [
{
"task": "build",
"wasm": false,
"src": [
"./src/dnanmeanpw.c"
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [
"-lm"
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
"@stdlib/blas/ext/base/dnannsumpw",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
"@stdlib/napi/argv-strided-float64array",
"@stdlib/napi/create-double"
]
},
{
"task": "benchmark",
"wasm": false,
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
"@stdlib/blas/ext/base/dnannsumpw"
]
},
{
"task": "examples",
"wasm": false,
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
"@stdlib/blas/ext/base/dnannsumpw"
]
},
{
"task": "",
"wasm": true,
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
"@stdlib/blas/ext/base/dnannsumpw"
]
}
]
}
61 changes: 61 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dnanmeanpw/src/addon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* @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/dnanmeanpw.h"
#include "stdlib/blas/base/shared.h"
#include "stdlib/napi/export.h"
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.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, 3 );
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dnanmeanpw)( N, X, strideX ), v );
return v;
}

/**
* 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_method( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dnanmeanpw_ndarray)( N, X, strideX, offsetX ), v );
return v;
}

STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
117 changes: 0 additions & 117 deletions lib/node_modules/@stdlib/stats/base/dnanmeanpw/src/addon.cpp

This file was deleted.

Loading
Loading