@stdlib/blas-ext-base-dsnansum 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
  # dsnansum
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] -->
@@ -191,10 +202,10 @@ console.log( v );
191
202
 
192
203
  ## See Also
193
204
 
194
- - <span class="package-name">[`@stdlib/stats/base/dsnanmean`][@stdlib/stats/base/dsnanmean]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a single-precision floating-point strided array, ignoring NaN values, using extended accumulation, and returning an extended precision result.</span>
195
- - <span class="package-name">[`@stdlib/blas/ext/base/dssum`][@stdlib/blas/ext/base/dssum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements using extended accumulation and returning an extended precision result.</span>
196
- - <span class="package-name">[`@stdlib/blas/ext/base/sdsnansum`][@stdlib/blas/ext/base/sdsnansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using extended accumulation.</span>
197
- - <span class="package-name">[`@stdlib/blas/ext/base/snansum`][@stdlib/blas/ext/base/snansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values.</span>
205
+ - <span class="package-name">[`@stdlib/stats-base/dsnanmean`][@stdlib/stats/base/dsnanmean]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a single-precision floating-point strided array, ignoring NaN values, using extended accumulation, and returning an extended precision result.</span>
206
+ - <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>
207
+ - <span class="package-name">[`@stdlib/blas-ext/base/sdsnansum`][@stdlib/blas/ext/base/sdsnansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using extended accumulation.</span>
208
+ - <span class="package-name">[`@stdlib/blas-ext/base/snansum`][@stdlib/blas/ext/base/snansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values.</span>
198
209
 
199
210
  </section>
200
211
 
@@ -226,7 +237,7 @@ See [LICENSE][stdlib-license].
226
237
 
227
238
  ## Copyright
228
239
 
229
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
240
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
230
241
 
231
242
  </section>
232
243
 
@@ -239,8 +250,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
239
250
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsnansum.svg
240
251
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsnansum
241
252
 
242
- [test-image]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml/badge.svg?branch=v0.0.10
243
- [test-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml?query=branch:v0.0.10
253
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml/badge.svg?branch=v0.2.0
254
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/actions/workflows/test.yml?query=branch:v0.2.0
244
255
 
245
256
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsnansum/main.svg
246
257
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsnansum?branch=main
@@ -253,7 +264,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
253
264
  -->
254
265
 
255
266
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
256
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
267
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
257
268
 
258
269
  [stdlib]: https://github.com/stdlib-js/stdlib
259
270
 
@@ -263,8 +274,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
263
274
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
264
275
 
265
276
  [deno-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/tree/deno
277
+ [deno-readme]: https://github.com/stdlib-js/blas-ext-base-dsnansum/blob/deno/README.md
266
278
  [umd-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/tree/umd
279
+ [umd-readme]: https://github.com/stdlib-js/blas-ext-base-dsnansum/blob/umd/README.md
267
280
  [esm-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/tree/esm
281
+ [esm-readme]: https://github.com/stdlib-js/blas-ext-base-dsnansum/blob/esm/README.md
268
282
  [branches-url]: https://github.com/stdlib-js/blas-ext-base-dsnansum/blob/main/branches.md
269
283
 
270
284
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-dsnansum/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 dsnansum from '../docs/types/index';
3
+ export = dsnansum;
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";var a=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=a(function(b,u){
2
+ var c=require('@stdlib/blas-ext-base-dsnansumpw/dist');function y(e,r,s){return c(e,r,s)}u.exports=y
3
+ });var v=a(function(g,t){
4
+ var x=require('@stdlib/blas-ext-base-dsnansumpw/dist').ndarray;function f(e,r,s,p){return x(e,r,s,p)}t.exports=f
5
+ });var m=a(function(h,q){
6
+ var j=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),d=i(),l=v();j(d,"ndarray",l);q.exports=d
7
+ });var w=require("path").join,R=require('@stdlib/utils-try-require/dist'),_=require('@stdlib/assert-is-error/dist'),E=m(),n,o=R(w(__dirname,"./native.js"));_(o)?n=E:n=o;module.exports=n;
8
+ /** @license Apache-2.0 */
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/dsnansum.js", "../lib/ndarray.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' );\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} stride - stride length\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n* var N = x.length;\n*\n* var v = dsnansum( N, x, 1 );\n* // returns 1.0\n*/\nfunction dsnansum( N, x, stride ) {\n\treturn dsnansumpw( N, x, stride );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' ).ndarray;\n\n\n// MAIN //\n\n/**\n* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - input array\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @returns {number} sum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* 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, NaN, NaN ] );\n* var N = floor( x.length / 2 );\n*\n* var v = dsnansum( N, x, 2, 1 );\n* // returns 5.0\n*/\nfunction dsnansum( N, x, stride, offset ) {\n\treturn dsnansumpw( N, x, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dsnansum = require( './dsnansum.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsnansum, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using extended accumulation, and returning an extended precision result.\n*\n* @module @stdlib/blas-ext-base-dsnansum\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );\n* var N = x.length;\n*\n* var v = dsnansum( N, x, 1 );\n* // returns 1.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var floor = require( '@stdlib/math-base-special-floor' );\n* var dsnansum = require( '@stdlib/blas-ext-base-dsnansum' );\n*\n* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );\n* var N = floor( x.length / 2 );\n*\n* var v = dsnansum.ndarray( N, x, 2, 1 );\n* // returns 5.0\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dsnansum;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsnansum = main;\n} else {\n\tdsnansum = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsnansum;\n\n// exports: { \"ndarray\": \"dsnansum.ndarray\" }\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAsB7D,SAASC,EAAUC,EAAGC,EAAGC,EAAS,CACjC,OAAOJ,EAAYE,EAAGC,EAAGC,CAAO,CACjC,CAKAL,EAAO,QAAUE,ICnDjB,IAAAI,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,kCAAmC,EAAE,QAwB/D,SAASC,EAAUC,EAAGC,EAAGC,EAAQC,EAAS,CACzC,OAAOL,EAAYE,EAAGC,EAAGC,EAAQC,CAAO,CACzC,CAKAN,EAAO,QAAUE,ICrDjB,IAAAK,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_dsnansum", "__commonJSMin", "exports", "module", "dsnansumpw", "dsnansum", "N", "x", "stride", "require_ndarray", "__commonJSMin", "exports", "module", "dsnansumpw", "dsnansum", "N", "x", "stride", "offset", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsnansum", "ndarray", "join", "tryRequire", "isError", "main", "dsnansum", "tmp"]
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 `dsnansum`.
@@ -31,7 +31,7 @@ interface Routine {
31
31
  * @returns sum
32
32
  *
33
33
  * @example
34
- * var Float32Array = require( `@stdlib/array/float32` );
34
+ * var Float32Array = require( '@stdlib/array-float32' );
35
35
  *
36
36
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
37
37
  *
@@ -50,14 +50,14 @@ interface Routine {
50
50
  * @returns sum
51
51
  *
52
52
  * @example
53
- * var Float32Array = require( `@stdlib/array/float32` );
53
+ * var Float32Array = require( '@stdlib/array-float32' );
54
54
  *
55
55
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
56
56
  *
57
57
  * var v = dsnansum.ndarray( x.length, x, 1, 0 );
58
58
  * // returns 1.0
59
59
  */
60
- ndarray( N: number, x: Float32Array, stride: number, offset: number ): number; // tslint:disable-line:max-line-length
60
+ ndarray( N: number, x: Float32Array, stride: number, offset: number ): number;
61
61
  }
62
62
 
63
63
  /**
@@ -69,7 +69,7 @@ interface Routine {
69
69
  * @returns sum
70
70
  *
71
71
  * @example
72
- * var Float32Array = require( `@stdlib/array/float32` );
72
+ * var Float32Array = require( '@stdlib/array-float32' );
73
73
  *
74
74
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
75
75
  *
@@ -77,7 +77,7 @@ interface Routine {
77
77
  * // returns 1.0
78
78
  *
79
79
  * @example
80
- * var Float32Array = require( `@stdlib/array/float32` );
80
+ * var Float32Array = require( '@stdlib/array-float32' );
81
81
  *
82
82
  * var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
83
83
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-dsnansum",
3
- "version": "0.0.10",
3
+ "version": "0.2.0",
4
4
  "description": "Calculate the sum of single-precision floating-point strided array elements, ignoring NaN values, using extended accumulation, and returning an extended precision result.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -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-dsnansumpw": "^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-dsnansumpw": "^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,96 +0,0 @@
1
-
2
- {{alias}}( N, x, stride )
3
- Computes the sum of single-precision floating-point strided array elements,
4
- ignoring `NaN` values, 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
- x: Float32Array
21
- Input array.
22
-
23
- stride: integer
24
- Index increment.
25
-
26
- Returns
27
- -------
28
- out: number
29
- Sum.
30
-
31
- Examples
32
- --------
33
- // Standard Usage:
34
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, NaN, 2.0 ] );
35
- > {{alias}}( x.length, x, 1 )
36
- 1.0
37
-
38
- // Using `N` and `stride` parameters:
39
- > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] );
40
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
41
- > var stride = 2;
42
- > {{alias}}( N, x, stride )
43
- 1.0
44
-
45
- // Using view offsets:
46
- > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
47
- > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
48
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
49
- > stride = 2;
50
- > {{alias}}( N, x1, stride )
51
- -1.0
52
-
53
- {{alias}}.ndarray( N, x, stride, offset )
54
- Computes the sum of single-precision floating-point strided array elements,
55
- ignoring `NaN` values and using extended accumulation and alternative
56
- indexing semantics.
57
-
58
- While typed array views mandate a view offset based on the underlying
59
- buffer, the `offset` parameter supports indexing semantics based on a
60
- starting index.
61
-
62
- Parameters
63
- ----------
64
- N: integer
65
- Number of indexed elements.
66
-
67
- x: Float32Array
68
- Input array.
69
-
70
- stride: integer
71
- Index increment.
72
-
73
- offset: integer
74
- Starting index.
75
-
76
- Returns
77
- -------
78
- out: number
79
- Sum.
80
-
81
- Examples
82
- --------
83
- // Standard Usage:
84
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, NaN, 2.0 ] );
85
- > {{alias}}.ndarray( x.length, x, 1, 0 )
86
- 1.0
87
-
88
- // Using offset parameter:
89
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
90
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
91
- > {{alias}}.ndarray( N, x, 2, 1 )
92
- -1.0
93
-
94
- See Also
95
- --------
96
-
@@ -1,157 +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 dsnansum = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- const x = new Float32Array( 10 );
27
-
28
- dsnansum( x.length, 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
- dsnansum( '10', x, 1 ); // $ExpectError
36
- dsnansum( true, x, 1 ); // $ExpectError
37
- dsnansum( false, x, 1 ); // $ExpectError
38
- dsnansum( null, x, 1 ); // $ExpectError
39
- dsnansum( undefined, x, 1 ); // $ExpectError
40
- dsnansum( [], x, 1 ); // $ExpectError
41
- dsnansum( {}, x, 1 ); // $ExpectError
42
- dsnansum( ( x: number ): number => x, x, 1 ); // $ExpectError
43
- }
44
-
45
- // The compiler throws an error if the function is provided a second argument which is not a Float32Array...
46
- {
47
- const x = new Float32Array( 10 );
48
-
49
- dsnansum( x.length, 10, 1 ); // $ExpectError
50
- dsnansum( x.length, '10', 1 ); // $ExpectError
51
- dsnansum( x.length, true, 1 ); // $ExpectError
52
- dsnansum( x.length, false, 1 ); // $ExpectError
53
- dsnansum( x.length, null, 1 ); // $ExpectError
54
- dsnansum( x.length, undefined, 1 ); // $ExpectError
55
- dsnansum( x.length, [], 1 ); // $ExpectError
56
- dsnansum( x.length, {}, 1 ); // $ExpectError
57
- dsnansum( x.length, ( x: number ): number => x, 1 ); // $ExpectError
58
- }
59
-
60
- // The compiler throws an error if the function is provided a third argument which is not a number...
61
- {
62
- const x = new Float32Array( 10 );
63
-
64
- dsnansum( x.length, x, '10' ); // $ExpectError
65
- dsnansum( x.length, x, true ); // $ExpectError
66
- dsnansum( x.length, x, false ); // $ExpectError
67
- dsnansum( x.length, x, null ); // $ExpectError
68
- dsnansum( x.length, x, undefined ); // $ExpectError
69
- dsnansum( x.length, x, [] ); // $ExpectError
70
- dsnansum( x.length, x, {} ); // $ExpectError
71
- dsnansum( x.length, x, ( x: number ): number => x ); // $ExpectError
72
- }
73
-
74
- // The compiler throws an error if the function is provided an unsupported number of arguments...
75
- {
76
- const x = new Float32Array( 10 );
77
-
78
- dsnansum(); // $ExpectError
79
- dsnansum( x.length ); // $ExpectError
80
- dsnansum( x.length, x ); // $ExpectError
81
- dsnansum( x.length, x, 1, 10 ); // $ExpectError
82
- }
83
-
84
- // Attached to main export is an `ndarray` method which returns a number...
85
- {
86
- const x = new Float32Array( 10 );
87
-
88
- dsnansum.ndarray( x.length, x, 1, 0 ); // $ExpectType number
89
- }
90
-
91
- // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
92
- {
93
- const x = new Float32Array( 10 );
94
-
95
- dsnansum.ndarray( '10', x, 1, 0 ); // $ExpectError
96
- dsnansum.ndarray( true, x, 1, 0 ); // $ExpectError
97
- dsnansum.ndarray( false, x, 1, 0 ); // $ExpectError
98
- dsnansum.ndarray( null, x, 1, 0 ); // $ExpectError
99
- dsnansum.ndarray( undefined, x, 1, 0 ); // $ExpectError
100
- dsnansum.ndarray( [], x, 1, 0 ); // $ExpectError
101
- dsnansum.ndarray( {}, x, 1, 0 ); // $ExpectError
102
- dsnansum.ndarray( ( x: number ): number => x, x, 1, 0 ); // $ExpectError
103
- }
104
-
105
- // The compiler throws an error if the `ndarray` method is provided a second argument which is not a Float32Array...
106
- {
107
- const x = new Float32Array( 10 );
108
-
109
- dsnansum.ndarray( x.length, 10, 1, 0 ); // $ExpectError
110
- dsnansum.ndarray( x.length, '10', 1, 0 ); // $ExpectError
111
- dsnansum.ndarray( x.length, true, 1, 0 ); // $ExpectError
112
- dsnansum.ndarray( x.length, false, 1, 0 ); // $ExpectError
113
- dsnansum.ndarray( x.length, null, 1, 0 ); // $ExpectError
114
- dsnansum.ndarray( x.length, undefined, 1, 0 ); // $ExpectError
115
- dsnansum.ndarray( x.length, [], 1, 0 ); // $ExpectError
116
- dsnansum.ndarray( x.length, {}, 1, 0 ); // $ExpectError
117
- dsnansum.ndarray( x.length, ( x: number ): number => x, 1, 0 ); // $ExpectError
118
- }
119
-
120
- // The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
121
- {
122
- const x = new Float32Array( 10 );
123
-
124
- dsnansum.ndarray( x.length, x, '10', 0 ); // $ExpectError
125
- dsnansum.ndarray( x.length, x, true, 0 ); // $ExpectError
126
- dsnansum.ndarray( x.length, x, false, 0 ); // $ExpectError
127
- dsnansum.ndarray( x.length, x, null, 0 ); // $ExpectError
128
- dsnansum.ndarray( x.length, x, undefined, 0 ); // $ExpectError
129
- dsnansum.ndarray( x.length, x, [], 0 ); // $ExpectError
130
- dsnansum.ndarray( x.length, x, {}, 0 ); // $ExpectError
131
- dsnansum.ndarray( x.length, x, ( x: number ): number => x, 0 ); // $ExpectError
132
- }
133
-
134
- // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
135
- {
136
- const x = new Float32Array( 10 );
137
-
138
- dsnansum.ndarray( x.length, x, 1, '10' ); // $ExpectError
139
- dsnansum.ndarray( x.length, x, 1, true ); // $ExpectError
140
- dsnansum.ndarray( x.length, x, 1, false ); // $ExpectError
141
- dsnansum.ndarray( x.length, x, 1, null ); // $ExpectError
142
- dsnansum.ndarray( x.length, x, 1, undefined ); // $ExpectError
143
- dsnansum.ndarray( x.length, x, 1, [] ); // $ExpectError
144
- dsnansum.ndarray( x.length, x, 1, {} ); // $ExpectError
145
- dsnansum.ndarray( x.length, x, 1, ( x: number ): number => x ); // $ExpectError
146
- }
147
-
148
- // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
149
- {
150
- const x = new Float32Array( 10 );
151
-
152
- dsnansum.ndarray(); // $ExpectError
153
- dsnansum.ndarray( x.length ); // $ExpectError
154
- dsnansum.ndarray( x.length, x ); // $ExpectError
155
- dsnansum.ndarray( x.length, x, 1 ); // $ExpectError
156
- dsnansum.ndarray( x.length, x, 1, 0, 10 ); // $ExpectError
157
- }