@stdlib/blas-ext-base-gcusumors 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
  # gcusumors
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 cumulative sum of strided array elements using ordinary recursive summation.
26
26
 
@@ -108,7 +108,7 @@ var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th
108
108
  var N = floor( x0.length / 2 );
109
109
 
110
110
  gcusumors( N, 0.0, x1, -2, y1, 1 );
111
- // y0 => <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0 ]
111
+ // y0 => <Float64Array>[ 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0, 0.0 ]
112
112
  ```
113
113
 
114
114
  #### gcusumors.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY )
@@ -196,6 +196,25 @@ console.log( y );
196
196
 
197
197
  <!-- /.references -->
198
198
 
199
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
200
+
201
+ <section class="related">
202
+
203
+ * * *
204
+
205
+ ## See Also
206
+
207
+ - <span class="package-name">[`@stdlib/blas/ext/base/dcusumors`][@stdlib/blas/ext/base/dcusumors]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of double-precision floating-point strided array elements using ordinary recursive summation.</span>
208
+ - <span class="package-name">[`@stdlib/blas/ext/base/gcusum`][@stdlib/blas/ext/base/gcusum]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of strided array elements.</span>
209
+ - <span class="package-name">[`@stdlib/blas/ext/base/gcusumpw`][@stdlib/blas/ext/base/gcusumpw]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of strided array elements using pairwise summation.</span>
210
+ - <span class="package-name">[`@stdlib/blas/ext/base/scusumors`][@stdlib/blas/ext/base/scusumors]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of single-precision floating-point strided array elements using ordinary recursive summation.</span>
211
+
212
+ </section>
213
+
214
+ <!-- /.related -->
215
+
216
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
217
+
199
218
 
200
219
  <section class="main-repo" >
201
220
 
@@ -207,6 +226,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
207
226
 
208
227
  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].
209
228
 
229
+ #### Community
230
+
231
+ [![Chat][chat-image]][chat-url]
232
+
210
233
  ---
211
234
 
212
235
  ## License
@@ -216,7 +239,7 @@ See [LICENSE][stdlib-license].
216
239
 
217
240
  ## Copyright
218
241
 
219
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
242
+ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
220
243
 
221
244
  </section>
222
245
 
@@ -235,9 +258,23 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
235
258
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-gcusumors/main.svg
236
259
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-gcusumors?branch=main
237
260
 
238
- [dependencies-image]: https://img.shields.io/david/stdlib-js/blas-ext-base-gcusumors
261
+ <!--
262
+
263
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/blas-ext-base-gcusumors.svg
239
264
  [dependencies-url]: https://david-dm.org/stdlib-js/blas-ext-base-gcusumors/main
240
265
 
266
+ -->
267
+
268
+ [umd]: https://github.com/umdjs/umd
269
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
270
+
271
+ [deno-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/tree/deno
272
+ [umd-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/tree/umd
273
+ [esm-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/tree/esm
274
+
275
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
276
+ [chat-url]: https://gitter.im/stdlib-js/stdlib/
277
+
241
278
  [stdlib]: https://github.com/stdlib-js/stdlib
242
279
 
243
280
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
@@ -248,9 +285,17 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
248
285
 
249
286
  [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
250
287
 
251
- [@stdlib/blas/ext/base/dcusumors]: https://github.com/stdlib-js/blas-ext-base-dcusumors
288
+ <!-- <related-links> -->
289
+
290
+ [@stdlib/blas/ext/base/dcusumors]: https://www.npmjs.com/package/@stdlib/blas-ext-base-dcusumors
291
+
292
+ [@stdlib/blas/ext/base/gcusum]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gcusum
293
+
294
+ [@stdlib/blas/ext/base/gcusumpw]: https://www.npmjs.com/package/@stdlib/blas-ext-base-gcusumpw
295
+
296
+ [@stdlib/blas/ext/base/scusumors]: https://www.npmjs.com/package/@stdlib/blas-ext-base-scusumors
252
297
 
253
- [@stdlib/blas/ext/base/scusumors]: https://github.com/stdlib-js/blas-ext-base-scusumors
298
+ <!-- </related-links> -->
254
299
 
255
300
  </section>
256
301
 
package/lib/index.js CHANGED
@@ -46,9 +46,16 @@
46
46
 
47
47
  // MODULES //
48
48
 
49
- var gcusumors = require( './main.js' );
49
+ var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
50
+ var main = require( './main.js' );
51
+ var ndarray = require( './ndarray.js' );
52
+
53
+
54
+ // MAIN //
55
+
56
+ setReadOnly( main, 'ndarray', ndarray );
50
57
 
51
58
 
52
59
  // EXPORTS //
53
60
 
54
- module.exports = gcusumors;
61
+ module.exports = main;
package/lib/main.js CHANGED
@@ -18,16 +18,52 @@
18
18
 
19
19
  'use strict';
20
20
 
21
- // MODULES //
22
-
23
- var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
24
- var gcusumors = require( './gcusumors.js' );
25
- var ndarray = require( './ndarray.js' );
26
-
27
-
28
21
  // MAIN //
29
22
 
30
- setReadOnly( gcusumors, 'ndarray', ndarray );
23
+ /**
24
+ * Computes the cumulative sum of strided array elements using ordinary recursive summation.
25
+ *
26
+ * @param {PositiveInteger} N - number of indexed elements
27
+ * @param {number} sum - initial sum
28
+ * @param {NumericArray} x - input array
29
+ * @param {integer} strideX - `x` stride length
30
+ * @param {NumericArray} y - output array
31
+ * @param {integer} strideY - `y` stride length
32
+ * @returns {NumericArray} output array
33
+ *
34
+ * @example
35
+ * var x = [ 1.0, -2.0, 2.0 ];
36
+ * var y = [ 0.0, 0.0, 0.0 ];
37
+ *
38
+ * var v = gcusumors( x.length, 0.0, x, 1, y, 1 );
39
+ * // returns [ 1.0, -1.0, 1.0 ]
40
+ */
41
+ function gcusumors( N, sum, x, strideX, y, strideY ) {
42
+ var ix;
43
+ var iy;
44
+ var i;
45
+
46
+ if ( N <= 0 ) {
47
+ return y;
48
+ }
49
+ if ( strideX < 0 ) {
50
+ ix = (1-N) * strideX;
51
+ } else {
52
+ ix = 0;
53
+ }
54
+ if ( strideY < 0 ) {
55
+ iy = (1-N) * strideY;
56
+ } else {
57
+ iy = 0;
58
+ }
59
+ for ( i = 0; i < N; i++ ) {
60
+ sum += x[ ix ];
61
+ y[ iy ] = sum;
62
+ ix += strideX;
63
+ iy += strideY;
64
+ }
65
+ return y;
66
+ }
31
67
 
32
68
 
33
69
  // EXPORTS //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-gcusumors",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "Calculate the cumulative sum of strided array elements 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-gcusumors.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-gcusumors/releases) for the changelog.
package/lib/gcusumors.js DELETED
@@ -1,71 +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
- // MAIN //
22
-
23
- /**
24
- * Computes the cumulative sum of strided array elements using ordinary recursive summation.
25
- *
26
- * @param {PositiveInteger} N - number of indexed elements
27
- * @param {number} sum - initial sum
28
- * @param {NumericArray} x - input array
29
- * @param {integer} strideX - `x` stride length
30
- * @param {NumericArray} y - output array
31
- * @param {integer} strideY - `y` stride length
32
- * @returns {NumericArray} output array
33
- *
34
- * @example
35
- * var x = [ 1.0, -2.0, 2.0 ];
36
- * var y = [ 0.0, 0.0, 0.0 ];
37
- *
38
- * var v = gcusumors( x.length, 0.0, x, 1, y, 1 );
39
- * // returns [ 1.0, -1.0, 1.0 ]
40
- */
41
- function gcusumors( N, sum, x, strideX, y, strideY ) {
42
- var ix;
43
- var iy;
44
- var i;
45
-
46
- if ( N <= 0 ) {
47
- return y;
48
- }
49
- if ( strideX < 0 ) {
50
- ix = (1-N) * strideX;
51
- } else {
52
- ix = 0;
53
- }
54
- if ( strideY < 0 ) {
55
- iy = (1-N) * strideY;
56
- } else {
57
- iy = 0;
58
- }
59
- for ( i = 0; i < N; i++ ) {
60
- sum += x[ ix ];
61
- y[ iy ] = sum;
62
- ix += strideX;
63
- iy += strideY;
64
- }
65
- return y;
66
- }
67
-
68
-
69
- // EXPORTS //
70
-
71
- module.exports = gcusumors;