@stdlib/blas-ext-base-dsapxsum 0.2.1 → 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 +1 -1
- package/README.md +145 -40
- package/dist/index.js +7 -7
- package/dist/index.js.map +4 -4
- package/docs/types/index.d.ts +12 -12
- package/include/stdlib/blas/ext/base/dsapxsum.h +8 -6
- package/lib/dsapxsum.js +8 -8
- package/lib/dsapxsum.native.js +6 -7
- package/lib/index.js +3 -6
- package/lib/ndarray.js +7 -9
- package/lib/ndarray.native.js +8 -16
- package/manifest.json +81 -40
- package/package.json +15 -8
- package/src/addon.c +64 -0
- package/src/main.c +50 -0
- package/include.gypi +0 -53
- package/src/addon.cpp +0 -130
- package/src/dsapxsum.c +0 -34
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
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,36 +59,34 @@ 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,
|
|
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
|
-
var N = x.length;
|
|
71
70
|
|
|
72
|
-
var v = dsapxsum(
|
|
71
|
+
var v = dsapxsum( x.length, 5.0, x, 1 );
|
|
73
72
|
// returns 16.0
|
|
74
73
|
```
|
|
75
74
|
|
|
76
75
|
The function has the following parameters:
|
|
77
76
|
|
|
78
77
|
- **N**: number of indexed elements.
|
|
78
|
+
- **alpha**: scalar constant.
|
|
79
79
|
- **x**: input [`Float32Array`][@stdlib/array/float32].
|
|
80
|
-
- **
|
|
80
|
+
- **strideX**: stride length for `x`.
|
|
81
81
|
|
|
82
|
-
The `N` and
|
|
82
|
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to access every other element:
|
|
83
83
|
|
|
84
84
|
```javascript
|
|
85
85
|
var Float32Array = require( '@stdlib/array-float32' );
|
|
86
|
-
var floor = require( '@stdlib/math-base-special-floor' );
|
|
87
86
|
|
|
88
87
|
var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
|
|
89
|
-
var N = floor( x.length / 2 );
|
|
90
88
|
|
|
91
|
-
var v = dsapxsum(
|
|
89
|
+
var v = dsapxsum( 4, 5.0, x, 2 );
|
|
92
90
|
// returns 25.0
|
|
93
91
|
```
|
|
94
92
|
|
|
@@ -98,45 +96,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
|
|
|
98
96
|
|
|
99
97
|
```javascript
|
|
100
98
|
var Float32Array = require( '@stdlib/array-float32' );
|
|
101
|
-
var floor = require( '@stdlib/math-base-special-floor' );
|
|
102
99
|
|
|
103
100
|
var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
|
|
104
101
|
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
|
|
105
102
|
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
var v = dsapxsum( N, 5.0, x1, 2 );
|
|
103
|
+
var v = dsapxsum( 4, 5.0, x1, 2 );
|
|
109
104
|
// returns 25.0
|
|
110
105
|
```
|
|
111
106
|
|
|
112
|
-
#### dsapxsum.ndarray( N, alpha, x,
|
|
107
|
+
#### dsapxsum.ndarray( N, alpha, x, strideX, offsetX )
|
|
113
108
|
|
|
114
|
-
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.
|
|
115
110
|
|
|
116
111
|
```javascript
|
|
117
112
|
var Float32Array = require( '@stdlib/array-float32' );
|
|
118
113
|
|
|
119
114
|
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
|
|
120
|
-
var N = x.length;
|
|
121
115
|
|
|
122
|
-
var v = dsapxsum.ndarray(
|
|
116
|
+
var v = dsapxsum.ndarray( x.length, 5.0, x, 1, 0 );
|
|
123
117
|
// returns 16.0
|
|
124
118
|
```
|
|
125
119
|
|
|
126
120
|
The function has the following additional parameters:
|
|
127
121
|
|
|
128
|
-
- **
|
|
122
|
+
- **offsetX**: starting index for `x`.
|
|
129
123
|
|
|
130
|
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying
|
|
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:
|
|
131
125
|
|
|
132
126
|
```javascript
|
|
133
127
|
var Float32Array = require( '@stdlib/array-float32' );
|
|
134
|
-
var floor = require( '@stdlib/math-base-special-floor' );
|
|
135
128
|
|
|
136
129
|
var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
|
|
137
|
-
var N = floor( x.length / 2 );
|
|
138
130
|
|
|
139
|
-
var v = dsapxsum.ndarray(
|
|
131
|
+
var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );
|
|
140
132
|
// returns 25.0
|
|
141
133
|
```
|
|
142
134
|
|
|
@@ -162,18 +154,12 @@ var v = dsapxsum.ndarray( N, 5.0, x, 2, 1 );
|
|
|
162
154
|
<!-- eslint no-undef: "error" -->
|
|
163
155
|
|
|
164
156
|
```javascript
|
|
165
|
-
var
|
|
166
|
-
var round = require( '@stdlib/math-base-special-round' );
|
|
167
|
-
var Float32Array = require( '@stdlib/array-float32' );
|
|
157
|
+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
|
|
168
158
|
var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
|
|
169
159
|
|
|
170
|
-
var x
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
x = new Float32Array( 10 );
|
|
174
|
-
for ( i = 0; i < x.length; i++ ) {
|
|
175
|
-
x[ i ] = round( randu()*100.0 );
|
|
176
|
-
}
|
|
160
|
+
var x = discreteUniform( 10, -100, 100, {
|
|
161
|
+
'dtype': 'float32'
|
|
162
|
+
});
|
|
177
163
|
console.log( x );
|
|
178
164
|
|
|
179
165
|
var v = dsapxsum( x.length, 5.0, x, 1 );
|
|
@@ -184,6 +170,125 @@ console.log( v );
|
|
|
184
170
|
|
|
185
171
|
<!-- /.examples -->
|
|
186
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
|
+
|
|
187
292
|
<section class="references">
|
|
188
293
|
|
|
189
294
|
</section>
|
|
@@ -198,9 +303,9 @@ console.log( v );
|
|
|
198
303
|
|
|
199
304
|
## See Also
|
|
200
305
|
|
|
201
|
-
- <span class="package-name">[`@stdlib/blas-ext/base/dapxsum`][@stdlib/blas/ext/base/dapxsum]</span><span class="delimiter">: </span><span class="description">
|
|
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>
|
|
202
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>
|
|
203
|
-
- <span class="package-name">[`@stdlib/blas-ext/base/sapxsum`][@stdlib/blas/ext/base/sapxsum]</span><span class="delimiter">: </span><span class="description">
|
|
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>
|
|
204
309
|
|
|
205
310
|
</section>
|
|
206
311
|
|
|
@@ -232,7 +337,7 @@ See [LICENSE][stdlib-license].
|
|
|
232
337
|
|
|
233
338
|
## Copyright
|
|
234
339
|
|
|
235
|
-
Copyright © 2016-
|
|
340
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
236
341
|
|
|
237
342
|
</section>
|
|
238
343
|
|
|
@@ -245,8 +350,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
245
350
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsapxsum.svg
|
|
246
351
|
[npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsapxsum
|
|
247
352
|
|
|
248
|
-
[test-image]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
249
|
-
[test-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml?query=branch:v0.
|
|
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
|
|
250
355
|
|
|
251
356
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsapxsum/main.svg
|
|
252
357
|
[coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsapxsum?branch=main
|
|
@@ -258,8 +363,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
258
363
|
|
|
259
364
|
-->
|
|
260
365
|
|
|
261
|
-
[chat-image]: https://img.shields.io/
|
|
262
|
-
[chat-url]: https://
|
|
366
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
367
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
263
368
|
|
|
264
369
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
265
370
|
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
var c=require('@stdlib/blas-ext-base-dsapxsumpw/dist');function y(e,r,s,a){return c(e,r,s,a)}
|
|
3
|
-
});var
|
|
4
|
-
var f=require('@stdlib/
|
|
5
|
-
});var
|
|
6
|
-
var
|
|
7
|
-
});var
|
|
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/
|
|
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}
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,
|
|
6
|
-
"names": ["
|
|
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
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
|
51
|
-
* @param
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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,31 +20,31 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
-
var
|
|
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}
|
|
35
|
+
* @param {integer} strideX - stride length
|
|
35
36
|
* @returns {number} sum
|
|
36
37
|
*
|
|
37
38
|
* @example
|
|
38
39
|
* var Float32Array = require( '@stdlib/array-float32' );
|
|
39
40
|
*
|
|
40
41
|
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
|
|
41
|
-
* var N = x.length;
|
|
42
42
|
*
|
|
43
|
-
* var v = dsapxsum(
|
|
43
|
+
* var v = dsapxsum( x.length, 5.0, x, 1 );
|
|
44
44
|
* // returns 16.0
|
|
45
45
|
*/
|
|
46
|
-
function dsapxsum( N, alpha, x,
|
|
47
|
-
return
|
|
46
|
+
function dsapxsum( N, alpha, x, strideX ) {
|
|
47
|
+
return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) );
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
package/lib/dsapxsum.native.js
CHANGED
|
@@ -26,25 +26,24 @@ 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}
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
35
|
* @returns {number} sum
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* var Float32Array = require( '@stdlib/array-float32' );
|
|
39
39
|
*
|
|
40
40
|
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
|
|
41
|
-
* var N = x.length;
|
|
42
41
|
*
|
|
43
|
-
* var v = dsapxsum(
|
|
42
|
+
* var v = dsapxsum( x.length, 5.0, x, 1 );
|
|
44
43
|
* // returns 16.0
|
|
45
44
|
*/
|
|
46
|
-
function dsapxsum( N, alpha, x,
|
|
47
|
-
return addon( N, alpha, x,
|
|
45
|
+
function dsapxsum( N, alpha, x, strideX ) {
|
|
46
|
+
return addon( N, alpha, x, strideX );
|
|
48
47
|
}
|
|
49
48
|
|
|
50
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
|
*
|
|
@@ -28,20 +28,17 @@
|
|
|
28
28
|
* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
|
|
29
29
|
*
|
|
30
30
|
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
|
|
31
|
-
* var N = x.length;
|
|
32
31
|
*
|
|
33
|
-
* var v = dsapxsum(
|
|
32
|
+
* var v = dsapxsum( x.length, 5.0, x, 1 );
|
|
34
33
|
* // returns 16.0
|
|
35
34
|
*
|
|
36
35
|
* @example
|
|
37
36
|
* var Float32Array = require( '@stdlib/array-float32' );
|
|
38
|
-
* var floor = require( '@stdlib/math-base-special-floor' );
|
|
39
37
|
* var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
|
|
40
38
|
*
|
|
41
39
|
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
|
|
42
|
-
* var N = floor( x.length / 2 );
|
|
43
40
|
*
|
|
44
|
-
* var v = dsapxsum.ndarray(
|
|
41
|
+
* var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );
|
|
45
42
|
* // returns 25.0
|
|
46
43
|
*/
|
|
47
44
|
|
package/lib/ndarray.js
CHANGED
|
@@ -26,27 +26,25 @@ 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}
|
|
35
|
-
* @param {NonNegativeInteger}
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
|
+
* @param {NonNegativeInteger} offsetX - starting index
|
|
36
36
|
* @returns {number} sum
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* var Float32Array = require( '@stdlib/array-float32' );
|
|
40
|
-
* var floor = require( '@stdlib/math-base-special-floor' );
|
|
41
40
|
*
|
|
42
41
|
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
|
|
43
|
-
* var N = floor( x.length / 2 );
|
|
44
42
|
*
|
|
45
|
-
* var v = dsapxsum(
|
|
43
|
+
* var v = dsapxsum( 4, 5.0, x, 2, 1 );
|
|
46
44
|
* // returns 25.0
|
|
47
45
|
*/
|
|
48
|
-
function dsapxsum( N, alpha, x,
|
|
49
|
-
return dsapxsumpw( N, alpha, x,
|
|
46
|
+
function dsapxsum( N, alpha, x, strideX, offsetX ) {
|
|
47
|
+
return dsapxsumpw( N, alpha, x, strideX, offsetX );
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
|
package/lib/ndarray.native.js
CHANGED
|
@@ -20,39 +20,31 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
-
var
|
|
24
|
-
var addon = require( './dsapxsum.native.js' );
|
|
23
|
+
var addon = require( './../src/addon.node' );
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
// MAIN //
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
|
-
* 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.
|
|
31
30
|
*
|
|
32
31
|
* @param {PositiveInteger} N - number of indexed elements
|
|
33
|
-
* @param {number} alpha - constant
|
|
32
|
+
* @param {number} alpha - scalar constant
|
|
34
33
|
* @param {Float32Array} x - input array
|
|
35
|
-
* @param {integer}
|
|
36
|
-
* @param {NonNegativeInteger}
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
|
+
* @param {NonNegativeInteger} offsetX - starting index
|
|
37
36
|
* @returns {number} sum
|
|
38
37
|
*
|
|
39
38
|
* @example
|
|
40
39
|
* var Float32Array = require( '@stdlib/array-float32' );
|
|
41
|
-
* var floor = require( '@stdlib/math-base-special-floor' );
|
|
42
40
|
*
|
|
43
41
|
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
|
|
44
|
-
* var N = floor( x.length / 2 );
|
|
45
42
|
*
|
|
46
|
-
* var v = dsapxsum(
|
|
43
|
+
* var v = dsapxsum( 4, 5.0, x, 2, 1 );
|
|
47
44
|
* // returns 25.0
|
|
48
45
|
*/
|
|
49
|
-
function dsapxsum( N, alpha, x,
|
|
50
|
-
|
|
51
|
-
if ( stride < 0 ) {
|
|
52
|
-
offset += (N-1) * stride;
|
|
53
|
-
}
|
|
54
|
-
view = new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len
|
|
55
|
-
return addon( N, alpha, view, stride );
|
|
46
|
+
function dsapxsum( N, alpha, x, strideX, offsetX ) {
|
|
47
|
+
return addon.ndarray( N, alpha, x, strideX, offsetX );
|
|
56
48
|
}
|
|
57
49
|
|
|
58
50
|
|
package/manifest.json
CHANGED
|
@@ -1,42 +1,83 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"options": {
|
|
3
|
+
"task": "build"
|
|
4
|
+
},
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"field": "src",
|
|
8
|
+
"resolve": true,
|
|
9
|
+
"relative": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"field": "include",
|
|
13
|
+
"resolve": true,
|
|
14
|
+
"relative": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"field": "libraries",
|
|
18
|
+
"resolve": false,
|
|
19
|
+
"relative": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"field": "libpath",
|
|
23
|
+
"resolve": true,
|
|
24
|
+
"relative": false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"confs": [
|
|
28
|
+
{
|
|
29
|
+
"task": "build",
|
|
30
|
+
"src": [
|
|
31
|
+
"./src/main.c"
|
|
32
|
+
],
|
|
33
|
+
"include": [
|
|
34
|
+
"./include"
|
|
35
|
+
],
|
|
36
|
+
"libraries": [],
|
|
37
|
+
"libpath": [],
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"@stdlib/napi-export",
|
|
40
|
+
"@stdlib/napi-argv",
|
|
41
|
+
"@stdlib/napi-argv-int64",
|
|
42
|
+
"@stdlib/napi-argv-float",
|
|
43
|
+
"@stdlib/napi-argv-strided-float32array",
|
|
44
|
+
"@stdlib/blas-ext-base-dsapxsumpw",
|
|
45
|
+
"@stdlib/blas-base-shared",
|
|
46
|
+
"@stdlib/strided-base-stride2offset",
|
|
47
|
+
"@stdlib/napi-create-double"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"task": "benchmark",
|
|
52
|
+
"src": [
|
|
53
|
+
"./src/main.c"
|
|
54
|
+
],
|
|
55
|
+
"include": [
|
|
56
|
+
"./include"
|
|
57
|
+
],
|
|
58
|
+
"libraries": [],
|
|
59
|
+
"libpath": [],
|
|
60
|
+
"dependencies": [
|
|
61
|
+
"@stdlib/blas-ext-base-dsapxsumpw",
|
|
62
|
+
"@stdlib/blas-base-shared",
|
|
63
|
+
"@stdlib/strided-base-stride2offset"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"task": "examples",
|
|
68
|
+
"src": [
|
|
69
|
+
"./src/main.c"
|
|
70
|
+
],
|
|
71
|
+
"include": [
|
|
72
|
+
"./include"
|
|
73
|
+
],
|
|
74
|
+
"libraries": [],
|
|
75
|
+
"libpath": [],
|
|
76
|
+
"dependencies": [
|
|
77
|
+
"@stdlib/blas-ext-base-dsapxsumpw",
|
|
78
|
+
"@stdlib/blas-base-shared",
|
|
79
|
+
"@stdlib/strided-base-stride2offset"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
42
83
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-ext-base-dsapxsum",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
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",
|
|
@@ -34,11 +34,19 @@
|
|
|
34
34
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stdlib/assert-is-error": "^0.2.
|
|
38
|
-
"@stdlib/blas-
|
|
39
|
-
"@stdlib/
|
|
40
|
-
"@stdlib/
|
|
41
|
-
"@stdlib/
|
|
37
|
+
"@stdlib/assert-is-error": "^0.2.2",
|
|
38
|
+
"@stdlib/blas-base-shared": "^0.1.0",
|
|
39
|
+
"@stdlib/blas-ext-base-dsapxsumpw": "^0.3.0",
|
|
40
|
+
"@stdlib/napi-argv": "^0.2.2",
|
|
41
|
+
"@stdlib/napi-argv-float": "^0.2.2",
|
|
42
|
+
"@stdlib/napi-argv-int64": "^0.2.2",
|
|
43
|
+
"@stdlib/napi-argv-strided-float32array": "^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",
|
|
47
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
|
|
48
|
+
"@stdlib/utils-library-manifest": "^0.2.3",
|
|
49
|
+
"@stdlib/utils-try-require": "^0.2.2"
|
|
42
50
|
},
|
|
43
51
|
"devDependencies": {},
|
|
44
52
|
"engines": {
|
|
@@ -77,7 +85,6 @@
|
|
|
77
85
|
"float",
|
|
78
86
|
"float32array"
|
|
79
87
|
],
|
|
80
|
-
"__stdlib__": {},
|
|
81
88
|
"funding": {
|
|
82
89
|
"type": "opencollective",
|
|
83
90
|
"url": "https://opencollective.com/stdlib"
|
package/src/addon.c
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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/base/shared.h"
|
|
21
|
+
#include "stdlib/napi/export.h"
|
|
22
|
+
#include "stdlib/napi/argv.h"
|
|
23
|
+
#include "stdlib/napi/argv_int64.h"
|
|
24
|
+
#include "stdlib/napi/argv_float.h"
|
|
25
|
+
#include "stdlib/napi/argv_strided_float32array.h"
|
|
26
|
+
#include "stdlib/napi/create_double.h"
|
|
27
|
+
#include <node_api.h>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Receives JavaScript callback invocation data.
|
|
31
|
+
*
|
|
32
|
+
* @param env environment under which the function is invoked
|
|
33
|
+
* @param info callback data
|
|
34
|
+
* @return Node-API value
|
|
35
|
+
*/
|
|
36
|
+
static napi_value addon( napi_env env, napi_callback_info info ) {
|
|
37
|
+
STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
|
|
38
|
+
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
|
|
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
|
+
}
|
|
45
|
+
|
|
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 );
|
|
61
|
+
return v;
|
|
62
|
+
}
|
|
63
|
+
|
|
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/include.gypi
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2020 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A GYP include file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# Main documentation:
|
|
20
|
-
#
|
|
21
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
22
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
23
|
-
{
|
|
24
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
25
|
-
'variables': {
|
|
26
|
-
# Source directory:
|
|
27
|
-
'src_dir': './src',
|
|
28
|
-
|
|
29
|
-
# Include directories:
|
|
30
|
-
'include_dirs': [
|
|
31
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
# Add-on destination directory:
|
|
35
|
-
'addon_output_dir': './src',
|
|
36
|
-
|
|
37
|
-
# Source files:
|
|
38
|
-
'src_files': [
|
|
39
|
-
'<(src_dir)/addon.cpp',
|
|
40
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
# Library dependencies:
|
|
44
|
-
'libraries': [
|
|
45
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
# Library directories:
|
|
49
|
-
'library_dirs': [
|
|
50
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
51
|
-
],
|
|
52
|
-
}, # end variables
|
|
53
|
-
}
|
package/src/addon.cpp
DELETED
|
@@ -1,130 +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 <node_api.h>
|
|
21
|
-
#include <stdint.h>
|
|
22
|
-
#include <stdlib.h>
|
|
23
|
-
#include <stdbool.h>
|
|
24
|
-
#include <assert.h>
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Add-on namespace.
|
|
28
|
-
*/
|
|
29
|
-
namespace stdlib_blas_ext_base_dsapxsum {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 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.
|
|
33
|
-
*
|
|
34
|
-
* ## Notes
|
|
35
|
-
*
|
|
36
|
-
* - When called from JavaScript, the function expects four arguments:
|
|
37
|
-
*
|
|
38
|
-
* - `N`: number of indexed elements
|
|
39
|
-
* - `alpha`: constant
|
|
40
|
-
* - `X`: input array
|
|
41
|
-
* - `stride`: stride length
|
|
42
|
-
*/
|
|
43
|
-
napi_value node_dsapxsum( napi_env env, napi_callback_info info ) {
|
|
44
|
-
napi_status status;
|
|
45
|
-
|
|
46
|
-
size_t argc = 4;
|
|
47
|
-
napi_value argv[ 4 ];
|
|
48
|
-
status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr );
|
|
49
|
-
assert( status == napi_ok );
|
|
50
|
-
|
|
51
|
-
if ( argc < 4 ) {
|
|
52
|
-
napi_throw_error( env, nullptr, "invalid invocation. Must provide 4 arguments." );
|
|
53
|
-
return nullptr;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
napi_valuetype vtype0;
|
|
57
|
-
status = napi_typeof( env, argv[ 0 ], &vtype0 );
|
|
58
|
-
assert( status == napi_ok );
|
|
59
|
-
if ( vtype0 != napi_number ) {
|
|
60
|
-
napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." );
|
|
61
|
-
return nullptr;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
napi_valuetype vtype1;
|
|
65
|
-
status = napi_typeof( env, argv[ 1 ], &vtype1 );
|
|
66
|
-
assert( status == napi_ok );
|
|
67
|
-
if ( vtype1 != napi_number ) {
|
|
68
|
-
napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a number." );
|
|
69
|
-
return nullptr;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
bool res;
|
|
73
|
-
status = napi_is_typedarray( env, argv[ 2 ], &res );
|
|
74
|
-
assert( status == napi_ok );
|
|
75
|
-
if ( res == false ) {
|
|
76
|
-
napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." );
|
|
77
|
-
return nullptr;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
napi_valuetype vtype3;
|
|
81
|
-
status = napi_typeof( env, argv[ 3 ], &vtype3 );
|
|
82
|
-
assert( status == napi_ok );
|
|
83
|
-
if ( vtype3 != napi_number ) {
|
|
84
|
-
napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a number." );
|
|
85
|
-
return nullptr;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
int64_t N;
|
|
89
|
-
status = napi_get_value_int64( env, argv[ 0 ], &N );
|
|
90
|
-
assert( status == napi_ok );
|
|
91
|
-
|
|
92
|
-
double alpha;
|
|
93
|
-
status = napi_get_value_double( env, argv[ 1 ], &alpha );
|
|
94
|
-
assert( status == napi_ok );
|
|
95
|
-
|
|
96
|
-
int64_t stride;
|
|
97
|
-
status = napi_get_value_int64( env, argv[ 3 ], &stride );
|
|
98
|
-
assert( status == napi_ok );
|
|
99
|
-
|
|
100
|
-
napi_typedarray_type vtype2;
|
|
101
|
-
size_t xlen;
|
|
102
|
-
void *X;
|
|
103
|
-
status = napi_get_typedarray_info( env, argv[ 2 ], &vtype2, &xlen, &X, nullptr, nullptr );
|
|
104
|
-
assert( status == napi_ok );
|
|
105
|
-
if ( vtype2 != napi_float32_array ) {
|
|
106
|
-
napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." );
|
|
107
|
-
return nullptr;
|
|
108
|
-
}
|
|
109
|
-
if ( (N-1)*llabs(stride) >= (int64_t)xlen ) {
|
|
110
|
-
napi_throw_range_error( env, nullptr, "invalid argument. Third argument has insufficient elements based on the associated stride and the number of indexed elements." );
|
|
111
|
-
return nullptr;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
napi_value v;
|
|
115
|
-
status = napi_create_double( env, stdlib_strided_dsapxsum( N, (float)alpha, (float *)X, stride ), &v );
|
|
116
|
-
assert( status == napi_ok );
|
|
117
|
-
|
|
118
|
-
return v;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
napi_value Init( napi_env env, napi_value exports ) {
|
|
122
|
-
napi_status status;
|
|
123
|
-
napi_value fcn;
|
|
124
|
-
status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_dsapxsum, NULL, &fcn );
|
|
125
|
-
assert( status == napi_ok );
|
|
126
|
-
return fcn;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, Init )
|
|
130
|
-
} // end namespace stdlib_blas_ext_base_dsapxsum
|
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
|
-
}
|