@stdlib/blas-ext-base-dsapxsum 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
@@ -33,7 +33,7 @@ limitations under the License.
33
33
 
34
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
35
 
36
- > Add a constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.
36
+ > Add a scalar constant to each single-precision floating-point strided array element, and compute the sum using extended accumulation and returning an extended precision result.
37
37
 
38
38
  <section class="intro">
39
39
 
@@ -59,26 +59,27 @@ npm install @stdlib/blas-ext-base-dsapxsum
59
59
  var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
60
60
  ```
61
61
 
62
- #### dsapxsum( N, alpha, x, stride )
62
+ #### dsapxsum( N, alpha, x, strideX )
63
63
 
64
- Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
64
+ Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
65
65
 
66
66
  ```javascript
67
67
  var Float32Array = require( '@stdlib/array-float32' );
68
68
 
69
69
  var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
70
70
 
71
- var v = dsapxsum( 3, 5.0, x, 1 );
71
+ var v = dsapxsum( x.length, 5.0, x, 1 );
72
72
  // returns 16.0
73
73
  ```
74
74
 
75
75
  The function has the following parameters:
76
76
 
77
77
  - **N**: number of indexed elements.
78
+ - **alpha**: scalar constant.
78
79
  - **x**: input [`Float32Array`][@stdlib/array/float32].
79
- - **stride**: index increment for `x`.
80
+ - **strideX**: stride length for `x`.
80
81
 
81
- The `N` and `stride` parameters determine which elements in the strided array are accessed at runtime. For example, to access every other element in the strided array,
82
+ The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to access every other element:
82
83
 
83
84
  ```javascript
84
85
  var Float32Array = require( '@stdlib/array-float32' );
@@ -103,24 +104,24 @@ var v = dsapxsum( 4, 5.0, x1, 2 );
103
104
  // returns 25.0
104
105
  ```
105
106
 
106
- #### dsapxsum.ndarray( N, alpha, x, stride, offset )
107
+ #### dsapxsum.ndarray( N, alpha, x, strideX, offsetX )
107
108
 
108
- Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
109
+ Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
109
110
 
110
111
  ```javascript
111
112
  var Float32Array = require( '@stdlib/array-float32' );
112
113
 
113
114
  var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
114
115
 
115
- var v = dsapxsum.ndarray( 3, 5.0, x, 1, 0 );
116
+ var v = dsapxsum.ndarray( x.length, 5.0, x, 1, 0 );
116
117
  // returns 16.0
117
118
  ```
118
119
 
119
120
  The function has the following additional parameters:
120
121
 
121
- - **offset**: starting index for `x`.
122
+ - **offsetX**: starting index for `x`.
122
123
 
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 access every other value in the strided array starting from the second value
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 access every other element starting from the second element:
124
125
 
125
126
  ```javascript
126
127
  var Float32Array = require( '@stdlib/array-float32' );
@@ -153,11 +154,12 @@ var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );
153
154
  <!-- eslint no-undef: "error" -->
154
155
 
155
156
  ```javascript
156
- var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
157
- var filledarrayBy = require( '@stdlib/array-filled-by' );
157
+ var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
158
158
  var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
159
159
 
160
- var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
160
+ var x = discreteUniform( 10, -100, 100, {
161
+ 'dtype': 'float32'
162
+ });
161
163
  console.log( x );
162
164
 
163
165
  var v = dsapxsum( x.length, 5.0, x, 1 );
@@ -168,6 +170,125 @@ console.log( v );
168
170
 
169
171
  <!-- /.examples -->
170
172
 
173
+ <!-- C interface documentation. -->
174
+
175
+ * * *
176
+
177
+ <section class="c">
178
+
179
+ ## C APIs
180
+
181
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
182
+
183
+ <section class="intro">
184
+
185
+ </section>
186
+
187
+ <!-- /.intro -->
188
+
189
+ <!-- C usage documentation. -->
190
+
191
+ <section class="usage">
192
+
193
+ ### Usage
194
+
195
+ ```c
196
+ #include "stdlib/blas/ext/base/dsapxsum.h"
197
+ ```
198
+
199
+ #### stdlib_strided_dsapxsum( N, alpha, \*X, strideX )
200
+
201
+ Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
202
+
203
+ ```c
204
+ const float x[] = { 1.0f, -2.0f, 2.0f };
205
+
206
+ double v = stdlib_strided_dsapxsum( 3, 5.0f, x, 1 );
207
+ // returns 16.0
208
+ ```
209
+
210
+ The function accepts the following arguments:
211
+
212
+ - **N**: `[in] CBLAS_INT` number of indexed elements.
213
+ - **alpha**: `[in] float` scalar constant.
214
+ - **X**: `[in] float*` input array.
215
+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
216
+
217
+ ```c
218
+ double stdlib_strided_dsapxsum( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX );
219
+ ```
220
+
221
+ #### stdlib_strided_dsapxsum_ndarray( N, alpha, \*X, strideX, offsetX )
222
+
223
+ Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
224
+
225
+ ```c
226
+ const float x[] = { 1.0f, -2.0f, 2.0f };
227
+
228
+ double v = stdlib_strided_dsapxsum_ndarray( 3, 5.0f, x, 1, 0 );
229
+ // returns 16.0
230
+ ```
231
+
232
+ The function accepts the following arguments:
233
+
234
+ - **N**: `[in] CBLAS_INT` number of indexed elements.
235
+ - **alpha**: `[in] float` scalar constant.
236
+ - **X**: `[in] float*` input array.
237
+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
238
+ - **offsetX**: `[in] CBLAS_INT` starting index for `X`.
239
+
240
+ ```c
241
+ double stdlib_strided_dsapxsum_ndarray( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
242
+ ```
243
+
244
+ </section>
245
+
246
+ <!-- /.usage -->
247
+
248
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
249
+
250
+ <section class="notes">
251
+
252
+ </section>
253
+
254
+ <!-- /.notes -->
255
+
256
+ <!-- C API usage examples. -->
257
+
258
+ <section class="examples">
259
+
260
+ ### Examples
261
+
262
+ ```c
263
+ #include "stdlib/blas/ext/base/dsapxsum.h"
264
+ #include <stdio.h>
265
+
266
+ int main( void ) {
267
+ // Create a strided array:
268
+ const float x[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };
269
+
270
+ // Specify the number of indexed elements:
271
+ const int N = 8;
272
+
273
+ // Specify a stride:
274
+ const int strideX = 1;
275
+
276
+ // Compute the sum:
277
+ double v = stdlib_strided_dsapxsum( N, 5.0f, x, strideX );
278
+
279
+ // Print the result:
280
+ printf( "sum: %lf\n", v );
281
+ }
282
+ ```
283
+
284
+ </section>
285
+
286
+ <!-- /.examples -->
287
+
288
+ </section>
289
+
290
+ <!-- /.c -->
291
+
171
292
  <section class="references">
172
293
 
173
294
  </section>
@@ -182,9 +303,9 @@ console.log( v );
182
303
 
183
304
  ## See Also
184
305
 
185
- - <span class="package-name">[`@stdlib/blas-ext/base/dapxsum`][@stdlib/blas/ext/base/dapxsum]</span><span class="delimiter">: </span><span class="description">adds a constant to each double-precision floating-point strided array element and computes the sum.</span>
306
+ - <span class="package-name">[`@stdlib/blas-ext/base/dapxsum`][@stdlib/blas/ext/base/dapxsum]</span><span class="delimiter">: </span><span class="description">add a scalar constant to each double-precision floating-point strided array element and compute the sum.</span>
186
307
  - <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>
187
- - <span class="package-name">[`@stdlib/blas-ext/base/sapxsum`][@stdlib/blas/ext/base/sapxsum]</span><span class="delimiter">: </span><span class="description">adds a constant to each single-precision floating-point strided array element and computes the sum.</span>
308
+ - <span class="package-name">[`@stdlib/blas-ext/base/sapxsum`][@stdlib/blas/ext/base/sapxsum]</span><span class="delimiter">: </span><span class="description">add a constant to each single-precision floating-point strided array element and compute the sum.</span>
188
309
 
189
310
  </section>
190
311
 
@@ -216,7 +337,7 @@ See [LICENSE][stdlib-license].
216
337
 
217
338
  ## Copyright
218
339
 
219
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
340
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
220
341
 
221
342
  </section>
222
343
 
@@ -229,8 +350,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
229
350
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsapxsum.svg
230
351
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsapxsum
231
352
 
232
- [test-image]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml/badge.svg?branch=v0.2.2
233
- [test-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml?query=branch:v0.2.2
353
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml/badge.svg?branch=v0.3.0
354
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml?query=branch:v0.3.0
234
355
 
235
356
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsapxsum/main.svg
236
357
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsapxsum?branch=main
@@ -242,8 +363,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
242
363
 
243
364
  -->
244
365
 
245
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
246
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
366
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
367
+ [chat-url]: https://stdlib.zulipchat.com
247
368
 
248
369
  [stdlib]: https://github.com/stdlib-js/stdlib
249
370
 
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var n=u(function(g,t){
2
- var c=require('@stdlib/blas-ext-base-dsapxsumpw/dist');function y(e,r,s,a){return c(e,r,s,a)}t.exports=y
3
- });var v=u(function(h,p){
4
- var f=require('@stdlib/blas-ext-base-dsapxsumpw/dist').ndarray;function j(e,r,s,a,o){return f(e,r,s,a,o)}p.exports=j
5
- });var x=u(function(k,q){
6
- var l=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=n(),w=v();l(d,"ndarray",w);q.exports=d
7
- });var R=require("path").join,_=require('@stdlib/utils-try-require/dist'),E=require('@stdlib/assert-is-error/dist'),O=x(),i,m=_(R(__dirname,"./native.js"));E(m)?i=O:i=m;module.exports=i;
1
+ "use strict";var i=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=i(function(h,n){
2
+ var c=require('@stdlib/blas-ext-base-dsapxsumpw/dist').ndarray;function y(e,r,s,a,m){return c(e,r,s,a,m)}n.exports=y
3
+ });var d=i(function(k,v){
4
+ var f=require('@stdlib/strided-base-stride2offset/dist'),j=u();function l(e,r,s,a){return j(e,r,s,a,f(e,a))}v.exports=l
5
+ });var o=i(function(z,q){
6
+ var R=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),p=d(),_=u();R(p,"ndarray",_);q.exports=p
7
+ });var w=require("path").join,E=require('@stdlib/utils-try-require/dist'),O=require('@stdlib/assert-is-error/dist'),b=o(),t,x=E(w(__dirname,"./native.js"));O(x)?t=b:t=x;module.exports=t;
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/dsapxsum.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 dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' );\n\n\n// MAIN //\n\n/**\n* Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} alpha - constant\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, 2.0 ] );\n*\n* var v = dsapxsum( 3, 5.0, x, 1 );\n* // returns 16.0\n*/\nfunction dsapxsum( N, alpha, x, stride ) {\n\treturn dsapxsumpw( N, alpha, x, stride );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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 dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' ).ndarray;\n\n\n// MAIN //\n\n/**\n* Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} alpha - constant\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 ] );\n*\n* var v = dsapxsum( 4, 5.0, x, 2, 1 );\n* // returns 25.0\n*/\nfunction dsapxsum( N, alpha, x, stride, offset ) {\n\treturn dsapxsumpw( N, alpha, x, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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 dsapxsum = require( './dsapxsum.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsapxsum, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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* Add a constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.\n*\n* @module @stdlib/blas-ext-base-dsapxsum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );\n*\n* var v = dsapxsum( 3, 5.0, x, 1 );\n* // returns 16.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n*\n* var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );\n* // returns 25.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 dsapxsum;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsapxsum = main;\n} else {\n\tdsapxsum = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\n\n// exports: { \"ndarray\": \"dsapxsum.ndarray\" }\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAsB7D,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAS,CACxC,OAAOL,EAAYE,EAAGC,EAAOC,EAAGC,CAAO,CACxC,CAKAN,EAAO,QAAUE,ICnDjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAuB/D,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAQC,EAAS,CAChD,OAAON,EAAYE,EAAGC,EAAOC,EAAGC,EAAQC,CAAO,CAChD,CAKAP,EAAO,QAAUE,ICpDjB,IAAAM,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_dsapxsum", "__commonJSMin", "exports", "module", "dsapxsumpw", "dsapxsum", "N", "alpha", "x", "stride", "require_ndarray", "__commonJSMin", "exports", "module", "dsapxsumpw", "dsapxsum", "N", "alpha", "x", "stride", "offset", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsapxsum", "ndarray", "join", "tryRequire", "isError", "main", "dsapxsum", "tmp"]
3
+ "sources": ["../lib/ndarray.js", "../lib/dsapxsum.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 dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' ).ndarray;\n\n\n// MAIN //\n\n/**\n* Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} alpha - scalar constant\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 ] );\n*\n* var v = dsapxsum( 4, 5.0, x, 2, 1 );\n* // returns 25.0\n*/\nfunction dsapxsum( N, alpha, x, strideX, offsetX ) {\n\treturn dsapxsumpw( N, alpha, x, strideX, offsetX );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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* Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} alpha - scalar constant\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, 2.0 ] );\n*\n* var v = dsapxsum( x.length, 5.0, x, 1 );\n* // returns 16.0\n*/\nfunction dsapxsum( N, alpha, x, strideX ) {\n\treturn ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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 dsapxsum = require( './dsapxsum.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsapxsum, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\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* Add a scalar constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.\n*\n* @module @stdlib/blas-ext-base-dsapxsum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );\n*\n* var v = dsapxsum( x.length, 5.0, x, 1 );\n* // returns 16.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n*\n* var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );\n* // returns 25.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 dsapxsum;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsapxsum = main;\n} else {\n\tdsapxsum = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsapxsum;\n\n// exports: { \"ndarray\": \"dsapxsum.ndarray\" }\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAuB/D,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAASC,EAAU,CAClD,OAAON,EAAYE,EAAGC,EAAOC,EAAGC,EAASC,CAAQ,CAClD,CAKAP,EAAO,QAAUE,ICpDjB,IAAAM,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAU,IAsBd,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAU,CACzC,OAAOL,EAASE,EAAGC,EAAOC,EAAGC,EAASN,EAAeG,EAAGG,CAAQ,CAAE,CACnE,CAKAP,EAAO,QAAUG,ICpDjB,IAAAK,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", "dsapxsumpw", "dsapxsum", "N", "alpha", "x", "strideX", "offsetX", "require_dsapxsum", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "dsapxsum", "N", "alpha", "x", "strideX", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsapxsum", "ndarray", "join", "tryRequire", "isError", "main", "dsapxsum", "tmp"]
7
7
  }
@@ -23,12 +23,12 @@
23
23
  */
24
24
  interface Routine {
25
25
  /**
26
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
26
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
27
27
  *
28
28
  * @param N - number of indexed elements
29
- * @param alpha - constant
29
+ * @param alpha - scalar constant
30
30
  * @param x - input array
31
- * @param stride - stride length
31
+ * @param strideX - stride length
32
32
  * @returns sum
33
33
  *
34
34
  * @example
@@ -39,16 +39,16 @@ interface Routine {
39
39
  * var v = dsapxsum( x.length, 5.0, x, 1 );
40
40
  * // returns 16.0
41
41
  */
42
- ( N: number, alpha: number, x: Float32Array, stride: number ): number;
42
+ ( N: number, alpha: number, x: Float32Array, strideX: number ): number;
43
43
 
44
44
  /**
45
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
45
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
46
46
  *
47
47
  * @param N - number of indexed elements
48
- * @param alpha - constant
48
+ * @param alpha - scalar constant
49
49
  * @param x - input array
50
- * @param stride - stride length
51
- * @param offset - starting index
50
+ * @param strideX - stride length
51
+ * @param offsetX - starting index
52
52
  * @returns sum
53
53
  *
54
54
  * @example
@@ -59,16 +59,16 @@ interface Routine {
59
59
  * var v = dsapxsum.ndarray( x.length, 5.0, x, 1, 0 );
60
60
  * // returns 16.0
61
61
  */
62
- ndarray( N: number, alpha: number, x: Float32Array, stride: number, offset: number ): number;
62
+ ndarray( N: number, alpha: number, x: Float32Array, strideX: number, offsetX: number ): number;
63
63
  }
64
64
 
65
65
  /**
66
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
66
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
67
67
  *
68
68
  * @param N - number of indexed elements
69
- * @param alpha - constant
69
+ * @param alpha - scalar constant
70
70
  * @param x - input array
71
- * @param stride - stride length
71
+ * @param strideX - stride length
72
72
  * @returns sum
73
73
  *
74
74
  * @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_DSAPXSUM_H
23
20
  #define STDLIB_BLAS_EXT_BASE_DSAPXSUM_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
- * Adds a scalar constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
32
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
33
+ */
34
+ double API_SUFFIX(stdlib_strided_dsapxsum)( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX );
35
+
36
+ /**
37
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
36
38
  */
37
- double stdlib_strided_dsapxsum( const int64_t N, const float alpha, const float *X, const int64_t stride );
39
+ double API_SUFFIX(stdlib_strided_dsapxsum_ndarray)( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
38
40
 
39
41
  #ifdef __cplusplus
40
42
  }
package/lib/dsapxsum.js CHANGED
@@ -20,18 +20,19 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' );
23
+ var stride2offset = require( '@stdlib/strided-base-stride2offset' );
24
+ var ndarray = require( './ndarray.js' );
24
25
 
25
26
 
26
27
  // MAIN //
27
28
 
28
29
  /**
29
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
30
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
30
31
  *
31
32
  * @param {PositiveInteger} N - number of indexed elements
32
- * @param {number} alpha - constant
33
+ * @param {number} alpha - scalar constant
33
34
  * @param {Float32Array} x - input array
34
- * @param {integer} stride - stride length
35
+ * @param {integer} strideX - stride length
35
36
  * @returns {number} sum
36
37
  *
37
38
  * @example
@@ -39,11 +40,11 @@ var dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' );
39
40
  *
40
41
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
41
42
  *
42
- * var v = dsapxsum( 3, 5.0, x, 1 );
43
+ * var v = dsapxsum( x.length, 5.0, x, 1 );
43
44
  * // returns 16.0
44
45
  */
45
- function dsapxsum( N, alpha, x, stride ) {
46
- return dsapxsumpw( N, alpha, x, stride );
46
+ function dsapxsum( N, alpha, x, strideX ) {
47
+ return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) );
47
48
  }
48
49
 
49
50
 
@@ -26,12 +26,12 @@ var addon = require( './../src/addon.node' );
26
26
  // MAIN //
27
27
 
28
28
  /**
29
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
29
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
30
30
  *
31
31
  * @param {PositiveInteger} N - number of indexed elements
32
- * @param {number} alpha - constant
32
+ * @param {number} alpha - scalar constant
33
33
  * @param {Float32Array} x - input array
34
- * @param {integer} stride - stride length
34
+ * @param {integer} strideX - stride length
35
35
  * @returns {number} sum
36
36
  *
37
37
  * @example
@@ -39,11 +39,11 @@ var addon = require( './../src/addon.node' );
39
39
  *
40
40
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
41
41
  *
42
- * var v = dsapxsum( 3, 5.0, x, 1 );
42
+ * var v = dsapxsum( x.length, 5.0, x, 1 );
43
43
  * // returns 16.0
44
44
  */
45
- function dsapxsum( N, alpha, x, stride ) {
46
- return addon( N, alpha, x, stride );
45
+ function dsapxsum( N, alpha, x, strideX ) {
46
+ return addon( N, alpha, x, strideX );
47
47
  }
48
48
 
49
49
 
package/lib/index.js CHANGED
@@ -19,7 +19,7 @@
19
19
  'use strict';
20
20
 
21
21
  /**
22
- * Add a constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.
22
+ * Add a scalar constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.
23
23
  *
24
24
  * @module @stdlib/blas-ext-base-dsapxsum
25
25
  *
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
31
31
  *
32
- * var v = dsapxsum( 3, 5.0, x, 1 );
32
+ * var v = dsapxsum( x.length, 5.0, x, 1 );
33
33
  * // returns 16.0
34
34
  *
35
35
  * @example
package/lib/ndarray.js CHANGED
@@ -26,13 +26,13 @@ var dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' ).ndarray;
26
26
  // MAIN //
27
27
 
28
28
  /**
29
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
29
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
30
30
  *
31
31
  * @param {PositiveInteger} N - number of indexed elements
32
- * @param {number} alpha - constant
32
+ * @param {number} alpha - scalar constant
33
33
  * @param {Float32Array} x - input array
34
- * @param {integer} stride - stride length
35
- * @param {NonNegativeInteger} offset - starting index
34
+ * @param {integer} strideX - stride length
35
+ * @param {NonNegativeInteger} offsetX - starting index
36
36
  * @returns {number} sum
37
37
  *
38
38
  * @example
@@ -43,8 +43,8 @@ var dsapxsumpw = require( '@stdlib/blas-ext-base-dsapxsumpw' ).ndarray;
43
43
  * var v = dsapxsum( 4, 5.0, x, 2, 1 );
44
44
  * // returns 25.0
45
45
  */
46
- function dsapxsum( N, alpha, x, stride, offset ) {
47
- return dsapxsumpw( N, alpha, x, stride, offset );
46
+ function dsapxsum( N, alpha, x, strideX, offsetX ) {
47
+ return dsapxsumpw( N, alpha, x, strideX, offsetX );
48
48
  }
49
49
 
50
50
 
@@ -20,21 +20,19 @@
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( './dsapxsum.native.js' );
23
+ var addon = require( './../src/addon.node' );
26
24
 
27
25
 
28
26
  // MAIN //
29
27
 
30
28
  /**
31
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
29
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
32
30
  *
33
31
  * @param {PositiveInteger} N - number of indexed elements
34
- * @param {number} alpha - constant
32
+ * @param {number} alpha - scalar constant
35
33
  * @param {Float32Array} x - input array
36
- * @param {integer} stride - stride length
37
- * @param {NonNegativeInteger} offset - starting index
34
+ * @param {integer} strideX - stride length
35
+ * @param {NonNegativeInteger} offsetX - starting index
38
36
  * @returns {number} sum
39
37
  *
40
38
  * @example
@@ -45,12 +43,8 @@ var addon = require( './dsapxsum.native.js' );
45
43
  * var v = dsapxsum( 4, 5.0, x, 2, 1 );
46
44
  * // returns 25.0
47
45
  */
48
- function dsapxsum( N, alpha, x, stride, offset ) {
49
- var view;
50
-
51
- offset = minViewBufferIndex( N, stride, offset );
52
- view = offsetView( x, offset );
53
- return addon( N, alpha, view, stride );
46
+ function dsapxsum( N, alpha, x, strideX, offsetX ) {
47
+ return addon.ndarray( N, alpha, x, strideX, offsetX );
54
48
  }
55
49
 
56
50
 
package/manifest.json CHANGED
@@ -28,14 +28,12 @@
28
28
  {
29
29
  "task": "build",
30
30
  "src": [
31
- "./src/dsapxsum.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/napi-export",
@@ -43,39 +41,42 @@
43
41
  "@stdlib/napi-argv-int64",
44
42
  "@stdlib/napi-argv-float",
45
43
  "@stdlib/napi-argv-strided-float32array",
46
- "@stdlib/blas-ext-base-dsapxsumpw"
44
+ "@stdlib/blas-ext-base-dsapxsumpw",
45
+ "@stdlib/blas-base-shared",
46
+ "@stdlib/strided-base-stride2offset",
47
+ "@stdlib/napi-create-double"
47
48
  ]
48
49
  },
49
50
  {
50
51
  "task": "benchmark",
51
52
  "src": [
52
- "./src/dsapxsum.c"
53
+ "./src/main.c"
53
54
  ],
54
55
  "include": [
55
56
  "./include"
56
57
  ],
57
- "libraries": [
58
- "-lm"
59
- ],
58
+ "libraries": [],
60
59
  "libpath": [],
61
60
  "dependencies": [
62
- "@stdlib/blas-ext-base-dsapxsumpw"
61
+ "@stdlib/blas-ext-base-dsapxsumpw",
62
+ "@stdlib/blas-base-shared",
63
+ "@stdlib/strided-base-stride2offset"
63
64
  ]
64
65
  },
65
66
  {
66
67
  "task": "examples",
67
68
  "src": [
68
- "./src/dsapxsum.c"
69
+ "./src/main.c"
69
70
  ],
70
71
  "include": [
71
72
  "./include"
72
73
  ],
73
- "libraries": [
74
- "-lm"
75
- ],
74
+ "libraries": [],
76
75
  "libpath": [],
77
76
  "dependencies": [
78
- "@stdlib/blas-ext-base-dsapxsumpw"
77
+ "@stdlib/blas-ext-base-dsapxsumpw",
78
+ "@stdlib/blas-base-shared",
79
+ "@stdlib/strided-base-stride2offset"
79
80
  ]
80
81
  }
81
82
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-dsapxsum",
3
- "version": "0.2.2",
4
- "description": "Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.",
3
+ "version": "0.3.0",
4
+ "description": "Add a constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
7
7
  "name": "The Stdlib Authors",
@@ -35,14 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@stdlib/assert-is-error": "^0.2.2",
38
- "@stdlib/blas-ext-base-dsapxsumpw": "^0.2.1",
38
+ "@stdlib/blas-base-shared": "^0.1.0",
39
+ "@stdlib/blas-ext-base-dsapxsumpw": "^0.3.0",
39
40
  "@stdlib/napi-argv": "^0.2.2",
40
41
  "@stdlib/napi-argv-float": "^0.2.2",
41
42
  "@stdlib/napi-argv-int64": "^0.2.2",
42
43
  "@stdlib/napi-argv-strided-float32array": "^0.2.2",
43
- "@stdlib/napi-export": "^0.2.2",
44
+ "@stdlib/napi-create-double": "^0.0.2",
45
+ "@stdlib/napi-export": "^0.3.0",
46
+ "@stdlib/strided-base-stride2offset": "^0.1.0",
44
47
  "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
45
- "@stdlib/utils-library-manifest": "^0.2.2",
48
+ "@stdlib/utils-library-manifest": "^0.2.3",
46
49
  "@stdlib/utils-try-require": "^0.2.2"
47
50
  },
48
51
  "devDependencies": {},
@@ -82,9 +85,6 @@
82
85
  "float",
83
86
  "float32array"
84
87
  ],
85
- "__stdlib__": {
86
- "wasm": false
87
- },
88
88
  "funding": {
89
89
  "type": "opencollective",
90
90
  "url": "https://opencollective.com/stdlib"
package/src/addon.c CHANGED
@@ -17,13 +17,14 @@
17
17
  */
18
18
 
19
19
  #include "stdlib/blas/ext/base/dsapxsum.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_float.h"
24
25
  #include "stdlib/napi/argv_strided_float32array.h"
26
+ #include "stdlib/napi/create_double.h"
25
27
  #include <node_api.h>
26
- #include <assert.h>
27
28
 
28
29
  /**
29
30
  * Receives JavaScript callback invocation data.
@@ -35,14 +36,29 @@
35
36
  static napi_value addon( napi_env env, napi_callback_info info ) {
36
37
  STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
37
38
  STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
38
- STDLIB_NAPI_ARGV_FLOAT( env, N, argv, 1 );
39
- STDLIB_NAPI_ARGV_INT64( env, stride, argv, 3 );
40
- STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, stride, argv, 2 );
39
+ STDLIB_NAPI_ARGV_FLOAT( env, alpha, argv, 1 );
40
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
41
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 );
42
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsapxsum)( N, alpha, X, strideX ), v );
43
+ return v;
44
+ }
41
45
 
42
- napi_value v;
43
- status = napi_create_double( env, stdlib_strided_dsapxsum( N, alpha, X, stride ), &v );
44
- assert( status == napi_ok );
46
+ /**
47
+ * Receives JavaScript callback invocation data.
48
+ *
49
+ * @param env environment under which the function is invoked
50
+ * @param info callback data
51
+ * @return Node-API value
52
+ */
53
+ static napi_value addon_method( napi_env env, napi_callback_info info ) {
54
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 5 );
55
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
56
+ STDLIB_NAPI_ARGV_FLOAT( env, alpha, argv, 1 );
57
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
58
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
59
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 );
60
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsapxsum_ndarray)( N, alpha, X, strideX, offsetX ), v );
45
61
  return v;
46
62
  }
47
63
 
48
- STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
64
+ STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
package/src/main.c ADDED
@@ -0,0 +1,50 @@
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/dsapxsum.h"
20
+ #include "stdlib/blas/ext/base/dsapxsumpw.h"
21
+ #include "stdlib/blas/base/shared.h"
22
+ #include "stdlib/strided/base/stride2offset.h"
23
+
24
+ /**
25
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.
26
+ *
27
+ * @param N number of indexed elements
28
+ * @param alpha scalar constant
29
+ * @param X input array
30
+ * @param strideX stride length
31
+ * @return output value
32
+ */
33
+ double API_SUFFIX(stdlib_strided_dsapxsum)( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX ) {
34
+ CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
35
+ return API_SUFFIX(stdlib_strided_dsapxsum_ndarray)( N, alpha, X, strideX, ox );
36
+ }
37
+
38
+ /**
39
+ * Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and using alternative indexing semantics and returning an extended precision result.
40
+ *
41
+ * @param N number of indexed elements
42
+ * @param alpha scalar constant
43
+ * @param X input array
44
+ * @param strideX stride length
45
+ * @param offsetX starting index
46
+ * @return output value
47
+ */
48
+ double API_SUFFIX(stdlib_strided_dsapxsum_ndarray)( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
49
+ return API_SUFFIX(stdlib_strided_dsapxsumpw_ndarray)( N, alpha, X, strideX, offsetX );
50
+ }
package/src/dsapxsum.c DELETED
@@ -1,34 +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/dsapxsum.h"
20
- #include "stdlib/blas/ext/base/dsapxsumpw.h"
21
- #include <stdint.h>
22
-
23
- /**
24
- * Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
25
- *
26
- * @param N number of indexed elements
27
- * @param alpha constant
28
- * @param X input array
29
- * @param stride stride length
30
- * @return output value
31
- */
32
- double stdlib_strided_dsapxsum( const int64_t N, const float alpha, const float *X, const int64_t stride ) {
33
- return stdlib_strided_dsapxsumpw( N, alpha, X, stride );
34
- }