@stdlib/blas-ext-base-dsnansum 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -59,7 +59,7 @@ npm install @stdlib/blas-ext-base-dsnansum
59
59
  var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );
60
60
  ```
61
61
 
62
- #### dsnansum( N, x, stride )
62
+ #### dsnansum( N, x, strideX )
63
63
 
64
64
  Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.
65
65
 
@@ -67,9 +67,8 @@ Computes the sum of single-precision floating-point strided array elements, igno
67
67
  var Float32Array = require( '@stdlib/array-float32' );
68
68
 
69
69
  var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
70
- var N = x.length;
71
70
 
72
- var v = dsnansum( N, x, 1 );
71
+ var v = dsnansum( x.length, x, 1 );
73
72
  // returns 1.0
74
73
  ```
75
74
 
@@ -77,9 +76,9 @@ The function has the following parameters:
77
76
 
78
77
  - **N**: number of indexed elements.
79
78
  - **x**: input [`Float32Array`][@stdlib/array/float32].
80
- - **stride**: index increment for `x`.
79
+ - **strideX**: stride length for `x`.
81
80
 
82
- The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in `x`,
81
+ The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element:
83
82
 
84
83
  ```javascript
85
84
  var Float32Array = require( '@stdlib/array-float32' );
@@ -104,24 +103,24 @@ var v = dsnansum( 4, x1, 2 );
104
103
  // returns 5.0
105
104
  ```
106
105
 
107
- #### dsnansum.ndarray( N, x, stride, offset )
106
+ #### dsnansum.ndarray( N, x, strideX, offsetX )
108
107
 
109
- Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using extended accumulation and alternative indexing semantics.
108
+ Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation and alternative indexing semantics, and returning an extended precision result.
110
109
 
111
110
  ```javascript
112
111
  var Float32Array = require( '@stdlib/array-float32' );
113
112
 
114
113
  var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
115
114
 
116
- var v = dsnansum.ndarray( 4, x, 1, 0 );
115
+ var v = dsnansum.ndarray( x.length, x, 1, 0 );
117
116
  // returns 1.0
118
117
  ```
119
118
 
120
119
  The function has the following additional parameters:
121
120
 
122
- - **offset**: starting index for `x`.
121
+ - **offsetX**: starting index for `x`.
123
122
 
124
- While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the sum of every other value in `x` starting from the second value
123
+ While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the sum of every other element starting from the second element:
125
124
 
126
125
  ```javascript
127
126
  var Float32Array = require( '@stdlib/array-float32' );
@@ -159,14 +158,14 @@ var discreteUniform = require( '@stdlib/random-base-discrete-uniform' );
159
158
  var filledarrayBy = require( '@stdlib/array-filled-by' );
160
159
  var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );
161
160
 
162
- function clbk() {
161
+ function rand() {
163
162
  if ( bernoulli( 0.7 ) > 0 ) {
164
163
  return discreteUniform( -10, 10 );
165
164
  }
166
165
  return NaN;
167
166
  }
168
167
 
169
- var x = filledarrayBy( 10, 'float64', clbk );
168
+ var x = filledarrayBy( 10, 'float32', rand );
170
169
  console.log( x );
171
170
 
172
171
  var v = dsnansum( x.length, x, 1 );
@@ -177,6 +176,123 @@ console.log( v );
177
176
 
178
177
  <!-- /.examples -->
179
178
 
179
+ <!-- C interface documentation. -->
180
+
181
+ * * *
182
+
183
+ <section class="c">
184
+
185
+ ## C APIs
186
+
187
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
188
+
189
+ <section class="intro">
190
+
191
+ </section>
192
+
193
+ <!-- /.intro -->
194
+
195
+ <!-- C usage documentation. -->
196
+
197
+ <section class="usage">
198
+
199
+ ### Usage
200
+
201
+ ```c
202
+ #include "stdlib/blas/ext/base/dsnansum.h"
203
+ ```
204
+
205
+ #### stdlib_strided_dsnansum( N, \*X, strideX )
206
+
207
+ Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.
208
+
209
+ ```c
210
+ const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
211
+
212
+ double v = stdlib_strided_dsnansum( 4, x, 1 );
213
+ // returns 1.0
214
+ ```
215
+
216
+ The function accepts the following arguments:
217
+
218
+ - **N**: `[in] CBLAS_INT` number of indexed elements.
219
+ - **X**: `[in] float*` input array.
220
+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
221
+
222
+ ```c
223
+ double stdlib_strided_dsnansum( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
224
+ ```
225
+
226
+ #### stdlib_strided_dsnansum_ndarray( N, \*X, strideX, offsetX )
227
+
228
+ Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation and alternative indexing semantics, and returning an extended precision result.
229
+
230
+ ```c
231
+ const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
232
+
233
+ double v = stdlib_strided_dsnansum_ndarray( 4, x, 1, 0 );
234
+ // returns 1.0
235
+ ```
236
+
237
+ The function accepts the following arguments:
238
+
239
+ - **N**: `[in] CBLAS_INT` number of indexed elements.
240
+ - **X**: `[in] float*` input array.
241
+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
242
+ - **offsetX**: `[in] CBLAS_INT` starting index for `X`.
243
+
244
+ ```c
245
+ double stdlib_strided_dsnansum_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
246
+ ```
247
+
248
+ </section>
249
+
250
+ <!-- /.usage -->
251
+
252
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
253
+
254
+ <section class="notes">
255
+
256
+ </section>
257
+
258
+ <!-- /.notes -->
259
+
260
+ <!-- C API usage examples. -->
261
+
262
+ <section class="examples">
263
+
264
+ ### Examples
265
+
266
+ ```c
267
+ #include "stdlib/blas/ext/base/dsnansum.h"
268
+ #include <stdio.h>
269
+
270
+ int main( void ) {
271
+ // Create a strided array:
272
+ const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0f/0.0f, 0.0f/0.0f };
273
+
274
+ // Specify the number of elements:
275
+ const int N = 5;
276
+
277
+ // Specify the stride length:
278
+ const int strideX = 2;
279
+
280
+ // Compute the sum:
281
+ double v = stdlib_strided_dsnansum( N, x, strideX );
282
+
283
+ // Print the result:
284
+ printf( "sum: %lf\n", v );
285
+ }
286
+ ```
287
+
288
+ </section>
289
+
290
+ <!-- /.examples -->
291
+
292
+ </section>
293
+
294
+ <!-- /.c -->
295
+
180
296
  <section class="references">
181
297
 
182
298
  </section>
@@ -191,7 +307,7 @@ console.log( v );
191
307
 
192
308
  ## See Also
193
309
 
194
- - <span class="package-name">[`@stdlib/stats-base/dsnanmean`][@stdlib/stats/base/dsnanmean]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a single-precision floating-point strided array, ignoring NaN values, using extended accumulation, and returning an extended precision result.</span>
310
+ - <span class="package-name">[`@stdlib/stats-strided/dsnanmean`][@stdlib/stats/strided/dsnanmean]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a single-precision floating-point strided array, ignoring NaN values, using extended accumulation, and returning an extended precision result.</span>
195
311
  - <span class="package-name">[`@stdlib/blas-ext/base/dssum`][@stdlib/blas/ext/base/dssum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements using extended accumulation and returning an extended precision result.</span>
196
312
  - <span class="package-name">[`@stdlib/blas-ext/base/sdsnansum`][@stdlib/blas/ext/base/sdsnansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using extended accumulation.</span>
197
313
  - <span class="package-name">[`@stdlib/blas-ext/base/snansum`][@stdlib/blas/ext/base/snansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values.</span>
@@ -226,7 +342,7 @@ See [LICENSE][stdlib-license].
226
342
 
227
343
  ## Copyright
228
344
 
229
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
345
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
230
346
 
231
347
  </section>
232
348
 
@@ -239,8 +355,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
239
355
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsnansum.svg
240
356
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsnansum
241
357
 
242
- [test-image]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml/badge.svg?branch=v0.2.2
243
- [test-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml?query=branch:v0.2.2
358
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml/badge.svg?branch=v0.3.0
359
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml?query=branch:v0.3.0
244
360
 
245
361
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsnansum/main.svg
246
362
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsnansum?branch=main
@@ -252,8 +368,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
252
368
 
253
369
  -->
254
370
 
255
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
256
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
371
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
372
+ [chat-url]: https://stdlib.zulipchat.com
257
373
 
258
374
  [stdlib]: https://github.com/stdlib-js/stdlib
259
375
 
@@ -278,7 +394,7 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
278
394
 
279
395
  <!-- <related-links> -->
280
396
 
281
- [@stdlib/stats/base/dsnanmean]: https://www.npmjs.com/package/@stdlib/stats-base-dsnanmean
397
+ [@stdlib/stats/strided/dsnanmean]: https://www.npmjs.com/package/@stdlib/stats-strided-dsnanmean
282
398
 
283
399
  [@stdlib/blas/ext/base/dssum]: https://www.npmjs.com/package/@stdlib/blas-ext-base-dssum
284
400
 
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var a=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=a(function(b,u){
2
- var c=require('@stdlib/blas-ext-base-dsnansumpw/dist');function y(e,r,s){return c(e,r,s)}u.exports=y
3
- });var v=a(function(g,t){
4
- var x=require('@stdlib/blas-ext-base-dsnansumpw/dist').ndarray;function f(e,r,s,p){return x(e,r,s,p)}t.exports=f
5
- });var m=a(function(h,q){
6
- var j=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=i(),l=v();j(d,"ndarray",l);q.exports=d
7
- });var w=require("path").join,R=require('@stdlib/utils-try-require/dist'),_=require('@stdlib/assert-is-error/dist'),E=m(),n,o=R(w(__dirname,"./native.js"));_(o)?n=E:n=o;module.exports=n;
1
+ "use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var n=s(function(g,u){
2
+ var p=require('@stdlib/blas-ext-base-dsnansumpw/dist').ndarray;function y(e,r,a,c){return p(e,r,a,c)}u.exports=y
3
+ });var v=s(function(h,t){
4
+ var f=require('@stdlib/strided-base-stride2offset/dist'),x=n();function j(e,r,a){return x(e,r,a,f(e,a))}t.exports=j
5
+ });var o=s(function(k,q){
6
+ var l=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=v(),R=n();l(d,"ndarray",R);q.exports=d
7
+ });var _=require("path").join,w=require('@stdlib/utils-try-require/dist'),E=require('@stdlib/assert-is-error/dist'),O=o(),i,m=w(_(__dirname,"./native.js"));E(m)?i=O:i=m;module.exports=i;
8
8
  /** @license Apache-2.0 */
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../lib/dsnansum.js", "../lib/ndarray.js", "../lib/main.js", "../lib/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' );\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} stride - stride length\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n* var N = x.length;\n*\n* var v = dsnansum( N, x, 1 );\n* // returns 1.0\n*/\nfunction dsnansum( N, x, stride ) {\n\treturn dsnansumpw( N, x, stride );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' ).ndarray;\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );\n*\n* var v = dsnansum( 5, x, 2, 1 );\n* // returns 5.0\n*/\nfunction dsnansum( N, x, stride, offset ) {\n\treturn dsnansumpw( N, x, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dsnansum = require( './dsnansum.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsnansum, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @module @stdlib/blas-ext-base-dsnansum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n* var N = x.length;\n*\n* var v = dsnansum( N, x, 1 );\n* // returns 1.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );\n*\n* var v = dsnansum.ndarray( 5, x, 2, 1 );\n* // returns 5.0\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dsnansum;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsnansum = main;\n} else {\n\tdsnansum = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n\n// exports: { \"ndarray\": \"dsnansum.ndarray\" }\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAsB7D,SAASC,EAAUC,EAAGC,EAAGC,EAAS,CACjC,OAAOJ,EAAYE,EAAGC,EAAGC,CAAO,CACjC,CAKAL,EAAO,QAAUE,ICnDjB,IAAAI,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAsB/D,SAASC,EAAUC,EAAGC,EAAGC,EAAQC,EAAS,CACzC,OAAOL,EAAYE,EAAGC,EAAGC,EAAQC,CAAO,CACzC,CAKAN,EAAO,QAAUE,ICnDjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAW,IACXC,EAAU,IAKdF,EAAaC,EAAU,UAAWC,CAAQ,EAK1CH,EAAO,QAAUE,ICajB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAAWD,EAEXC,EAAWC,EAMZ,OAAO,QAAUD",
6
- "names": ["require_dsnansum", "__commonJSMin", "exports", "module", "dsnansumpw", "dsnansum", "N", "x", "stride", "require_ndarray", "__commonJSMin", "exports", "module", "dsnansumpw", "dsnansum", "N", "x", "stride", "offset", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsnansum", "ndarray", "join", "tryRequire", "isError", "main", "dsnansum", "tmp"]
3
+ "sources": ["../lib/ndarray.js", "../lib/dsnansum.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' ).ndarray;\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} strideX - stride length\n* @param {NonNegativeInteger} offsetX - starting index\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );\n*\n* var v = dsnansum( 5, x, 2, 1 );\n* // returns 5.0\n*/\nfunction dsnansum( N, x, strideX, offsetX ) {\n\treturn dsnansumpw( N, x, strideX, offsetX );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar stride2offset = require( '@stdlib/strided-base-stride2offset' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} strideX - stride length\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n\n* var v = dsnansum( x.length, x, 1 );\n* // returns 1.0\n*/\nfunction dsnansum( N, x, strideX ) {\n\treturn ndarray( N, x, strideX, stride2offset( N, strideX) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dsnansum = require( './dsnansum.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsnansum, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @module @stdlib/blas-ext-base-dsnansum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n*\n* var v = dsnansum( x.length, x, 1 );\n* // returns 1.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );\n*\n* var v = dsnansum.ndarray( 5, x, 2, 1 );\n* // returns 5.0\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dsnansum;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsnansum = main;\n} else {\n\tdsnansum = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n\n// exports: { \"ndarray\": \"dsnansum.ndarray\" }\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAsB/D,SAASC,EAAUC,EAAGC,EAAGC,EAASC,EAAU,CAC3C,OAAOL,EAAYE,EAAGC,EAAGC,EAASC,CAAQ,CAC3C,CAKAN,EAAO,QAAUE,ICnDjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAU,IAqBd,SAASC,EAAUC,EAAGC,EAAGC,EAAU,CAClC,OAAOJ,EAASE,EAAGC,EAAGC,EAASL,EAAeG,EAAGE,CAAO,CAAE,CAC3D,CAKAN,EAAO,QAAUG,ICnDjB,IAAAI,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAW,IACXC,EAAU,IAKdF,EAAaC,EAAU,UAAWC,CAAQ,EAK1CH,EAAO,QAAUE,ICYjB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAAWD,EAEXC,EAAWC,EAMZ,OAAO,QAAUD",
6
+ "names": ["require_ndarray", "__commonJSMin", "exports", "module", "dsnansumpw", "dsnansum", "N", "x", "strideX", "offsetX", "require_dsnansum", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "dsnansum", "N", "x", "strideX", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsnansum", "ndarray", "join", "tryRequire", "isError", "main", "dsnansum", "tmp"]
7
7
  }
@@ -27,7 +27,7 @@ interface Routine {
27
27
  *
28
28
  * @param N - number of indexed elements
29
29
  * @param x - input array
30
- * @param stride - stride length
30
+ * @param strideX - stride length
31
31
  * @returns sum
32
32
  *
33
33
  * @example
@@ -38,15 +38,15 @@ interface Routine {
38
38
  * var v = dsnansum( x.length, x, 1 );
39
39
  * // returns 1.0
40
40
  */
41
- ( N: number, x: Float32Array, stride: number ): number;
41
+ ( N: number, x: Float32Array, strideX: number ): number;
42
42
 
43
43
  /**
44
- * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using extended accumulation and alternative indexing semantics.
44
+ * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation and alternative indexing semantics, and returning an extended precision result.
45
45
  *
46
46
  * @param N - number of indexed elements
47
47
  * @param x - input array
48
- * @param stride - stride length
49
- * @param offset - starting index
48
+ * @param strideX - stride length
49
+ * @param offsetX - starting index
50
50
  * @returns sum
51
51
  *
52
52
  * @example
@@ -57,7 +57,7 @@ interface Routine {
57
57
  * var v = dsnansum.ndarray( x.length, x, 1, 0 );
58
58
  * // returns 1.0
59
59
  */
60
- ndarray( N: number, x: Float32Array, stride: number, offset: number ): number;
60
+ ndarray( N: number, x: Float32Array, strideX: number, offsetX: number ): number;
61
61
  }
62
62
 
63
63
  /**
@@ -65,7 +65,7 @@ interface Routine {
65
65
  *
66
66
  * @param N - number of indexed elements
67
67
  * @param x - input array
68
- * @param stride - stride length
68
+ * @param strideX - stride length
69
69
  * @returns sum
70
70
  *
71
71
  * @example
@@ -16,13 +16,10 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- /**
20
- * Header file containing function declarations.
21
- */
22
19
  #ifndef STDLIB_BLAS_EXT_BASE_DSNANSUM_H
23
20
  #define STDLIB_BLAS_EXT_BASE_DSNANSUM_H
24
21
 
25
- #include <stdint.h>
22
+ #include "stdlib/blas/base/shared.h"
26
23
 
27
24
  /*
28
25
  * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
@@ -32,9 +29,14 @@ extern "C" {
32
29
  #endif
33
30
 
34
31
  /**
35
- * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended summation, and returning an extended precision result.
32
+ * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.
33
+ */
34
+ double API_SUFFIX(stdlib_strided_dsnansum)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
35
+
36
+ /**
37
+ * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation and alternative indexing semantics, and returning an extended precision result.
36
38
  */
37
- double stdlib_strided_dsnansum( const int64_t N, const float *X, const int64_t stride );
39
+ double API_SUFFIX(stdlib_strided_dsnansum_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
38
40
 
39
41
  #ifdef __cplusplus
40
42
  }
package/lib/dsnansum.js CHANGED
@@ -20,7 +20,8 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' );
23
+ var stride2offset = require( '@stdlib/strided-base-stride2offset' );
24
+ var ndarray = require( './ndarray.js' );
24
25
 
25
26
 
26
27
  // MAIN //
@@ -30,20 +31,19 @@ var dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' );
30
31
  *
31
32
  * @param {PositiveInteger} N - number of indexed elements
32
33
  * @param {Float32Array} x - input array
33
- * @param {integer} stride - stride length
34
+ * @param {integer} strideX - stride length
34
35
  * @returns {number} sum
35
36
  *
36
37
  * @example
37
38
  * var Float32Array = require( '@stdlib/array-float32' );
38
39
  *
39
40
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
40
- * var N = x.length;
41
- *
42
- * var v = dsnansum( N, x, 1 );
41
+
42
+ * var v = dsnansum( x.length, x, 1 );
43
43
  * // returns 1.0
44
44
  */
45
- function dsnansum( N, x, stride ) {
46
- return dsnansumpw( N, x, stride );
45
+ function dsnansum( N, x, strideX ) {
46
+ return ndarray( N, x, strideX, stride2offset( N, strideX) );
47
47
  }
48
48
 
49
49
 
@@ -30,20 +30,19 @@ var addon = require( './../src/addon.node' );
30
30
  *
31
31
  * @param {PositiveInteger} N - number of indexed elements
32
32
  * @param {Float32Array} x - input array
33
- * @param {integer} stride - stride length
33
+ * @param {integer} strideX - stride length
34
34
  * @returns {number} sum
35
35
  *
36
36
  * @example
37
37
  * var Float32Array = require( '@stdlib/array-float32' );
38
38
  *
39
39
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
40
- * var N = x.length;
41
- *
42
- * var v = dsnansum( N, x, 1 );
40
+
41
+ * var v = dsnansum( x.length, x, 1 );
43
42
  * // returns 1.0
44
43
  */
45
- function dsnansum( N, x, stride ) {
46
- return addon( N, x, stride );
44
+ function dsnansum( N, x, strideX ) {
45
+ return addon( N, x, strideX );
47
46
  }
48
47
 
49
48
 
package/lib/index.js CHANGED
@@ -28,9 +28,8 @@
28
28
  * var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );
29
29
  *
30
30
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
31
- * var N = x.length;
32
31
  *
33
- * var v = dsnansum( N, x, 1 );
32
+ * var v = dsnansum( x.length, x, 1 );
34
33
  * // returns 1.0
35
34
  *
36
35
  * @example
package/lib/ndarray.js CHANGED
@@ -30,8 +30,8 @@ var dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' ).ndarray;
30
30
  *
31
31
  * @param {PositiveInteger} N - number of indexed elements
32
32
  * @param {Float32Array} x - input array
33
- * @param {integer} stride - stride length
34
- * @param {NonNegativeInteger} offset - starting index
33
+ * @param {integer} strideX - stride length
34
+ * @param {NonNegativeInteger} offsetX - starting index
35
35
  * @returns {number} sum
36
36
  *
37
37
  * @example
@@ -42,8 +42,8 @@ var dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' ).ndarray;
42
42
  * var v = dsnansum( 5, x, 2, 1 );
43
43
  * // returns 5.0
44
44
  */
45
- function dsnansum( N, x, stride, offset ) {
46
- return dsnansumpw( N, x, stride, offset );
45
+ function dsnansum( N, x, strideX, offsetX ) {
46
+ return dsnansumpw( N, x, strideX, offsetX );
47
47
  }
48
48
 
49
49
 
@@ -20,9 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
24
- var offsetView = require( '@stdlib/strided-base-offset-view' );
25
- var addon = require( './dsnansum.native.js' );
23
+ var addon = require( './../src/addon.node' );
26
24
 
27
25
 
28
26
  // MAIN //
@@ -32,8 +30,8 @@ var addon = require( './dsnansum.native.js' );
32
30
  *
33
31
  * @param {PositiveInteger} N - number of indexed elements
34
32
  * @param {Float32Array} x - input array
35
- * @param {integer} stride - stride length
36
- * @param {NonNegativeInteger} offset - starting index
33
+ * @param {integer} strideX - stride length
34
+ * @param {NonNegativeInteger} offsetX - starting index
37
35
  * @returns {number} sum
38
36
  *
39
37
  * @example
@@ -44,11 +42,8 @@ var addon = require( './dsnansum.native.js' );
44
42
  * var v = dsnansum( 5, x, 2, 1 );
45
43
  * // returns 5.0
46
44
  */
47
- function dsnansum( N, x, stride, offset ) {
48
- var view;
49
- offset = minViewBufferIndex( N, stride, offset );
50
- view = offsetView( x, offset );
51
- return addon( N, view, stride );
45
+ function dsnansum( N, x, strideX, offsetX ) {
46
+ return addon.ndarray( N, x, strideX, offsetX );
52
47
  }
53
48
 
54
49
 
package/manifest.json CHANGED
@@ -28,53 +28,54 @@
28
28
  {
29
29
  "task": "build",
30
30
  "src": [
31
- "./src/dsnansum.c"
31
+ "./src/main.c"
32
32
  ],
33
33
  "include": [
34
34
  "./include"
35
35
  ],
36
- "libraries": [
37
- "-lm"
38
- ],
36
+ "libraries": [],
39
37
  "libpath": [],
40
38
  "dependencies": [
41
39
  "@stdlib/blas-ext-base-dsnansumpw",
42
40
  "@stdlib/napi-export",
43
41
  "@stdlib/napi-argv",
44
42
  "@stdlib/napi-argv-int64",
45
- "@stdlib/napi-argv-strided-float32array"
43
+ "@stdlib/napi-argv-strided-float32array",
44
+ "@stdlib/napi-create-double",
45
+ "@stdlib/blas-base-shared",
46
+ "@stdlib/strided-base-stride2offset"
46
47
  ]
47
48
  },
48
49
  {
49
50
  "task": "benchmark",
50
51
  "src": [
51
- "./src/dsnansum.c"
52
+ "./src/main.c"
52
53
  ],
53
54
  "include": [
54
55
  "./include"
55
56
  ],
56
- "libraries": [
57
- "-lm"
58
- ],
57
+ "libraries": [],
59
58
  "libpath": [],
60
59
  "dependencies": [
61
- "@stdlib/blas-ext-base-dsnansumpw"
60
+ "@stdlib/blas-ext-base-dsnansumpw",
61
+ "@stdlib/blas-base-shared",
62
+ "@stdlib/strided-base-stride2offset"
62
63
  ]
63
64
  },
64
65
  {
65
66
  "task": "examples",
66
67
  "src": [
67
- "./src/dsnansum.c"
68
+ "./src/main.c"
68
69
  ],
69
70
  "include": [
70
71
  "./include"
71
72
  ],
72
- "libraries": [
73
- "-lm"
74
- ],
73
+ "libraries": [],
75
74
  "libpath": [],
76
75
  "dependencies": [
77
- "@stdlib/blas-ext-base-dsnansumpw"
76
+ "@stdlib/blas-ext-base-dsnansumpw",
77
+ "@stdlib/blas-base-shared",
78
+ "@stdlib/strided-base-stride2offset"
78
79
  ]
79
80
  }
80
81
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-dsnansum",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Calculate the sum of single-precision floating-point strided array elements, ignoring NaN values, using extended accumulation, and returning an extended precision result.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -35,13 +35,16 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@stdlib/assert-is-error": "^0.2.2",
38
- "@stdlib/blas-ext-base-dsnansumpw": "^0.2.1",
38
+ "@stdlib/blas-base-shared": "^0.1.0",
39
+ "@stdlib/blas-ext-base-dsnansumpw": "^0.3.0",
39
40
  "@stdlib/napi-argv": "^0.2.2",
40
41
  "@stdlib/napi-argv-int64": "^0.2.2",
41
42
  "@stdlib/napi-argv-strided-float32array": "^0.2.2",
42
- "@stdlib/napi-export": "^0.2.2",
43
+ "@stdlib/napi-create-double": "^0.0.2",
44
+ "@stdlib/napi-export": "^0.3.0",
45
+ "@stdlib/strided-base-stride2offset": "^0.1.0",
43
46
  "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
44
- "@stdlib/utils-library-manifest": "^0.2.2",
47
+ "@stdlib/utils-library-manifest": "^0.2.3",
45
48
  "@stdlib/utils-try-require": "^0.2.2"
46
49
  },
47
50
  "devDependencies": {},
@@ -81,7 +84,6 @@
81
84
  "float",
82
85
  "float32array"
83
86
  ],
84
- "__stdlib__": {},
85
87
  "funding": {
86
88
  "type": "opencollective",
87
89
  "url": "https://opencollective.com/stdlib"
package/src/addon.c CHANGED
@@ -17,10 +17,12 @@
17
17
  */
18
18
 
19
19
  #include "stdlib/blas/ext/base/dsnansum.h"
20
+ #include "stdlib/blas/base/shared.h"
20
21
  #include "stdlib/napi/export.h"
21
22
  #include "stdlib/napi/argv.h"
22
23
  #include "stdlib/napi/argv_int64.h"
23
24
  #include "stdlib/napi/argv_strided_float32array.h"
25
+ #include "stdlib/napi/create_double.h"
24
26
  #include <node_api.h>
25
27
 
26
28
  /**
@@ -33,13 +35,27 @@
33
35
  static napi_value addon( napi_env env, napi_callback_info info ) {
34
36
  STDLIB_NAPI_ARGV( env, info, argv, argc, 3 );
35
37
  STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
36
- STDLIB_NAPI_ARGV_INT64( env, stride, argv, 2 );
37
- STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, stride, argv, 1 );
38
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
39
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
40
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsnansum)( N, X, strideX ), v );
41
+ return v;
42
+ }
38
43
 
39
- napi_value v;
40
- napi_status status = napi_create_double( env, stdlib_strided_dsnansum( N, X, stride ), &v );
41
- assert( status == napi_ok );
44
+ /**
45
+ * Receives JavaScript callback invocation data.
46
+ *
47
+ * @param env environment under which the function is invoked
48
+ * @param info callback data
49
+ * @return Node-API value
50
+ */
51
+ static napi_value addon_method( napi_env env, napi_callback_info info ) {
52
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
53
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
54
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
55
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
56
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
57
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsnansum_ndarray)( N, X, strideX, offsetX ), v );
42
58
  return v;
43
59
  }
44
60
 
45
- STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
61
+ STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method );
package/src/main.c ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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/blas/ext/base/dsnansum.h"
20
+ #include "stdlib/blas/ext/base/dsnansumpw.h"
21
+ #include "stdlib/blas/base/shared.h"
22
+ #include "stdlib/strided/base/stride2offset.h"
23
+
24
+ /**
25
+ * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.
26
+ *
27
+ * @param N number of indexed elements
28
+ * @param X input array
29
+ * @param strideX stride length
30
+ * @return output value
31
+ */
32
+ double API_SUFFIX(stdlib_strided_dsnansum)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
33
+ CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
34
+ return API_SUFFIX(stdlib_strided_dsnansum_ndarray)( N, X, strideX, ox );
35
+ }
36
+
37
+ /**
38
+ * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation and alternative indexing semantics, and returning an extended precision result.
39
+ *
40
+ * @param N number of indexed elements
41
+ * @param X input array
42
+ * @param strideX stride length
43
+ * @param offsetX starting index
44
+ * @return output value
45
+ */
46
+ double API_SUFFIX(stdlib_strided_dsnansum_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
47
+ return API_SUFFIX(stdlib_strided_dsnansumpw_ndarray)( N, X, strideX, offsetX );
48
+ }
package/src/dsnansum.c DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2020 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/blas/ext/base/dsnansum.h"
20
- #include "stdlib/blas/ext/base/dsnansumpw.h"
21
- #include <stdint.h>
22
-
23
- /**
24
- * Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.
25
- *
26
- * @param N number of indexed elements
27
- * @param X input array
28
- * @param stride stride length
29
- * @return output value
30
- */
31
- double stdlib_strided_dsnansum( const int64_t N, const float *X, const int64_t stride ) {
32
- return stdlib_strided_dsnansumpw( N, X, stride );
33
- }