@stdlib/blas-ext-base-dsapxsum 0.0.10 → 0.2.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-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # dsapxsum
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -187,9 +198,9 @@ console.log( v );
187
198
 
188
199
  ## See Also
189
200
 
190
- - <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>
191
- - <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>
192
- - <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>
201
+ - <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>
202
+ - <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">adds a constant to each single-precision floating-point strided array element and computes the sum.</span>
193
204
 
194
205
  </section>
195
206
 
@@ -221,7 +232,7 @@ See [LICENSE][stdlib-license].
221
232
 
222
233
  ## Copyright
223
234
 
224
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
235
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
225
236
 
226
237
  </section>
227
238
 
@@ -234,8 +245,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
234
245
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsapxsum.svg
235
246
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsapxsum
236
247
 
237
- [test-image]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml/badge.svg?branch=v0.0.10
238
- [test-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml?query=branch:v0.0.10
248
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml/badge.svg?branch=v0.2.0
249
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/actions/workflows/test.yml?query=branch:v0.2.0
239
250
 
240
251
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsapxsum/main.svg
241
252
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsapxsum?branch=main
@@ -248,7 +259,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
248
259
  -->
249
260
 
250
261
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
251
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
262
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
252
263
 
253
264
  [stdlib]: https://github.com/stdlib-js/stdlib
254
265
 
@@ -258,8 +269,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
258
269
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
259
270
 
260
271
  [deno-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/tree/deno
272
+ [deno-readme]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/blob/deno/README.md
261
273
  [umd-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/tree/umd
274
+ [umd-readme]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/blob/umd/README.md
262
275
  [esm-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/tree/esm
276
+ [esm-readme]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/blob/esm/README.md
263
277
  [branches-url]: https://github.com/stdlib-js/blas-ext-base-dsapxsum/blob/main/branches.md
264
278
 
265
279
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-dsapxsum/main/LICENSE
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import dsapxsum from '../docs/types/index';
3
+ export = dsapxsum;
package/dist/index.js ADDED
@@ -0,0 +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;
8
+ /** @license Apache-2.0 */
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
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* var N = x.length;\n*\n* var v = dsapxsum( N, 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* var floor = require( '@stdlib/math-base-special-floor' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n* var N = floor( x.length / 2 );\n*\n* var v = dsapxsum( N, 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* var N = x.length;\n*\n* var v = dsapxsum( N, 5.0, x, 1 );\n* // returns 16.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var floor = require( '@stdlib/math-base-special-floor' );\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* var N = floor( x.length / 2 );\n*\n* var v = dsapxsum.ndarray( N, 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,EAuB7D,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAS,CACxC,OAAOL,EAAYE,EAAGC,EAAOC,EAAGC,CAAO,CACxC,CAKAN,EAAO,QAAUE,ICpDjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAyB/D,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAQC,EAAS,CAChD,OAAON,EAAYE,EAAGC,EAAOC,EAAGC,EAAQC,CAAO,CAChD,CAKAP,EAAO,QAAUE,ICtDjB,IAAAM,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAW,IACXC,EAAU,IAKdF,EAAaC,EAAU,UAAWC,CAAQ,EAK1CH,EAAO,QAAUE,ICejB,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"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Interface describing `dsapxsum`.
@@ -32,7 +32,7 @@ interface Routine {
32
32
  * @returns sum
33
33
  *
34
34
  * @example
35
- * var Float32Array = require( `@stdlib/array/float32` );
35
+ * var Float32Array = require( '@stdlib/array-float32' );
36
36
  *
37
37
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
38
38
  *
@@ -52,14 +52,14 @@ interface Routine {
52
52
  * @returns sum
53
53
  *
54
54
  * @example
55
- * var Float32Array = require( `@stdlib/array/float32` );
55
+ * var Float32Array = require( '@stdlib/array-float32' );
56
56
  *
57
57
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
58
58
  *
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; // tslint:disable-line:max-line-length
62
+ ndarray( N: number, alpha: number, x: Float32Array, stride: number, offset: number ): number;
63
63
  }
64
64
 
65
65
  /**
@@ -72,7 +72,7 @@ interface Routine {
72
72
  * @returns sum
73
73
  *
74
74
  * @example
75
- * var Float32Array = require( `@stdlib/array/float32` );
75
+ * var Float32Array = require( '@stdlib/array-float32' );
76
76
  *
77
77
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
78
78
  *
@@ -80,7 +80,7 @@ interface Routine {
80
80
  * // returns 16.0
81
81
  *
82
82
  * @example
83
- * var Float32Array = require( `@stdlib/array/float32` );
83
+ * var Float32Array = require( '@stdlib/array-float32' );
84
84
  *
85
85
  * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
86
86
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-dsapxsum",
3
- "version": "0.0.10",
3
+ "version": "0.2.0",
4
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.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -41,25 +41,26 @@
41
41
  "url": "https://github.com/stdlib-js/stdlib/issues"
42
42
  },
43
43
  "dependencies": {
44
- "@stdlib/assert-is-error": "^0.0.x",
45
- "@stdlib/blas-ext-base-dsapxsumpw": "^0.0.x",
46
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
47
- "@stdlib/utils-library-manifest": "^0.0.x",
48
- "@stdlib/utils-try-require": "^0.0.x"
44
+ "@stdlib/assert-is-error": "^0.2.0",
45
+ "@stdlib/blas-ext-base-dsapxsumpw": "^0.2.0",
46
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0",
47
+ "@stdlib/utils-library-manifest": "^0.2.0",
48
+ "@stdlib/utils-try-require": "^0.2.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@stdlib/array-float32": "^0.0.x",
52
- "@stdlib/assert-is-browser": "^0.0.x",
53
- "@stdlib/bench": "^0.0.x",
54
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
55
- "@stdlib/math-base-special-floor": "^0.0.x",
56
- "@stdlib/math-base-special-pow": "^0.0.x",
57
- "@stdlib/math-base-special-round": "^0.0.x",
58
- "@stdlib/random-base-randu": "^0.0.x",
51
+ "@stdlib/array-float32": "^0.1.1",
52
+ "@stdlib/assert-is-browser": "^0.1.1",
53
+ "@stdlib/math-base-assert-is-nan": "^0.1.1",
54
+ "@stdlib/math-base-special-floor": "^0.1.1",
55
+ "@stdlib/math-base-special-pow": "^0.1.0",
56
+ "@stdlib/math-base-special-round": "^0.1.1",
57
+ "@stdlib/random-base-randu": "^0.1.0",
59
58
  "proxyquire": "^2.0.0",
60
59
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
61
60
  "istanbul": "^0.4.1",
62
- "tap-spec": "5.x.x"
61
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
62
+ "@stdlib/bench-harness": "^0.2.0",
63
+ "@stdlib/bench": "^0.3.1"
63
64
  },
64
65
  "engines": {
65
66
  "node": ">=0.10.0",
@@ -99,7 +100,7 @@
99
100
  ],
100
101
  "__stdlib__": {},
101
102
  "funding": {
102
- "type": "patreon",
103
- "url": "https://www.patreon.com/athan"
103
+ "type": "opencollective",
104
+ "url": "https://opencollective.com/stdlib"
104
105
  }
105
106
  }
package/docs/repl.txt DELETED
@@ -1,102 +0,0 @@
1
-
2
- {{alias}}( N, alpha, x, stride )
3
- Adds a constant to each single-precision floating-point strided array
4
- element and computes the sum using extended accumulation and returning an
5
- extended precision result.
6
-
7
- The `N` and `stride` parameters determine which elements in `x` are accessed
8
- at runtime.
9
-
10
- Indexing is relative to the first index. To introduce an offset, use a typed
11
- array view.
12
-
13
- If `N <= 0`, the function returns `0.0`.
14
-
15
- Parameters
16
- ----------
17
- N: integer
18
- Number of indexed elements.
19
-
20
- alpha: number
21
- Constant.
22
-
23
- x: Float32Array
24
- Input array.
25
-
26
- stride: integer
27
- Index increment.
28
-
29
- Returns
30
- -------
31
- out: number
32
- Sum.
33
-
34
- Examples
35
- --------
36
- // Standard Usage:
37
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
38
- > {{alias}}( x.length, 5.0, x, 1 )
39
- 16.0
40
-
41
- // Using `N` and `stride` parameters:
42
- > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
43
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
44
- > var stride = 2;
45
- > {{alias}}( N, 5.0, x, stride )
46
- 16.0
47
-
48
- // Using view offsets:
49
- > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
50
- > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
51
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
52
- > stride = 2;
53
- > {{alias}}( N, 5.0, x1, stride )
54
- 14.0
55
-
56
- {{alias}}.ndarray( N, alpha, x, stride, offset )
57
- Adds a constant to each single-precision floating-point strided array
58
- element and computes the sum using extended accumulation and alternative
59
- indexing semantics and returning an extended precision result.
60
-
61
- While typed array views mandate a view offset based on the underlying
62
- buffer, the `offset` parameter supports indexing semantics based on a
63
- starting index.
64
-
65
- Parameters
66
- ----------
67
- N: integer
68
- Number of indexed elements.
69
-
70
- alpha: number
71
- Constant.
72
-
73
- x: Float32Array
74
- Input array.
75
-
76
- stride: integer
77
- Index increment.
78
-
79
- offset: integer
80
- Starting index.
81
-
82
- Returns
83
- -------
84
- out: number
85
- Sum.
86
-
87
- Examples
88
- --------
89
- // Standard Usage:
90
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
91
- > {{alias}}.ndarray( x.length, 5.0, x, 1, 0 )
92
- 16.0
93
-
94
- // Using offset parameter:
95
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
96
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
97
- > {{alias}}.ndarray( N, 5.0, x, 2, 1 )
98
- 14.0
99
-
100
- See Also
101
- --------
102
-
@@ -1,187 +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
- import dsapxsum = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- const x = new Float32Array( 10 );
27
-
28
- dsapxsum( x.length, 5.0, x, 1 ); // $ExpectType number
29
- }
30
-
31
- // The compiler throws an error if the function is provided a first argument which is not a number...
32
- {
33
- const x = new Float32Array( 10 );
34
-
35
- dsapxsum( '10', 5.0, x, 1 ); // $ExpectError
36
- dsapxsum( true, 5.0, x, 1 ); // $ExpectError
37
- dsapxsum( false, 5.0, x, 1 ); // $ExpectError
38
- dsapxsum( null, 5.0, x, 1 ); // $ExpectError
39
- dsapxsum( undefined, 5.0, x, 1 ); // $ExpectError
40
- dsapxsum( [], 5.0, x, 1 ); // $ExpectError
41
- dsapxsum( {}, 5.0, x, 1 ); // $ExpectError
42
- dsapxsum( ( x: number ): number => x, 5.0, x, 1 ); // $ExpectError
43
- }
44
-
45
- // The compiler throws an error if the function is provided a second argument which is not a number...
46
- {
47
- const x = new Float32Array( 10 );
48
-
49
- dsapxsum( x.length, '10', x, 1 ); // $ExpectError
50
- dsapxsum( x.length, true, x, 1 ); // $ExpectError
51
- dsapxsum( x.length, false, x, 1 ); // $ExpectError
52
- dsapxsum( x.length, null, x, 1 ); // $ExpectError
53
- dsapxsum( x.length, undefined, x, 1 ); // $ExpectError
54
- dsapxsum( x.length, [], x, 1 ); // $ExpectError
55
- dsapxsum( x.length, {}, x, 1 ); // $ExpectError
56
- dsapxsum( x.length, ( x: number ): number => x, x, 1 ); // $ExpectError
57
- }
58
-
59
- // The compiler throws an error if the function is provided a third argument which is not a Float32Array...
60
- {
61
- const x = new Float32Array( 10 );
62
-
63
- dsapxsum( x.length, 5.0, 10, 1 ); // $ExpectError
64
- dsapxsum( x.length, 5.0, '10', 1 ); // $ExpectError
65
- dsapxsum( x.length, 5.0, true, 1 ); // $ExpectError
66
- dsapxsum( x.length, 5.0, false, 1 ); // $ExpectError
67
- dsapxsum( x.length, 5.0, null, 1 ); // $ExpectError
68
- dsapxsum( x.length, 5.0, undefined, 1 ); // $ExpectError
69
- dsapxsum( x.length, 5.0, [], 1 ); // $ExpectError
70
- dsapxsum( x.length, 5.0, {}, 1 ); // $ExpectError
71
- dsapxsum( x.length, 5.0, ( x: number ): number => x, 1 ); // $ExpectError
72
- }
73
-
74
- // The compiler throws an error if the function is provided a fourth argument which is not a number...
75
- {
76
- const x = new Float32Array( 10 );
77
-
78
- dsapxsum( x.length, 5.0, x, '10' ); // $ExpectError
79
- dsapxsum( x.length, 5.0, x, true ); // $ExpectError
80
- dsapxsum( x.length, 5.0, x, false ); // $ExpectError
81
- dsapxsum( x.length, 5.0, x, null ); // $ExpectError
82
- dsapxsum( x.length, 5.0, x, undefined ); // $ExpectError
83
- dsapxsum( x.length, 5.0, x, [] ); // $ExpectError
84
- dsapxsum( x.length, 5.0, x, {} ); // $ExpectError
85
- dsapxsum( x.length, 5.0, x, ( x: number ): number => x ); // $ExpectError
86
- }
87
-
88
- // The compiler throws an error if the function is provided an unsupported number of arguments...
89
- {
90
- const x = new Float32Array( 10 );
91
-
92
- dsapxsum(); // $ExpectError
93
- dsapxsum( x.length ); // $ExpectError
94
- dsapxsum( x.length, 5.0 ); // $ExpectError
95
- dsapxsum( x.length, 5.0, x ); // $ExpectError
96
- dsapxsum( x.length, 5.0, x, 1, 10 ); // $ExpectError
97
- }
98
-
99
- // Attached to main export is an `ndarray` method which returns a number...
100
- {
101
- const x = new Float32Array( 10 );
102
-
103
- dsapxsum.ndarray( x.length, 5.0, x, 1, 0 ); // $ExpectType number
104
- }
105
-
106
- // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
107
- {
108
- const x = new Float32Array( 10 );
109
-
110
- dsapxsum.ndarray( '10', 5.0, x, 1, 0 ); // $ExpectError
111
- dsapxsum.ndarray( true, 5.0, x, 1, 0 ); // $ExpectError
112
- dsapxsum.ndarray( false, 5.0, x, 1, 0 ); // $ExpectError
113
- dsapxsum.ndarray( null, 5.0, x, 1, 0 ); // $ExpectError
114
- dsapxsum.ndarray( undefined, 5.0, x, 1, 0 ); // $ExpectError
115
- dsapxsum.ndarray( [], 5.0, x, 1, 0 ); // $ExpectError
116
- dsapxsum.ndarray( {}, 5.0, x, 1, 0 ); // $ExpectError
117
- dsapxsum.ndarray( ( x: number ): number => x, 5.0, x, 1, 0 ); // $ExpectError
118
- }
119
-
120
- // The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
121
- {
122
- const x = new Float32Array( 10 );
123
-
124
- dsapxsum.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError
125
- dsapxsum.ndarray( x.length, true, x, 1, 0 ); // $ExpectError
126
- dsapxsum.ndarray( x.length, false, x, 1, 0 ); // $ExpectError
127
- dsapxsum.ndarray( x.length, null, x, 1, 0 ); // $ExpectError
128
- dsapxsum.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError
129
- dsapxsum.ndarray( x.length, [], x, 1, 0 ); // $ExpectError
130
- dsapxsum.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError
131
- dsapxsum.ndarray( x.length, ( x: number ): number => x, x, 1, 0 ); // $ExpectError
132
- }
133
-
134
- // The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float32Array...
135
- {
136
- const x = new Float32Array( 10 );
137
-
138
- dsapxsum.ndarray( x.length, 5.0, 10, 1, 0 ); // $ExpectError
139
- dsapxsum.ndarray( x.length, 5.0, '10', 1, 0 ); // $ExpectError
140
- dsapxsum.ndarray( x.length, 5.0, true, 1, 0 ); // $ExpectError
141
- dsapxsum.ndarray( x.length, 5.0, false, 1, 0 ); // $ExpectError
142
- dsapxsum.ndarray( x.length, 5.0, null, 1, 0 ); // $ExpectError
143
- dsapxsum.ndarray( x.length, 5.0, undefined, 1, 0 ); // $ExpectError
144
- dsapxsum.ndarray( x.length, 5.0, [], 1, 0 ); // $ExpectError
145
- dsapxsum.ndarray( x.length, 5.0, {}, 1, 0 ); // $ExpectError
146
- dsapxsum.ndarray( x.length, 5.0, ( x: number ): number => x, 1, 0 ); // $ExpectError
147
- }
148
-
149
- // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
150
- {
151
- const x = new Float32Array( 10 );
152
-
153
- dsapxsum.ndarray( x.length, 5.0, x, '10', 0 ); // $ExpectError
154
- dsapxsum.ndarray( x.length, 5.0, x, true, 0 ); // $ExpectError
155
- dsapxsum.ndarray( x.length, 5.0, x, false, 0 ); // $ExpectError
156
- dsapxsum.ndarray( x.length, 5.0, x, null, 0 ); // $ExpectError
157
- dsapxsum.ndarray( x.length, 5.0, x, undefined, 0 ); // $ExpectError
158
- dsapxsum.ndarray( x.length, 5.0, x, [], 0 ); // $ExpectError
159
- dsapxsum.ndarray( x.length, 5.0, x, {}, 0 ); // $ExpectError
160
- dsapxsum.ndarray( x.length, 5.0, x, ( x: number ): number => x, 0 ); // $ExpectError
161
- }
162
-
163
- // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
164
- {
165
- const x = new Float32Array( 10 );
166
-
167
- dsapxsum.ndarray( x.length, 5.0, x, 1, '10' ); // $ExpectError
168
- dsapxsum.ndarray( x.length, 5.0, x, 1, true ); // $ExpectError
169
- dsapxsum.ndarray( x.length, 5.0, x, 1, false ); // $ExpectError
170
- dsapxsum.ndarray( x.length, 5.0, x, 1, null ); // $ExpectError
171
- dsapxsum.ndarray( x.length, 5.0, x, 1, undefined ); // $ExpectError
172
- dsapxsum.ndarray( x.length, 5.0, x, 1, [] ); // $ExpectError
173
- dsapxsum.ndarray( x.length, 5.0, x, 1, {} ); // $ExpectError
174
- dsapxsum.ndarray( x.length, 5.0, x, 1, ( x: number ): number => x ); // $ExpectError
175
- }
176
-
177
- // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
178
- {
179
- const x = new Float32Array( 10 );
180
-
181
- dsapxsum.ndarray(); // $ExpectError
182
- dsapxsum.ndarray( x.length ); // $ExpectError
183
- dsapxsum.ndarray( x.length, 5.0 ); // $ExpectError
184
- dsapxsum.ndarray( x.length, 5.0, x ); // $ExpectError
185
- dsapxsum.ndarray( x.length, 5.0, x, 1 ); // $ExpectError
186
- dsapxsum.ndarray( x.length, 5.0, x, 1, 0, 10 ); // $ExpectError
187
- }