@stdlib/blas-ext-base-gnansumors 0.0.3 → 0.0.7

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-2021 The Stdlib Authors.
1
+ Copyright (c) 2016-2022 The Stdlib Authors.
package/README.md CHANGED
@@ -20,7 +20,7 @@ limitations under the License.
20
20
 
21
21
  # gnansumors
22
22
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
23
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
24
 
25
25
  > Calculate the sum of strided array elements, ignoring `NaN` values and using ordinary recursive summation.
26
26
 
@@ -172,6 +172,27 @@ console.log( v );
172
172
 
173
173
  <!-- /.examples -->
174
174
 
175
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
176
+
177
+ <section class="related">
178
+
179
+ * * *
180
+
181
+ ## See Also
182
+
183
+ - <span class="package-name">[`@stdlib/blas/ext/base/dnansumors`][@stdlib/blas/ext/base/dnansumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of double-precision floating-point strided array elements, ignoring NaN values and using ordinary recursive summation.</span>
184
+ - <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>
185
+ - <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>
186
+ - <span class="package-name">[`@stdlib/blas/ext/base/gnansumpw`][@stdlib/blas/ext/base/gnansumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements, ignoring NaN values and using pairwise summation.</span>
187
+ - <span class="package-name">[`@stdlib/blas/ext/base/gsumors`][@stdlib/blas/ext/base/gsumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using ordinary recursive summation.</span>
188
+ - <span class="package-name">[`@stdlib/blas/ext/base/snansumors`][@stdlib/blas/ext/base/snansumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of single-precision floating-point strided array elements, ignoring NaN values and using ordinary recursive summation.</span>
189
+
190
+ </section>
191
+
192
+ <!-- /.related -->
193
+
194
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
195
+
175
196
 
176
197
  <section class="main-repo" >
177
198
 
@@ -183,6 +204,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
183
204
 
184
205
  For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
185
206
 
207
+ #### Community
208
+
209
+ [![Chat][chat-image]][chat-url]
210
+
186
211
  ---
187
212
 
188
213
  ## License
@@ -192,7 +217,7 @@ See [LICENSE][stdlib-license].
192
217
 
193
218
  ## Copyright
194
219
 
195
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
220
+ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
196
221
 
197
222
  </section>
198
223
 
@@ -211,9 +236,23 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
211
236
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-gnansumors/main.svg
212
237
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-gnansumors?branch=main
213
238
 
214
- [dependencies-image]: https://img.shields.io/david/stdlib-js/blas-ext-base-gnansumors
239
+ <!--
240
+
241
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/blas-ext-base-gnansumors.svg
215
242
  [dependencies-url]: https://david-dm.org/stdlib-js/blas-ext-base-gnansumors/main
216
243
 
244
+ -->
245
+
246
+ [umd]: https://github.com/umdjs/umd
247
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
248
+
249
+ [deno-url]: https://github.com/stdlib-js/blas-ext-base-gnansumors/tree/deno
250
+ [umd-url]: https://github.com/stdlib-js/blas-ext-base-gnansumors/tree/umd
251
+ [esm-url]: https://github.com/stdlib-js/blas-ext-base-gnansumors/tree/esm
252
+
253
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
254
+ [chat-url]: https://gitter.im/stdlib-js/stdlib/
255
+
217
256
  [stdlib]: https://github.com/stdlib-js/stdlib
218
257
 
219
258
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
@@ -224,9 +263,21 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
224
263
 
225
264
  [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
226
265
 
227
- [@stdlib/blas/ext/base/dnansumors]: https://github.com/stdlib-js/blas-ext-base-dnansumors
266
+ <!-- <related-links> -->
267
+
268
+ [@stdlib/blas/ext/base/dnansumors]: https://www.npmjs.com/package/@stdlib/blas-ext-base-dnansumors
269
+
270
+ [@stdlib/blas/ext/base/gnansum]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gnansum
271
+
272
+ [@stdlib/blas/ext/base/gnansumkbn2]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gnansumkbn2
273
+
274
+ [@stdlib/blas/ext/base/gnansumpw]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gnansumpw
275
+
276
+ [@stdlib/blas/ext/base/gsumors]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gsumors
277
+
278
+ [@stdlib/blas/ext/base/snansumors]: https://www.npmjs.com/package/@stdlib/blas-ext-base-snansumors
228
279
 
229
- [@stdlib/blas/ext/base/snansumors]: https://github.com/stdlib-js/blas-ext-base-snansumors
280
+ <!-- </related-links> -->
230
281
 
231
282
  </section>
232
283
 
package/lib/index.js CHANGED
@@ -45,9 +45,16 @@
45
45
 
46
46
  // MODULES //
47
47
 
48
- var gnansumors = require( './main.js' );
48
+ var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
49
+ var main = require( './main.js' );
50
+ var ndarray = require( './ndarray.js' );
51
+
52
+
53
+ // MAIN //
54
+
55
+ setReadOnly( main, 'ndarray', ndarray );
49
56
 
50
57
 
51
58
  // EXPORTS //
52
59
 
53
- module.exports = gnansumors;
60
+ module.exports = main;
package/lib/main.js CHANGED
@@ -20,14 +20,54 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
24
- var gnansumors = require( './gnansumors.js' );
25
- var ndarray = require( './ndarray.js' );
23
+ var isnan = require( '@stdlib/math-base-assert-is-nan' );
26
24
 
27
25
 
28
26
  // MAIN //
29
27
 
30
- setReadOnly( gnansumors, 'ndarray', ndarray );
28
+ /**
29
+ * Computes the sum of strided array elements, ignoring `NaN` values and using ordinary recursive summation.
30
+ *
31
+ * @param {PositiveInteger} N - number of indexed elements
32
+ * @param {NumericArray} x - input array
33
+ * @param {integer} stride - stride length
34
+ * @returns {number} sum
35
+ *
36
+ * @example
37
+ * var x = [ 1.0, -2.0, NaN, 2.0 ];
38
+ * var N = x.length;
39
+ *
40
+ * var v = gnansumors( N, x, 1 );
41
+ * // returns 1.0
42
+ */
43
+ function gnansumors( N, x, stride ) {
44
+ var ix;
45
+ var s;
46
+ var i;
47
+
48
+ s = 0.0;
49
+ if ( N <= 0 ) {
50
+ return s;
51
+ }
52
+ if ( N === 1 || stride === 0 ) {
53
+ if ( isnan( x[ 0 ] ) ) {
54
+ return s;
55
+ }
56
+ return x[ 0 ];
57
+ }
58
+ if ( stride < 0 ) {
59
+ ix = (1-N) * stride;
60
+ } else {
61
+ ix = 0;
62
+ }
63
+ for ( i = 0; i < N; i++ ) {
64
+ if ( isnan( x[ ix ] ) === false ) {
65
+ s += x[ ix ];
66
+ }
67
+ ix += stride;
68
+ }
69
+ return s;
70
+ }
31
71
 
32
72
 
33
73
  // EXPORTS //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-gnansumors",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "Calculate the sum of strided array elements, ignoring NaN values and using ordinary recursive summation.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -28,7 +28,7 @@
28
28
  "examples": "make examples",
29
29
  "benchmark": "make benchmark"
30
30
  },
31
- "homepage": "https://github.com/stdlib-js/stdlib",
31
+ "homepage": "https://stdlib.io",
32
32
  "repository": {
33
33
  "type": "git",
34
34
  "url": "git://github.com/stdlib-js/blas-ext-base-gnansumors.git"
package/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- # CHANGELOG
2
-
3
- > Package changelog.
4
-
5
- See [GitHub Releases](https://github.com/stdlib-js/blas-ext-base-gnansumors/releases) for the changelog.
package/lib/gnansumors.js DELETED
@@ -1,75 +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
- 'use strict';
20
-
21
- // MODULES //
22
-
23
- var isnan = require( '@stdlib/math-base-assert-is-nan' );
24
-
25
-
26
- // MAIN //
27
-
28
- /**
29
- * Computes the sum of strided array elements, ignoring `NaN` values and using ordinary recursive summation.
30
- *
31
- * @param {PositiveInteger} N - number of indexed elements
32
- * @param {NumericArray} x - input array
33
- * @param {integer} stride - stride length
34
- * @returns {number} sum
35
- *
36
- * @example
37
- * var x = [ 1.0, -2.0, NaN, 2.0 ];
38
- * var N = x.length;
39
- *
40
- * var v = gnansumors( N, x, 1 );
41
- * // returns 1.0
42
- */
43
- function gnansumors( N, x, stride ) {
44
- var ix;
45
- var s;
46
- var i;
47
-
48
- s = 0.0;
49
- if ( N <= 0 ) {
50
- return s;
51
- }
52
- if ( N === 1 || stride === 0 ) {
53
- if ( isnan( x[ 0 ] ) ) {
54
- return s;
55
- }
56
- return x[ 0 ];
57
- }
58
- if ( stride < 0 ) {
59
- ix = (1-N) * stride;
60
- } else {
61
- ix = 0;
62
- }
63
- for ( i = 0; i < N; i++ ) {
64
- if ( isnan( x[ ix ] ) === false ) {
65
- s += x[ ix ];
66
- }
67
- ix += stride;
68
- }
69
- return s;
70
- }
71
-
72
-
73
- // EXPORTS //
74
-
75
- module.exports = gnansumors;