@stdlib/blas-ext-base-gcusumors 0.0.9 → 0.1.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/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 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
  # gcusumors
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] -->
@@ -204,10 +215,10 @@ console.log( y );
204
215
 
205
216
  ## See Also
206
217
 
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>
218
+ - <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>
219
+ - <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>
220
+ - <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>
221
+ - <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
222
 
212
223
  </section>
213
224
 
@@ -239,7 +250,7 @@ See [LICENSE][stdlib-license].
239
250
 
240
251
  ## Copyright
241
252
 
242
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
253
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
243
254
 
244
255
  </section>
245
256
 
@@ -252,8 +263,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
252
263
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-gcusumors.svg
253
264
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-gcusumors
254
265
 
255
- [test-image]: https://github.com/stdlib-js/blas-ext-base-gcusumors/actions/workflows/test.yml/badge.svg?branch=v0.0.9
256
- [test-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/actions/workflows/test.yml?query=branch:v0.0.9
266
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-gcusumors/actions/workflows/test.yml/badge.svg?branch=v0.1.0
267
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/actions/workflows/test.yml?query=branch:v0.1.0
257
268
 
258
269
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-gcusumors/main.svg
259
270
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-gcusumors?branch=main
@@ -266,7 +277,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
266
277
  -->
267
278
 
268
279
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
269
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
280
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
270
281
 
271
282
  [stdlib]: https://github.com/stdlib-js/stdlib
272
283
 
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import gcusumors from '../docs/types/index';
3
+ export = gcusumors;
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var c=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var l=c(function(h,x){
2
+ function m(e,r,o,t,s,a){var u,n,i;if(e<=0)return s;for(t<0?u=(1-e)*t:u=0,a<0?n=(1-e)*a:n=0,i=0;i<e;i++)r+=o[u],s[n]=r,u+=t,n+=a;return s}x.exports=m
3
+ });var q=c(function(j,p){
4
+ function y(e,r,o,t,s,a,u,n){var i,v,f;if(e<=0)return a;for(i=s,v=n,f=0;f<e;f++)r+=o[i],a[v]=r,i+=t,v+=u;return a}p.exports=y
5
+ });var O=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),g=l(),R=q();O(g,"ndarray",R);module.exports=g;
6
+ /** @license Apache-2.0 */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/ndarray.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// MAIN //\n\n/**\n* Computes the cumulative sum of strided array elements using ordinary recursive summation.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {NumericArray} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NumericArray} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {NumericArray} output array\n*\n* @example\n* var x = [ 1.0, -2.0, 2.0 ];\n* var y = [ 0.0, 0.0, 0.0 ];\n*\n* var v = gcusumors( x.length, 0.0, x, 1, y, 1 );\n* // returns [ 1.0, -1.0, 1.0 ]\n*/\nfunction gcusumors( N, sum, x, strideX, y, strideY ) {\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tsum += x[ ix ];\n\t\ty[ iy ] = sum;\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gcusumors;\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// MAIN //\n\n/**\n* Computes the cumulative sum of strided array elements using ordinary recursive summation.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {NumericArray} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting index for `x`\n* @param {NumericArray} y - output array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting index for `y`\n* @returns {NumericArray} output array\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 y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];\n* var N = floor( x.length / 2 );\n*\n* gcusumors( N, 0.0, x, 2, 1, y, 1, 0 );\n* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction gcusumors( N, sum, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tsum += x[ ix ];\n\t\ty[ iy ] = sum;\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gcusumors;\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 cumulative sum of strided array elements using ordinary recursive summation.\n*\n* @module @stdlib/blas-ext-base-gcusumors\n*\n* @example\n* var gcusumors = require( '@stdlib/blas-ext-base-gcusumors' );\n*\n* var x = [ 1.0, -2.0, 2.0 ];\n* var y = [ 0.0, 0.0, 0.0 ];\n*\n* gcusumors( x.length, 0.0, x, 1, y, 1 );\n* // y => [ 1.0, -1.0, 1.0 ]\n*\n* @example\n* var floor = require( '@stdlib/math-base-special-floor' );\n* var gcusumors = require( '@stdlib/blas-ext-base-gcusumors' );\n*\n* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];\n* var N = floor( x.length / 2 );\n*\n* gcusumors.ndarray( N, 0.0, x, 2, 1, y, 1, 0 );\n* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.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": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwCA,SAASC,EAAWC,EAAGC,EAAKC,EAAGC,EAASC,EAAGC,EAAU,CACpD,IAAIC,EACAC,EACA,EAEJ,GAAKP,GAAK,EACT,OAAOI,EAYR,IAVKD,EAAU,EACdG,GAAM,EAAEN,GAAKG,EAEbG,EAAK,EAEDD,EAAU,EACdE,GAAM,EAAEP,GAAKK,EAEbE,EAAK,EAEA,EAAI,EAAG,EAAIP,EAAG,IACnBC,GAAOC,EAAGI,CAAG,EACbF,EAAGG,CAAG,EAAIN,EACVK,GAAMH,EACNI,GAAMF,EAEP,OAAOD,CACR,CAKAN,EAAO,QAAUC,ICtEjB,IAAAS,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAAWC,EAAGC,EAAKC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CACtE,IAAIC,EACAC,EACAC,EAEJ,GAAKV,GAAK,EACT,OAAOK,EAIR,IAFAG,EAAKJ,EACLK,EAAKF,EACCG,EAAI,EAAGA,EAAIV,EAAGU,IACnBT,GAAOC,EAAGM,CAAG,EACbH,EAAGI,CAAG,EAAIR,EACVO,GAAML,EACNM,GAAMH,EAEP,OAAOD,CACR,CAKAP,EAAO,QAAUC,ICnBjB,IAAIY,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "gcusumors", "N", "sum", "x", "strideX", "y", "strideY", "ix", "iy", "require_ndarray", "__commonJSMin", "exports", "module", "gcusumors", "N", "sum", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "ix", "iy", "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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-gcusumors",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "Calculate the cumulative sum of strided array elements using ordinary recursive summation.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,21 +37,21 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/types": "^0.0.x",
41
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x"
40
+ "@stdlib/types": "^0.0.14",
41
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@stdlib/array-float64": "^0.0.x",
45
- "@stdlib/bench": "^0.0.x",
46
- "@stdlib/blas-ext-base-gfill": "^0.0.x",
47
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
48
- "@stdlib/math-base-special-floor": "^0.0.x",
49
- "@stdlib/math-base-special-pow": "^0.0.x",
50
- "@stdlib/math-base-special-round": "^0.0.x",
51
- "@stdlib/random-base-randu": "^0.0.x",
44
+ "@stdlib/array-float64": "^0.0.6",
45
+ "@stdlib/bench": "^0.0.12",
46
+ "@stdlib/blas-ext-base-gfill": "^0.0.10",
47
+ "@stdlib/math-base-assert-is-nan": "^0.0.8",
48
+ "@stdlib/math-base-special-floor": "^0.0.8",
49
+ "@stdlib/math-base-special-pow": "^0.0.7",
50
+ "@stdlib/math-base-special-round": "^0.1.0",
51
+ "@stdlib/random-base-randu": "^0.0.8",
52
52
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
53
53
  "istanbul": "^0.4.1",
54
- "tap-spec": "5.x.x"
54
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=0.10.0",
@@ -90,7 +90,7 @@
90
90
  ],
91
91
  "__stdlib__": {},
92
92
  "funding": {
93
- "type": "patreon",
94
- "url": "https://www.patreon.com/athan"
93
+ "type": "opencollective",
94
+ "url": "https://opencollective.com/stdlib"
95
95
  }
96
96
  }
package/docs/repl.txt DELETED
@@ -1,121 +0,0 @@
1
-
2
- {{alias}}( N, sum, x, strideX, y, strideY )
3
- Computes the cumulative sum of strided array elements using ordinary
4
- recursive summation.
5
-
6
- The `N` and `stride` parameters determine which elements in `x` and `y` are
7
- accessed 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 `y` unchanged.
13
-
14
- Parameters
15
- ----------
16
- N: integer
17
- Number of indexed elements.
18
-
19
- sum: number
20
- Initial sum.
21
-
22
- x: Array<number>|TypedArray
23
- Input array.
24
-
25
- strideX: integer
26
- Index increment for `x`.
27
-
28
- y: Array<number>|TypedArray
29
- Output array.
30
-
31
- strideY: integer
32
- Index increment for `y`.
33
-
34
- Returns
35
- -------
36
- out: Array<number>|TypedArray
37
- Output array.
38
-
39
- Examples
40
- --------
41
- // Standard Usage:
42
- > var x = [ 1.0, -2.0, 2.0 ];
43
- > var y = [ 0.0, 0.0, 0.0 ];
44
- > {{alias}}( x.length, 0.0, x, 1, y, 1 )
45
- [ 1.0, -1.0, 1.0 ]
46
-
47
- // Using `N` and `stride` parameters:
48
- > x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ];
49
- > y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
50
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
51
- > {{alias}}( N, 0.0, x, 2, y, 2 )
52
- [ -2.0, 0.0, -1.0, 0.0, 1.0, 0.0 ]
53
-
54
- // Using view offsets:
55
- > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
56
- > var y0 = new {{alias:@stdlib/array/float64}}( x0.length );
57
- > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
58
- > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 );
59
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
60
- > {{alias}}( N, 0.0, x1, 2, y1, 1 )
61
- <Float64Array>[ -2.0, 0.0, -1.0 ]
62
- > y0
63
- <Float64Array>[ 0.0, 0.0, 0.0, -2.0, 0.0, -1.0 ]
64
-
65
- {{alias}}.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY )
66
- Computes the cumulative sum of strided array elements using ordinary
67
- recursive summation and alternative indexing semantics.
68
-
69
- While typed array views mandate a view offset based on the underlying
70
- buffer, the `offset` parameter supports indexing semantics based on a
71
- starting index.
72
-
73
- Parameters
74
- ----------
75
- N: integer
76
- Number of indexed elements.
77
-
78
- sum: number
79
- Initial sum.
80
-
81
- x: Array<number>|TypedArray
82
- Input array.
83
-
84
- strideX: integer
85
- Index increment for `x`.
86
-
87
- offsetX: integer
88
- Starting index for `x`.
89
-
90
- y: Array<number>|TypedArray
91
- Output array.
92
-
93
- strideY: integer
94
- Index increment for `y`.
95
-
96
- offsetY: integer
97
- Starting index for `y`.
98
-
99
- Returns
100
- -------
101
- out: Array<number>|TypedArray
102
- Output array.
103
-
104
- Examples
105
- --------
106
- // Standard Usage:
107
- > var x = [ 1.0, -2.0, 2.0 ];
108
- > var y = [ 0.0, 0.0, 0.0 ];
109
- > {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
110
- <Float64Array>[ 1.0, -1.0, 1.0 ]
111
-
112
- // Advanced indexing:
113
- > x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ];
114
- > y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
115
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
116
- > {{alias}}.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 )
117
- <Float64Array>[ 0.0, 0.0, 0.0, -1.0, 0.0, -2.0 ]
118
-
119
- See Also
120
- --------
121
-
@@ -1,280 +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 gcusumors = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a numeric array...
25
- {
26
- const x = new Float64Array( 10 );
27
- const y = new Float64Array( 10 );
28
-
29
- gcusumors( x.length, 0.0, x, 1, y, 1 ); // $ExpectType NumericArray
30
- }
31
-
32
- // The compiler throws an error if the function is provided a first argument which is not a number...
33
- {
34
- const x = new Float64Array( 10 );
35
- const y = new Float64Array( 10 );
36
-
37
- gcusumors( '10', 0.0, x, 1, y, 1 ); // $ExpectError
38
- gcusumors( true, 0.0, x, 1, y, 1 ); // $ExpectError
39
- gcusumors( false, 0.0, x, 1, y, 1 ); // $ExpectError
40
- gcusumors( null, 0.0, x, 1, y, 1 ); // $ExpectError
41
- gcusumors( undefined, 0.0, x, 1, y, 1 ); // $ExpectError
42
- gcusumors( [], 0.0, x, 1, y, 1 ); // $ExpectError
43
- gcusumors( {}, 0.0, x, 1, y, 1 ); // $ExpectError
44
- gcusumors( ( x: number ): number => x, 0.0, x, 1, y, 1 ); // $ExpectError
45
- }
46
-
47
- // The compiler throws an error if the function is provided a second argument which is not a number...
48
- {
49
- const x = new Float64Array( 10 );
50
- const y = new Float64Array( 10 );
51
-
52
- gcusumors( x.length, '10', 0.0, x, 1, y, 1 ); // $ExpectError
53
- gcusumors( x.length, true, 0.0, x, 1, y, 1 ); // $ExpectError
54
- gcusumors( x.length, false, 0.0, x, 1, y, 1 ); // $ExpectError
55
- gcusumors( x.length, null, 0.0, x, 1, y, 1 ); // $ExpectError
56
- gcusumors( x.length, undefined, 0.0, x, 1, y, 1 ); // $ExpectError
57
- gcusumors( x.length, [], 0.0, x, 1, y, 1 ); // $ExpectError
58
- gcusumors( x.length, {}, 0.0, x, 1, y, 1 ); // $ExpectError
59
- gcusumors( x.length, ( x: number ): number => x, 0.0, x, 1, y, 1 ); // $ExpectError
60
- }
61
-
62
- // The compiler throws an error if the function is provided a third argument which is not a numeric array...
63
- {
64
- const x = new Float64Array( 10 );
65
- const y = new Float64Array( 10 );
66
-
67
- gcusumors( x.length, 0.0, 10, 1, y, 1 ); // $ExpectError
68
- gcusumors( x.length, 0.0, '10', 1, y, 1 ); // $ExpectError
69
- gcusumors( x.length, 0.0, true, 1, y, 1 ); // $ExpectError
70
- gcusumors( x.length, 0.0, false, 1, y, 1 ); // $ExpectError
71
- gcusumors( x.length, 0.0, null, 1, y, 1 ); // $ExpectError
72
- gcusumors( x.length, 0.0, undefined, 1, y, 1 ); // $ExpectError
73
- gcusumors( x.length, 0.0, [ '1' ], 1, y, 1 ); // $ExpectError
74
- gcusumors( x.length, 0.0, {}, 1, y, 1 ); // $ExpectError
75
- gcusumors( x.length, 0.0, ( x: number ): number => x, 1, y, 1 ); // $ExpectError
76
- }
77
-
78
- // The compiler throws an error if the function is provided a fourth argument which is not a number...
79
- {
80
- const x = new Float64Array( 10 );
81
- const y = new Float64Array( 10 );
82
-
83
- gcusumors( x.length, 0.0, x, '10', y, 1 ); // $ExpectError
84
- gcusumors( x.length, 0.0, x, true, y, 1 ); // $ExpectError
85
- gcusumors( x.length, 0.0, x, false, y, 1 ); // $ExpectError
86
- gcusumors( x.length, 0.0, x, null, y, 1 ); // $ExpectError
87
- gcusumors( x.length, 0.0, x, undefined, y, 1 ); // $ExpectError
88
- gcusumors( x.length, 0.0, x, [], y, 1 ); // $ExpectError
89
- gcusumors( x.length, 0.0, x, {}, y, 1 ); // $ExpectError
90
- gcusumors( x.length, 0.0, x, ( x: number ): number => x, y, 1 ); // $ExpectError
91
- }
92
-
93
- // The compiler throws an error if the function is provided a fifth argument which is not a numeric array...
94
- {
95
- const x = new Float64Array( 10 );
96
-
97
- gcusumors( x.length, 0.0, x, 1, 10, 1 ); // $ExpectError
98
- gcusumors( x.length, 0.0, x, 1, '10', 1 ); // $ExpectError
99
- gcusumors( x.length, 0.0, x, 1, true, 1 ); // $ExpectError
100
- gcusumors( x.length, 0.0, x, 1, false, 1 ); // $ExpectError
101
- gcusumors( x.length, 0.0, x, 1, null, 1 ); // $ExpectError
102
- gcusumors( x.length, 0.0, x, 1, undefined, 1 ); // $ExpectError
103
- gcusumors( x.length, 0.0, x, 1, [ '1' ], 1 ); // $ExpectError
104
- gcusumors( x.length, 0.0, x, 1, {}, 1 ); // $ExpectError
105
- gcusumors( x.length, 0.0, x, 1, ( x: number ): number => x, 1 ); // $ExpectError
106
- }
107
-
108
- // The compiler throws an error if the function is provided a sixth argument which is not a number...
109
- {
110
- const x = new Float64Array( 10 );
111
- const y = new Float64Array( 10 );
112
-
113
- gcusumors( x.length, 0.0, x, 1, y, '10' ); // $ExpectError
114
- gcusumors( x.length, 0.0, x, 1, y, true ); // $ExpectError
115
- gcusumors( x.length, 0.0, x, 1, y, false ); // $ExpectError
116
- gcusumors( x.length, 0.0, x, 1, y, null ); // $ExpectError
117
- gcusumors( x.length, 0.0, x, 1, y, undefined ); // $ExpectError
118
- gcusumors( x.length, 0.0, x, 1, y, [] ); // $ExpectError
119
- gcusumors( x.length, 0.0, x, 1, y, {} ); // $ExpectError
120
- gcusumors( x.length, 0.0, x, 1, y, ( x: number ): number => x ); // $ExpectError
121
- }
122
-
123
- // The compiler throws an error if the function is provided an unsupported number of arguments...
124
- {
125
- const x = new Float64Array( 10 );
126
- const y = new Float64Array( 10 );
127
-
128
- gcusumors(); // $ExpectError
129
- gcusumors( x.length ); // $ExpectError
130
- gcusumors( x.length, 0.0 ); // $ExpectError
131
- gcusumors( x.length, 0.0, x ); // $ExpectError
132
- gcusumors( x.length, 0.0, x, 1 ); // $ExpectError
133
- gcusumors( x.length, 0.0, x, 1, y ); // $ExpectError
134
- gcusumors( x.length, 0.0, x, 1, y, 1, 10 ); // $ExpectError
135
- }
136
-
137
- // Attached to main export is an `ndarray` method which returns a numeric array...
138
- {
139
- const x = new Float64Array( 10 );
140
- const y = new Float64Array( 10 );
141
-
142
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectType NumericArray
143
- }
144
-
145
- // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
146
- {
147
- const x = new Float64Array( 10 );
148
- const y = new Float64Array( 10 );
149
-
150
- gcusumors.ndarray( '10', 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
151
- gcusumors.ndarray( true, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
152
- gcusumors.ndarray( false, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
153
- gcusumors.ndarray( null, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
154
- gcusumors.ndarray( undefined, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
155
- gcusumors.ndarray( [], 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
156
- gcusumors.ndarray( {}, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
157
- gcusumors.ndarray( ( x: number ): number => x, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
158
- }
159
-
160
- // The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
161
- {
162
- const x = new Float64Array( 10 );
163
- const y = new Float64Array( 10 );
164
-
165
- gcusumors.ndarray( x.length, '10', 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
166
- gcusumors.ndarray( x.length, true, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
167
- gcusumors.ndarray( x.length, false, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
168
- gcusumors.ndarray( x.length, null, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
169
- gcusumors.ndarray( x.length, undefined, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
170
- gcusumors.ndarray( x.length, [], 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
171
- gcusumors.ndarray( x.length, {}, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
172
- gcusumors.ndarray( x.length, ( x: number ): number => x, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
173
- }
174
-
175
- // The compiler throws an error if the `ndarray` method is provided a third argument which is not a numeric array...
176
- {
177
- const x = new Float64Array( 10 );
178
- const y = new Float64Array( 10 );
179
-
180
- gcusumors.ndarray( x.length, 0.0, 10, 1, 0, y, 1, 0 ); // $ExpectError
181
- gcusumors.ndarray( x.length, 0.0, '10', 1, 0, y, 1, 0 ); // $ExpectError
182
- gcusumors.ndarray( x.length, 0.0, true, 1, 0, y, 1, 0 ); // $ExpectError
183
- gcusumors.ndarray( x.length, 0.0, false, 1, 0, y, 1, 0 ); // $ExpectError
184
- gcusumors.ndarray( x.length, 0.0, null, 1, 0, y, 1, 0 ); // $ExpectError
185
- gcusumors.ndarray( x.length, 0.0, undefined, 1, 0, y, 1, 0 ); // $ExpectError
186
- gcusumors.ndarray( x.length, 0.0, [ '1' ], 1, 0, y, 1, 0 ); // $ExpectError
187
- gcusumors.ndarray( x.length, 0.0, {}, 1, 0, y, 1, 0 ); // $ExpectError
188
- gcusumors.ndarray( x.length, 0.0, ( x: number ): number => x, 1, 0, y, 1, 0 ); // $ExpectError
189
- }
190
-
191
- // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
192
- {
193
- const x = new Float64Array( 10 );
194
- const y = new Float64Array( 10 );
195
-
196
- gcusumors.ndarray( x.length, 0.0, x, '10', 0, y, 1, 0 ); // $ExpectError
197
- gcusumors.ndarray( x.length, 0.0, x, true, 0, y, 1, 0 ); // $ExpectError
198
- gcusumors.ndarray( x.length, 0.0, x, false, 0, y, 1, 0 ); // $ExpectError
199
- gcusumors.ndarray( x.length, 0.0, x, null, 0, y, 1, 0 ); // $ExpectError
200
- gcusumors.ndarray( x.length, 0.0, x, undefined, 0, y, 1, 0 ); // $ExpectError
201
- gcusumors.ndarray( x.length, 0.0, x, [], 0, y, 1, 0 ); // $ExpectError
202
- gcusumors.ndarray( x.length, 0.0, x, {}, 0, y, 1, 0 ); // $ExpectError
203
- gcusumors.ndarray( x.length, 0.0, x, ( x: number ): number => x, 0, y, 1, 0 ); // $ExpectError
204
- }
205
-
206
- // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
207
- {
208
- const x = new Float64Array( 10 );
209
- const y = new Float64Array( 10 );
210
-
211
- gcusumors.ndarray( x.length, 0.0, x, 1, '10', y, 1, 0 ); // $ExpectError
212
- gcusumors.ndarray( x.length, 0.0, x, 1, true, y, 1, 0 ); // $ExpectError
213
- gcusumors.ndarray( x.length, 0.0, x, 1, false, y, 1, 0 ); // $ExpectError
214
- gcusumors.ndarray( x.length, 0.0, x, 1, null, y, 1, 0 ); // $ExpectError
215
- gcusumors.ndarray( x.length, 0.0, x, 1, undefined, y, 1, 0 ); // $ExpectError
216
- gcusumors.ndarray( x.length, 0.0, x, 1, [], y, 1, 0 ); // $ExpectError
217
- gcusumors.ndarray( x.length, 0.0, x, 1, {}, y, 1, 0 ); // $ExpectError
218
- gcusumors.ndarray( x.length, 0.0, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError
219
- }
220
-
221
- // The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a numeric array...
222
- {
223
- const x = new Float64Array( 10 );
224
-
225
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, 10, 1, 0 ); // $ExpectError
226
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, '10', 1, 0 ); // $ExpectError
227
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, true, 1, 0 ); // $ExpectError
228
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, false, 1, 0 ); // $ExpectError
229
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, null, 1, 0 ); // $ExpectError
230
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, undefined, 1, 0 ); // $ExpectError
231
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, [ '1' ], 1, 0 ); // $ExpectError
232
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, {}, 1, 0 ); // $ExpectError
233
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError
234
- }
235
-
236
- // The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
237
- {
238
- const x = new Float64Array( 10 );
239
- const y = new Float64Array( 10 );
240
-
241
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, '10', 0 ); // $ExpectError
242
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, true, 0 ); // $ExpectError
243
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, false, 0 ); // $ExpectError
244
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, null, 0 ); // $ExpectError
245
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, undefined, 0 ); // $ExpectError
246
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, [], 0 ); // $ExpectError
247
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, {}, 0 ); // $ExpectError
248
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError
249
- }
250
-
251
- // The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number...
252
- {
253
- const x = new Float64Array( 10 );
254
- const y = new Float64Array( 10 );
255
-
256
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, '10' ); // $ExpectError
257
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, true ); // $ExpectError
258
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, false ); // $ExpectError
259
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, null ); // $ExpectError
260
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, undefined ); // $ExpectError
261
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, [] ); // $ExpectError
262
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, {} ); // $ExpectError
263
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError
264
- }
265
-
266
- // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
267
- {
268
- const x = new Float64Array( 10 );
269
- const y = new Float64Array( 10 );
270
-
271
- gcusumors.ndarray(); // $ExpectError
272
- gcusumors.ndarray( x.length ); // $ExpectError
273
- gcusumors.ndarray( x.length, 0.0 ); // $ExpectError
274
- gcusumors.ndarray( x.length, 0.0, x ); // $ExpectError
275
- gcusumors.ndarray( x.length, 0.0, x, 1 ); // $ExpectError
276
- gcusumors.ndarray( x.length, 0.0, x, 1, 0 ); // $ExpectError
277
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y ); // $ExpectError
278
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1 ); // $ExpectError
279
- gcusumors.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0, 10 ); // $ExpectError
280
- }