@stdlib/blas-ext-base-gnansumpw 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
  # gnansumpw
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] -->
@@ -192,12 +203,12 @@ console.log( v );
192
203
 
193
204
  ## See Also
194
205
 
195
- - <span class="package-name">[`@stdlib/blas/ext/base/dnansumpw`][@stdlib/blas/ext/base/dnansumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of double-precision floating-point strided array elements, ignoring NaN values and using pairwise summation.</span>
196
- - <span class="package-name">[`@stdlib/blas/ext/base/gnansum`][@stdlib/blas/ext/base/gnansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values.</span>
197
- - <span class="package-name">[`@stdlib/blas/ext/base/gnansumkbn2`][@stdlib/blas/ext/base/gnansumkbn2]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values and using a second-order iterative Kahan–Babuška algorithm.</span>
198
- - <span class="package-name">[`@stdlib/blas/ext/base/gnansumors`][@stdlib/blas/ext/base/gnansumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values and using ordinary recursive summation.</span>
199
- - <span class="package-name">[`@stdlib/blas/ext/base/gsumpw`][@stdlib/blas/ext/base/gsumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using pairwise summation.</span>
200
- - <span class="package-name">[`@stdlib/blas/ext/base/snansumpw`][@stdlib/blas/ext/base/snansumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using pairwise summation.</span>
206
+ - <span class="package-name">[`@stdlib/blas-ext/base/dnansumpw`][@stdlib/blas/ext/base/dnansumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of double-precision floating-point strided array elements, ignoring NaN values and using pairwise summation.</span>
207
+ - <span class="package-name">[`@stdlib/blas-ext/base/gnansum`][@stdlib/blas/ext/base/gnansum]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values.</span>
208
+ - <span class="package-name">[`@stdlib/blas-ext/base/gnansumkbn2`][@stdlib/blas/ext/base/gnansumkbn2]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values and using a second-order iterative Kahan–Babuška algorithm.</span>
209
+ - <span class="package-name">[`@stdlib/blas-ext/base/gnansumors`][@stdlib/blas/ext/base/gnansumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values and using ordinary recursive summation.</span>
210
+ - <span class="package-name">[`@stdlib/blas-ext/base/gsumpw`][@stdlib/blas/ext/base/gsumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using pairwise summation.</span>
211
+ - <span class="package-name">[`@stdlib/blas-ext/base/snansumpw`][@stdlib/blas/ext/base/snansumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using pairwise summation.</span>
201
212
 
202
213
  </section>
203
214
 
@@ -229,7 +240,7 @@ See [LICENSE][stdlib-license].
229
240
 
230
241
  ## Copyright
231
242
 
232
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
243
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
233
244
 
234
245
  </section>
235
246
 
@@ -242,8 +253,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
242
253
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-gnansumpw.svg
243
254
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-gnansumpw
244
255
 
245
- [test-image]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/actions/workflows/test.yml/badge.svg?branch=v0.0.10
246
- [test-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/actions/workflows/test.yml?query=branch:v0.0.10
256
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/actions/workflows/test.yml/badge.svg?branch=v0.2.0
257
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/actions/workflows/test.yml?query=branch:v0.2.0
247
258
 
248
259
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-gnansumpw/main.svg
249
260
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-gnansumpw?branch=main
@@ -256,7 +267,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
256
267
  -->
257
268
 
258
269
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
259
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
270
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
260
271
 
261
272
  [stdlib]: https://github.com/stdlib-js/stdlib
262
273
 
@@ -266,8 +277,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
266
277
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
267
278
 
268
279
  [deno-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/tree/deno
280
+ [deno-readme]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/blob/deno/README.md
269
281
  [umd-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/tree/umd
282
+ [umd-readme]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/blob/umd/README.md
270
283
  [esm-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/tree/esm
284
+ [esm-readme]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/blob/esm/README.md
271
285
  [branches-url]: https://github.com/stdlib-js/blas-ext-base-gnansumpw/blob/main/branches.md
272
286
 
273
287
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-gnansumpw/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 gnansumpw from '../docs/types/index';
3
+ export = gnansumpw;
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var C=function(u,a){return function(){return a||u((a={exports:{}}).exports,a),a.exports}};var O=C(function(z,E){
2
+ var v=require('@stdlib/math-base-assert-is-nan/dist'),R=require('@stdlib/math-base-special-floor/dist'),S=128;function w(u,a,n,f){var r,o,l,c,p,m,y,g,s,B,i,q,e;if(u<=0)return 0;if(u===1||n===0)return v(a[f])?0:a[f];if(r=f,u<8){for(i=0,e=0;e<u;e++)v(a[r])===!1&&(i+=a[r]),r+=n;return i}if(u<=S){for(o=v(a[r])?0:a[r],r+=n,l=v(a[r])?0:a[r],r+=n,c=v(a[r])?0:a[r],r+=n,p=v(a[r])?0:a[r],r+=n,m=v(a[r])?0:a[r],r+=n,y=v(a[r])?0:a[r],r+=n,g=v(a[r])?0:a[r],r+=n,s=v(a[r])?0:a[r],r+=n,B=u%8,e=8;e<u-B;e+=8)o+=v(a[r])?0:a[r],r+=n,l+=v(a[r])?0:a[r],r+=n,c+=v(a[r])?0:a[r],r+=n,p+=v(a[r])?0:a[r],r+=n,m+=v(a[r])?0:a[r],r+=n,y+=v(a[r])?0:a[r],r+=n,g+=v(a[r])?0:a[r],r+=n,s+=v(a[r])?0:a[r],r+=n;for(i=o+l+(c+p)+(m+y+(g+s)),e;e<u;e++)v(a[r])===!1&&(i+=a[r]),r+=n;return i}return q=R(u/2),q-=q%8,w(q,a,n,r)+w(u-q,a,n,r+q*n)}E.exports=w
3
+ });var L=C(function(A,K){
4
+ var I=require('@stdlib/math-base-assert-is-nan/dist'),Z=O();function b(u,a,n){var f,r,o;if(u<=0)return 0;if(u===1||n===0)return I(a[0])?0:a[0];if(n<0?f=(1-u)*n:f=0,u<8){for(r=0,o=0;o<u;o++)I(a[f])===!1&&(r+=a[f]),f+=n;return r}return Z(u,a,n,f)}K.exports=b
5
+ });var h=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),M=L(),j=O();h(M,"ndarray",j);module.exports=M;
6
+ /** @license Apache-2.0 */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// VARIABLES //\n\n// Blocksize for pairwise summation (NOTE: decreasing the blocksize decreases rounding error as more pairs are summed, but also decreases performance. Because the inner loop is unrolled eight times, the blocksize is effectively `16`.):\nvar BLOCKSIZE = 128;\n\n\n// MAIN //\n\n/**\n* Computes the sum of strided array elements, ignoring `NaN` values and using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {NumericArray} x - input array\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @returns {number} sum\n*\n* @example\n* var floor = require( '@stdlib/math-base-special-floor' );\n*\n* var x = [ 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 = gnansumpw( N, x, 2, 1 );\n* // returns 5.0\n*/\nfunction gnansumpw( N, x, stride, offset ) {\n\tvar ix;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar M;\n\tvar s;\n\tvar n;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn 0.0;\n\t}\n\tif ( N === 1 || stride === 0 ) {\n\t\tif ( isnan( x[ offset ] ) ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn x[ offset ];\n\t}\n\tix = offset;\n\tif ( N < 8 ) {\n\t\t// Use simple summation...\n\t\ts = 0.0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( isnan( x[ ix ] ) === false ) {\n\t\t\t\ts += x[ ix ];\n\t\t\t}\n\t\t\tix += stride;\n\t\t}\n\t\treturn s;\n\t}\n\tif ( N <= BLOCKSIZE ) {\n\t\t// Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...\n\t\ts0 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts1 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts2 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts3 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts4 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts5 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts6 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\t\ts7 = ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\tix += stride;\n\n\t\tM = N % 8;\n\t\tfor ( i = 8; i < N-M; i += 8 ) {\n\t\t\ts0 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts1 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts2 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts3 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts4 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts5 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts6 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t\ts7 += ( isnan( x[ ix ] ) ) ? 0.0 : x[ ix ];\n\t\t\tix += stride;\n\t\t}\n\t\t// Pairwise sum the accumulators:\n\t\ts = ((s0+s1) + (s2+s3)) + ((s4+s5) + (s6+s7));\n\n\t\t// Clean-up loop...\n\t\tfor ( i; i < N; i++ ) {\n\t\t\tif ( isnan( x[ ix ] ) === false ) {\n\t\t\t\ts += x[ ix ];\n\t\t\t}\n\t\t\tix += stride;\n\t\t}\n\t\treturn s;\n\t}\n\t// Recurse by dividing by two, but avoiding non-multiples of unroll factor...\n\tn = floor( N/2 );\n\tn -= n % 8;\n\treturn gnansumpw( n, x, stride, ix ) + gnansumpw( N-n, x, stride, ix+(n*stride) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = gnansumpw;\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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar sum = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Computes the sum of strided array elements, ignoring `NaN` values and using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {NumericArray} x - input array\n* @param {integer} stride - stride length\n* @returns {number} sum\n*\n* @example\n* var x = [ 1.0, -2.0, NaN, 2.0 ];\n* var N = x.length;\n*\n* var v = gnansumpw( N, x, 1 );\n* // returns 1.0\n*/\nfunction gnansumpw( N, x, stride ) {\n\tvar ix;\n\tvar s;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn 0.0;\n\t}\n\tif ( N === 1 || stride === 0 ) {\n\t\tif ( isnan( x[ 0 ] ) ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn x[ 0 ];\n\t}\n\tif ( stride < 0 ) {\n\t\tix = (1-N) * stride;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( N < 8 ) {\n\t\t// Use simple summation...\n\t\ts = 0.0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( isnan( x[ ix ] ) === false ) {\n\t\t\t\ts += x[ ix ];\n\t\t\t}\n\t\t\tix += stride;\n\t\t}\n\t\treturn s;\n\t}\n\treturn sum( N, x, stride, ix );\n}\n\n\n// EXPORTS //\n\nmodule.exports = gnansumpw;\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 strided array elements, ignoring `NaN` values and using pairwise summation.\n*\n* @module @stdlib/blas-ext-base-gnansumpw\n*\n* @example\n* var gnansumpw = require( '@stdlib/blas-ext-base-gnansumpw' );\n*\n* var x = [ 1.0, -2.0, NaN, 2.0 ];\n* var N = x.length;\n*\n* var v = gnansumpw( N, x, 1 );\n* // returns 1.0\n*\n* @example\n* var floor = require( '@stdlib/math-base-special-floor' );\n* var gnansumpw = require( '@stdlib/blas-ext-base-gnansumpw' );\n*\n* var x = [ 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 = gnansumpw.ndarray( N, x, 2, 1 );\n* // returns 5.0\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "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",
6
+ "names": ["require_ndarray", "__commonJSMin", "exports", "module", "isnan", "floor", "BLOCKSIZE", "gnansumpw", "N", "x", "stride", "offset", "ix", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "M", "s", "n", "i", "require_main", "__commonJSMin", "exports", "module", "isnan", "sum", "gnansumpw", "N", "x", "stride", "ix", "s", "i", "setReadOnly", "main", "ndarray"]
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
  /// <reference types="@stdlib/types"/>
22
22
 
@@ -57,7 +57,7 @@ interface Routine {
57
57
  * var v = gnansumpw.ndarray( x.length, x, 1, 0 );
58
58
  * // returns 1.0
59
59
  */
60
- ndarray( N: number, x: NumericArray, stride: number, offset: number ): number; // tslint:disable-line:max-line-length
60
+ ndarray( N: number, x: NumericArray, stride: number, offset: number ): number;
61
61
  }
62
62
 
63
63
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-gnansumpw",
3
- "version": "0.0.10",
3
+ "version": "0.2.0",
4
4
  "description": "Calculate the sum of strided array elements, ignoring NaN values and using pairwise summation.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,20 +37,21 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
41
- "@stdlib/math-base-special-floor": "^0.0.x",
42
- "@stdlib/types": "^0.0.x",
43
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x"
40
+ "@stdlib/math-base-assert-is-nan": "^0.2.0",
41
+ "@stdlib/math-base-special-floor": "^0.2.0",
42
+ "@stdlib/types": "^0.3.1",
43
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@stdlib/array-float64": "^0.0.x",
47
- "@stdlib/bench": "^0.0.x",
48
- "@stdlib/math-base-special-pow": "^0.0.x",
49
- "@stdlib/math-base-special-round": "^0.0.x",
50
- "@stdlib/random-base-randu": "^0.0.x",
46
+ "@stdlib/array-float64": "^0.1.1",
47
+ "@stdlib/math-base-special-pow": "^0.1.0",
48
+ "@stdlib/math-base-special-round": "^0.1.1",
49
+ "@stdlib/random-base-randu": "^0.1.0",
51
50
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
52
51
  "istanbul": "^0.4.1",
53
- "tap-spec": "5.x.x"
52
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
53
+ "@stdlib/bench-harness": "^0.2.0",
54
+ "@stdlib/bench": "^0.3.1"
54
55
  },
55
56
  "engines": {
56
57
  "node": ">=0.10.0",
@@ -87,7 +88,7 @@
87
88
  ],
88
89
  "__stdlib__": {},
89
90
  "funding": {
90
- "type": "patreon",
91
- "url": "https://www.patreon.com/athan"
91
+ "type": "opencollective",
92
+ "url": "https://opencollective.com/stdlib"
92
93
  }
93
94
  }
package/docs/repl.txt DELETED
@@ -1,94 +0,0 @@
1
-
2
- {{alias}}( N, x, stride )
3
- Computes the sum of strided array elements, ignoring `NaN` values and
4
- pairwise summation.
5
-
6
- The `N` and `stride` parameters determine which elements in `x` are accessed
7
- at runtime.
8
-
9
- Indexing is relative to the first index. To introduce an offset, use a typed
10
- array view.
11
-
12
- If `N <= 0`, the function returns `0.0`.
13
-
14
- Parameters
15
- ----------
16
- N: integer
17
- Number of indexed elements.
18
-
19
- x: Array<number>|TypedArray
20
- Input array.
21
-
22
- stride: integer
23
- Index increment.
24
-
25
- Returns
26
- -------
27
- out: number
28
- Sum.
29
-
30
- Examples
31
- --------
32
- // Standard Usage:
33
- > var x = [ 1.0, -2.0, NaN, 2.0 ];
34
- > {{alias}}( x.length, x, 1 )
35
- 1.0
36
-
37
- // Using `N` and `stride` parameters:
38
- > x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ];
39
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
40
- > var stride = 2;
41
- > {{alias}}( N, x, stride )
42
- 1.0
43
-
44
- // Using view offsets:
45
- > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
46
- > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
47
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
48
- > stride = 2;
49
- > {{alias}}( N, x1, stride )
50
- -1.0
51
-
52
- {{alias}}.ndarray( N, x, stride, offset )
53
- Computes the sum of strided array elements, ignoring `NaN` values and using
54
- pairwise summation and alternative indexing semantics.
55
-
56
- While typed array views mandate a view offset based on the underlying
57
- buffer, the `offset` parameter supports indexing semantics based on a
58
- starting index.
59
-
60
- Parameters
61
- ----------
62
- N: integer
63
- Number of indexed elements.
64
-
65
- x: Array<number>|TypedArray
66
- Input array.
67
-
68
- stride: integer
69
- Index increment.
70
-
71
- offset: integer
72
- Starting index.
73
-
74
- Returns
75
- -------
76
- out: number
77
- Sum.
78
-
79
- Examples
80
- --------
81
- // Standard Usage:
82
- > var x = [ 1.0, -2.0, NaN, 2.0 ];
83
- > {{alias}}.ndarray( x.length, x, 1, 0 )
84
- 1.0
85
-
86
- // Using offset parameter:
87
- > var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ];
88
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
89
- > {{alias}}.ndarray( N, x, 2, 1 )
90
- -1.0
91
-
92
- See Also
93
- --------
94
-
@@ -1,155 +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 gnansumpw = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- const x = new Float64Array( 10 );
27
-
28
- gnansumpw( 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 Float64Array( 10 );
34
-
35
- gnansumpw( '10', x, 1 ); // $ExpectError
36
- gnansumpw( true, x, 1 ); // $ExpectError
37
- gnansumpw( false, x, 1 ); // $ExpectError
38
- gnansumpw( null, x, 1 ); // $ExpectError
39
- gnansumpw( undefined, x, 1 ); // $ExpectError
40
- gnansumpw( [], x, 1 ); // $ExpectError
41
- gnansumpw( {}, x, 1 ); // $ExpectError
42
- gnansumpw( ( 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 numeric array...
46
- {
47
- const x = new Float64Array( 10 );
48
-
49
- gnansumpw( x.length, 10, 1 ); // $ExpectError
50
- gnansumpw( x.length, '10', 1 ); // $ExpectError
51
- gnansumpw( x.length, true, 1 ); // $ExpectError
52
- gnansumpw( x.length, false, 1 ); // $ExpectError
53
- gnansumpw( x.length, null, 1 ); // $ExpectError
54
- gnansumpw( x.length, undefined, 1 ); // $ExpectError
55
- gnansumpw( x.length, {}, 1 ); // $ExpectError
56
- gnansumpw( x.length, ( x: number ): number => x, 1 ); // $ExpectError
57
- }
58
-
59
- // The compiler throws an error if the function is provided a third argument which is not a number...
60
- {
61
- const x = new Float64Array( 10 );
62
-
63
- gnansumpw( x.length, x, '10' ); // $ExpectError
64
- gnansumpw( x.length, x, true ); // $ExpectError
65
- gnansumpw( x.length, x, false ); // $ExpectError
66
- gnansumpw( x.length, x, null ); // $ExpectError
67
- gnansumpw( x.length, x, undefined ); // $ExpectError
68
- gnansumpw( x.length, x, [] ); // $ExpectError
69
- gnansumpw( x.length, x, {} ); // $ExpectError
70
- gnansumpw( x.length, x, ( x: number ): number => x ); // $ExpectError
71
- }
72
-
73
- // The compiler throws an error if the function is provided an unsupported number of arguments...
74
- {
75
- const x = new Float64Array( 10 );
76
-
77
- gnansumpw(); // $ExpectError
78
- gnansumpw( x.length ); // $ExpectError
79
- gnansumpw( x.length, x ); // $ExpectError
80
- gnansumpw( x.length, x, 1, 10 ); // $ExpectError
81
- }
82
-
83
- // Attached to main export is an `ndarray` method which returns a number...
84
- {
85
- const x = new Float64Array( 10 );
86
-
87
- gnansumpw.ndarray( x.length, x, 1, 0 ); // $ExpectType number
88
- }
89
-
90
- // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
91
- {
92
- const x = new Float64Array( 10 );
93
-
94
- gnansumpw.ndarray( '10', x, 1, 0 ); // $ExpectError
95
- gnansumpw.ndarray( true, x, 1, 0 ); // $ExpectError
96
- gnansumpw.ndarray( false, x, 1, 0 ); // $ExpectError
97
- gnansumpw.ndarray( null, x, 1, 0 ); // $ExpectError
98
- gnansumpw.ndarray( undefined, x, 1, 0 ); // $ExpectError
99
- gnansumpw.ndarray( [], x, 1, 0 ); // $ExpectError
100
- gnansumpw.ndarray( {}, x, 1, 0 ); // $ExpectError
101
- gnansumpw.ndarray( ( x: number ): number => x, x, 1, 0 ); // $ExpectError
102
- }
103
-
104
- // The compiler throws an error if the `ndarray` method is provided a second argument which is not a numeric array...
105
- {
106
- const x = new Float64Array( 10 );
107
-
108
- gnansumpw.ndarray( x.length, 10, 1, 0 ); // $ExpectError
109
- gnansumpw.ndarray( x.length, '10', 1, 0 ); // $ExpectError
110
- gnansumpw.ndarray( x.length, true, 1, 0 ); // $ExpectError
111
- gnansumpw.ndarray( x.length, false, 1, 0 ); // $ExpectError
112
- gnansumpw.ndarray( x.length, null, 1, 0 ); // $ExpectError
113
- gnansumpw.ndarray( x.length, undefined, 1, 0 ); // $ExpectError
114
- gnansumpw.ndarray( x.length, {}, 1, 0 ); // $ExpectError
115
- gnansumpw.ndarray( x.length, ( x: number ): number => x, 1, 0 ); // $ExpectError
116
- }
117
-
118
- // The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
119
- {
120
- const x = new Float64Array( 10 );
121
-
122
- gnansumpw.ndarray( x.length, x, '10', 0 ); // $ExpectError
123
- gnansumpw.ndarray( x.length, x, true, 0 ); // $ExpectError
124
- gnansumpw.ndarray( x.length, x, false, 0 ); // $ExpectError
125
- gnansumpw.ndarray( x.length, x, null, 0 ); // $ExpectError
126
- gnansumpw.ndarray( x.length, x, undefined, 0 ); // $ExpectError
127
- gnansumpw.ndarray( x.length, x, [], 0 ); // $ExpectError
128
- gnansumpw.ndarray( x.length, x, {}, 0 ); // $ExpectError
129
- gnansumpw.ndarray( x.length, x, ( x: number ): number => x, 0 ); // $ExpectError
130
- }
131
-
132
- // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
133
- {
134
- const x = new Float64Array( 10 );
135
-
136
- gnansumpw.ndarray( x.length, x, 1, '10' ); // $ExpectError
137
- gnansumpw.ndarray( x.length, x, 1, true ); // $ExpectError
138
- gnansumpw.ndarray( x.length, x, 1, false ); // $ExpectError
139
- gnansumpw.ndarray( x.length, x, 1, null ); // $ExpectError
140
- gnansumpw.ndarray( x.length, x, 1, undefined ); // $ExpectError
141
- gnansumpw.ndarray( x.length, x, 1, [] ); // $ExpectError
142
- gnansumpw.ndarray( x.length, x, 1, {} ); // $ExpectError
143
- gnansumpw.ndarray( x.length, x, 1, ( x: number ): number => x ); // $ExpectError
144
- }
145
-
146
- // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
147
- {
148
- const x = new Float64Array( 10 );
149
-
150
- gnansumpw.ndarray(); // $ExpectError
151
- gnansumpw.ndarray( x.length ); // $ExpectError
152
- gnansumpw.ndarray( x.length, x ); // $ExpectError
153
- gnansumpw.ndarray( x.length, x, 1 ); // $ExpectError
154
- gnansumpw.ndarray( x.length, x, 1, 0, 10 ); // $ExpectError
155
- }