@stdlib/blas-ext-base-gfill-by 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 +1 -1
- package/README.md +20 -6
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +10 -10
- package/lib/accessors.js +4 -6
- package/lib/main.js +1 -1
- package/lib/ndarray.js +1 -1
- package/package.json +19 -18
- package/docs/repl.txt +0 -118
- package/docs/types/test.ts +0 -185
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
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
|
# gfillBy
|
|
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] -->
|
|
@@ -172,7 +183,7 @@ gfillBy.ndarray( 3, x, 1, x.length-3, fill );
|
|
|
172
183
|
## Notes
|
|
173
184
|
|
|
174
185
|
- If `N <= 0`, both functions return `x` unchanged.
|
|
175
|
-
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array
|
|
186
|
+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array-complex64`][@stdlib/array/complex64]).
|
|
176
187
|
- When filling a strided array with a scalar constant, prefer using [`dfill`][@stdlib/blas/ext/base/dfill], [`sfill`][@stdlib/blas/ext/base/sfill], and/or [`gfill`][@stdlib/blas/ext/base/gfill], as, depending on the environment, these interfaces are likely to be significantly more performant.
|
|
177
188
|
|
|
178
189
|
</section>
|
|
@@ -221,7 +232,7 @@ console.log( x );
|
|
|
221
232
|
|
|
222
233
|
## See Also
|
|
223
234
|
|
|
224
|
-
- <span class="package-name">[`@stdlib/blas
|
|
235
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/gfill`][@stdlib/blas/ext/base/gfill]</span><span class="delimiter">: </span><span class="description">fill a strided array with a specified scalar constant.</span>
|
|
225
236
|
|
|
226
237
|
</section>
|
|
227
238
|
|
|
@@ -253,7 +264,7 @@ See [LICENSE][stdlib-license].
|
|
|
253
264
|
|
|
254
265
|
## Copyright
|
|
255
266
|
|
|
256
|
-
Copyright © 2016-
|
|
267
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
257
268
|
|
|
258
269
|
</section>
|
|
259
270
|
|
|
@@ -266,8 +277,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
266
277
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-gfill-by.svg
|
|
267
278
|
[npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-gfill-by
|
|
268
279
|
|
|
269
|
-
[test-image]: https://github.com/stdlib-js/blas-ext-base-gfill-by/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
270
|
-
[test-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/actions/workflows/test.yml?query=branch:v0.0
|
|
280
|
+
[test-image]: https://github.com/stdlib-js/blas-ext-base-gfill-by/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
281
|
+
[test-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/actions/workflows/test.yml?query=branch:v0.2.0
|
|
271
282
|
|
|
272
283
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-gfill-by/main.svg
|
|
273
284
|
[coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-gfill-by?branch=main
|
|
@@ -280,7 +291,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
280
291
|
-->
|
|
281
292
|
|
|
282
293
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
283
|
-
[chat-url]: https://gitter.im
|
|
294
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
284
295
|
|
|
285
296
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
286
297
|
|
|
@@ -290,8 +301,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
290
301
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
291
302
|
|
|
292
303
|
[deno-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/tree/deno
|
|
304
|
+
[deno-readme]: https://github.com/stdlib-js/blas-ext-base-gfill-by/blob/deno/README.md
|
|
293
305
|
[umd-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/tree/umd
|
|
306
|
+
[umd-readme]: https://github.com/stdlib-js/blas-ext-base-gfill-by/blob/umd/README.md
|
|
294
307
|
[esm-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/tree/esm
|
|
308
|
+
[esm-readme]: https://github.com/stdlib-js/blas-ext-base-gfill-by/blob/esm/README.md
|
|
295
309
|
[branches-url]: https://github.com/stdlib-js/blas-ext-base-gfill-by/blob/main/branches.md
|
|
296
310
|
|
|
297
311
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-gfill-by/main/LICENSE
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";var l=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=l(function(D,y){
|
|
2
|
+
function j(e,r,t,c,s,i){var a,o,u,v,n;for(a=r.data,u=r.accessors[0],o=r.accessors[1],v=c,n=0;n<e;n++)o(a,v,s.call(i,u(a,v),n,v,r)),v+=t;return r}y.exports=j
|
|
3
|
+
});var p=l(function(E,q){
|
|
4
|
+
var P=require('@stdlib/array-base-arraylike2object/dist'),b=f();function m(e,r,t,c,s){var i,a,o;if(e<=0)return r;if(t<0?i=(1-e)*t:i=0,a=P(r),a.accessorProtocol)return b(e,a,t,i,c,s),a.data;for(o=0;o<e;o++)r[i]=c.call(s,r[i],o,i,r),i+=t;return r}q.exports=m
|
|
5
|
+
});var d=l(function(F,B){
|
|
6
|
+
var O=require('@stdlib/array-base-arraylike2object/dist'),R=f();function k(e,r,t,c,s,i){var a,o,u;if(e<=0)return r;if(o=O(r),o.accessorProtocol)return R(e,o,t,c,s,i),o.data;for(a=c,u=0;u<e;u++)r[a]=s.call(i,r[a],u,a,r),a+=t;return r}B.exports=k
|
|
7
|
+
});var w=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),g=p(),z=d();w(g,"ndarray",z);module.exports=g;
|
|
8
|
+
/** @license Apache-2.0 */
|
|
9
|
+
/** @license Apache-2.0 */
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/accessors.js", "../lib/main.js", "../lib/ndarray.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Fills a strided array according to a provided callback function.\n*\n* @private\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Object} x - input array object\n* @param {Collection} x.data - input array data\n* @param {Array<Function>} x.accessors - array element accessors\n* @param {integer} stride - index increment\n* @param {NonNegativeInteger} offset - starting index\n* @param {Callback} clbk - callback\n* @param {*} thisArg - execution context\n* @returns {Object} input array object\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32' );\n* var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n*\n* function setter( data, idx, value ) {\n* data.set( value, idx );\n* }\n*\n* function getter( data, idx ) {\n* return data.get( idx );\n* }\n*\n* var data = new Complex64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] );\n*\n* var x = {\n* 'data': data,\n* 'accessors': [ getter, setter ]\n* };\n*\n* function clbk() {\n* return new Complex64( 5.0, 5.0 );\n* }\n*\n* gfillBy( data.length, x, 1, 0, clbk, void 0 );\n*\n* var view = reinterpret64( x.data, 0 );\n* // view => <Float32Array>[ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]\n*/\nfunction gfillBy( N, x, stride, offset, clbk, thisArg ) {\n\tvar xbuf;\n\tvar set;\n\tvar get;\n\tvar ix;\n\tvar i;\n\n\t// Cache reference to array data:\n\txbuf = x.data;\n\n\t// Cache a reference to the element accessors:\n\tget = x.accessors[ 0 ];\n\tset = x.accessors[ 1 ];\n\n\tix = offset;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tset( xbuf, ix, clbk.call( thisArg, get( xbuf, ix ), i, ix, x ) );\n\t\tix += stride;\n\t}\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gfillBy;\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 arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar accessors = require( './accessors.js' );\n\n\n// MAIN //\n\n/**\n* Fills a strided array according to a provided callback function.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} stride - index increment\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - execution context\n* @returns {Collection} input array\n*\n* @example\n* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];\n*\n* function fill() {\n* return 5.0;\n* }\n*\n* gfillBy( x.length, x, 1, fill );\n* // x => [ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]\n*/\nfunction gfillBy( N, x, stride, clbk, thisArg ) {\n\tvar ix;\n\tvar o;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn x;\n\t}\n\tif ( stride < 0 ) {\n\t\tix = (1-N) * stride;\n\t} else {\n\t\tix = 0;\n\t}\n\to = arraylike2object( x );\n\tif ( o.accessorProtocol ) {\n\t\taccessors( N, o, stride, ix, clbk, thisArg );\n\t\treturn o.data;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tx[ ix ] = clbk.call( thisArg, x[ ix ], i, ix, x );\n\t\tix += stride;\n\t}\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gfillBy;\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 arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar accessors = require( './accessors.js' );\n\n\n// MAIN //\n\n/**\n* Fills a strided array according to a provided callback function.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} stride - index increment\n* @param {NonNegativeInteger} offset - starting index\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - execution context\n* @returns {Collection} input array\n*\n* @example\n* var x = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ];\n*\n* function fill() {\n* return 5.0;\n* }\n*\n* gfillBy( 3, x, 1, x.length-3, fill );\n* // x => [ 1.0, -2.0, 3.0, 5.0, 5.0, 5.0 ]\n*/\nfunction gfillBy( N, x, stride, offset, clbk, thisArg ) {\n\tvar ix;\n\tvar o;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn x;\n\t}\n\to = arraylike2object( x );\n\tif ( o.accessorProtocol ) {\n\t\taccessors( N, o, stride, offset, clbk, thisArg );\n\t\treturn o.data;\n\t}\n\tix = offset;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tx[ ix ] = clbk.call( thisArg, x[ ix ], i, ix, x );\n\t\tix += stride;\n\t}\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gfillBy;\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* Fill a strided array according to a provided callback function.\n*\n* @module @stdlib/blas-ext-base-gfill-by\n*\n* @example\n* var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' );\n*\n* function fill() {\n* return 5.0;\n* }\n*\n* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];\n*\n* gfillBy( x.length, x, 1, fill );\n* // x => [ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]\n*\n* @example\n* var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' );\n*\n* function fill() {\n* return 5.0;\n* }\n*\n* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];\n*\n* gfillBy.ndarray( x.length, x, 1, 0, fill );\n* // x => [ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 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": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAiEA,SAASC,EAASC,EAAGC,EAAGC,EAAQC,EAAQC,EAAMC,EAAU,CACvD,IAAIC,EACAC,EACAC,EACAC,EACAC,EAUJ,IAPAJ,EAAOL,EAAE,KAGTO,EAAMP,EAAE,UAAW,CAAE,EACrBM,EAAMN,EAAE,UAAW,CAAE,EAErBQ,EAAKN,EACCO,EAAI,EAAGA,EAAIV,EAAGU,IACnBH,EAAKD,EAAMG,EAAIL,EAAK,KAAMC,EAASG,EAAKF,EAAMG,CAAG,EAAGC,EAAGD,EAAIR,CAAE,CAAE,EAC/DQ,GAAMP,EAEP,OAAOD,CACR,CAKAH,EAAO,QAAUC,IC1FjB,IAAAY,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,qCAAsC,EAClEC,EAAY,IAyBhB,SAASC,EAASC,EAAGC,EAAGC,EAAQC,EAAMC,EAAU,CAC/C,IAAIC,EACAC,EACAC,EAEJ,GAAKP,GAAK,EACT,OAAOC,EAQR,GANKC,EAAS,EACbG,GAAM,EAAEL,GAAKE,EAEbG,EAAK,EAENC,EAAIT,EAAkBI,CAAE,EACnBK,EAAE,iBACN,OAAAR,EAAWE,EAAGM,EAAGJ,EAAQG,EAAIF,EAAMC,CAAQ,EACpCE,EAAE,KAEV,IAAMC,EAAI,EAAGA,EAAIP,EAAGO,IACnBN,EAAGI,CAAG,EAAIF,EAAK,KAAMC,EAASH,EAAGI,CAAG,EAAGE,EAAGF,EAAIJ,CAAE,EAChDI,GAAMH,EAEP,OAAOD,CACR,CAKAL,EAAO,QAAUG,IC5EjB,IAAAS,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,qCAAsC,EAClEC,EAAY,IA0BhB,SAASC,EAASC,EAAGC,EAAGC,EAAQC,EAAQC,EAAMC,EAAU,CACvD,IAAIC,EACA,EACAC,EAEJ,GAAKP,GAAK,EACT,OAAOC,EAGR,GADA,EAAIJ,EAAkBI,CAAE,EACnB,EAAE,iBACN,OAAAH,EAAWE,EAAG,EAAGE,EAAQC,EAAQC,EAAMC,CAAQ,EACxC,EAAE,KAGV,IADAC,EAAKH,EACCI,EAAI,EAAGA,EAAIP,EAAGO,IACnBN,EAAGK,CAAG,EAAIF,EAAK,KAAMC,EAASJ,EAAGK,CAAG,EAAGC,EAAGD,EAAIL,CAAE,EAChDK,GAAMJ,EAEP,OAAOD,CACR,CAKAL,EAAO,QAAUG,ICrBjB,IAAIS,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
|
|
6
|
+
"names": ["require_accessors", "__commonJSMin", "exports", "module", "gfillBy", "N", "x", "stride", "offset", "clbk", "thisArg", "xbuf", "set", "get", "ix", "i", "require_main", "__commonJSMin", "exports", "module", "arraylike2object", "accessors", "gfillBy", "N", "x", "stride", "clbk", "thisArg", "ix", "o", "i", "require_ndarray", "__commonJSMin", "exports", "module", "arraylike2object", "accessors", "gfillBy", "N", "x", "stride", "offset", "clbk", "thisArg", "ix", "i", "setReadOnly", "main", "ndarray"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
// TypeScript Version:
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { Collection } from '@stdlib/types/
|
|
23
|
+
import { Collection } from '@stdlib/types/array';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Returns a fill value.
|
|
27
27
|
*
|
|
28
28
|
* @returns fill value
|
|
29
29
|
*/
|
|
30
|
-
type Nullary = () =>
|
|
30
|
+
type Nullary<U, W> = ( this: W ) => U;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Returns a fill value.
|
|
@@ -35,7 +35,7 @@ type Nullary = () => any;
|
|
|
35
35
|
* @param value - array element
|
|
36
36
|
* @returns fill value
|
|
37
37
|
*/
|
|
38
|
-
type Unary = ( value:
|
|
38
|
+
type Unary<T, U, W> = ( this: W, value: T ) => U;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Returns a fill value.
|
|
@@ -44,7 +44,7 @@ type Unary = ( value: any ) => any;
|
|
|
44
44
|
* @param aidx - array index
|
|
45
45
|
* @returns fill value
|
|
46
46
|
*/
|
|
47
|
-
type Binary = ( value:
|
|
47
|
+
type Binary<T, U, W> = ( this: W, value: T, aidx: number ) => U;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Returns a fill value.
|
|
@@ -54,7 +54,7 @@ type Binary = ( value: any, aidx: number ) => any;
|
|
|
54
54
|
* @param sidx - strided index (offset + aidx*stride)
|
|
55
55
|
* @returns fill value
|
|
56
56
|
*/
|
|
57
|
-
type Ternary = ( value:
|
|
57
|
+
type Ternary<T, U, W> = ( this: W, value: T, aidx: number, sidx: number ) => U;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Returns a fill value.
|
|
@@ -65,7 +65,7 @@ type Ternary = ( value: any, aidx: number, sidx: number ) => any;
|
|
|
65
65
|
* @param array - input array
|
|
66
66
|
* @returns fill value
|
|
67
67
|
*/
|
|
68
|
-
type Quaternary = ( value:
|
|
68
|
+
type Quaternary<T, U, V, W> = ( this: W, value: T, aidx: number, sidx: number, array: Collection<V> ) => U;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Returns a fill value.
|
|
@@ -76,7 +76,7 @@ type Quaternary = ( value: any, aidx: number, sidx: number, array: Collection )
|
|
|
76
76
|
* @param array - input array
|
|
77
77
|
* @returns fill value
|
|
78
78
|
*/
|
|
79
|
-
type Callback = Nullary | Unary | Binary | Ternary | Quaternary
|
|
79
|
+
type Callback<T, U, V, W> = Nullary<U, W> | Unary<T, U, W> | Binary<T, U, W> | Ternary<T, U, W> | Quaternary<T, U, V, W>;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Interface describing `gfillBy`.
|
|
@@ -113,7 +113,7 @@ interface Routine {
|
|
|
113
113
|
* gfillBy( x.length, x, 1, fill );
|
|
114
114
|
* // x => [ 5.0, 5.0, 5.0, 0.0, 5.0, 5.0, 5.0, 5.0 ]
|
|
115
115
|
*/
|
|
116
|
-
( N: number, x: Collection
|
|
116
|
+
<T = unknown, U = unknown, V = unknown, W = unknown>( N: number, x: Collection<V>, stride: number, clbk: Callback<T, U, V, W>, thisArg?: ThisParameterType<Callback<T, U, V, W>> ): Collection<U | V>;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* Fills a strided array according to a provided callback function and using alternative indexing semantics.
|
|
@@ -147,7 +147,7 @@ interface Routine {
|
|
|
147
147
|
* gfillBy.ndarray( x.length, x, 1, 0, fill );
|
|
148
148
|
* // x => [ 5.0, 5.0, 5.0, 0.0, 5.0, 5.0, 5.0, 5.0 ]
|
|
149
149
|
*/
|
|
150
|
-
ndarray( N: number, x: Collection
|
|
150
|
+
ndarray<T = unknown, U = unknown, V = unknown, W = unknown>( N: number, x: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, V, W>, thisArg?: ThisParameterType<Callback<T, U, V, W>> ): Collection<U | V>;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
package/lib/accessors.js
CHANGED
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
* @param {PositiveInteger} N - number of indexed elements
|
|
28
28
|
* @param {Object} x - input array object
|
|
29
29
|
* @param {Collection} x.data - input array data
|
|
30
|
-
* @param {Function} x.
|
|
31
|
-
* @param {Function} x.get - getter
|
|
30
|
+
* @param {Array<Function>} x.accessors - array element accessors
|
|
32
31
|
* @param {integer} stride - index increment
|
|
33
32
|
* @param {NonNegativeInteger} offset - starting index
|
|
34
33
|
* @param {Callback} clbk - callback
|
|
@@ -52,8 +51,7 @@
|
|
|
52
51
|
*
|
|
53
52
|
* var x = {
|
|
54
53
|
* 'data': data,
|
|
55
|
-
* '
|
|
56
|
-
* 'getter': getter
|
|
54
|
+
* 'accessors': [ getter, setter ]
|
|
57
55
|
* };
|
|
58
56
|
*
|
|
59
57
|
* function clbk() {
|
|
@@ -76,8 +74,8 @@ function gfillBy( N, x, stride, offset, clbk, thisArg ) {
|
|
|
76
74
|
xbuf = x.data;
|
|
77
75
|
|
|
78
76
|
// Cache a reference to the element accessors:
|
|
79
|
-
get = x.
|
|
80
|
-
set = x.
|
|
77
|
+
get = x.accessors[ 0 ];
|
|
78
|
+
set = x.accessors[ 1 ];
|
|
81
79
|
|
|
82
80
|
ix = offset;
|
|
83
81
|
for ( i = 0; i < N; i++ ) {
|
package/lib/main.js
CHANGED
package/lib/ndarray.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-ext-base-gfill-by",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Fill a strided array according to a provided callback function.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,25 +37,26 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-base-arraylike2object": "^0.0
|
|
41
|
-
"@stdlib/types": "^0.
|
|
42
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0
|
|
40
|
+
"@stdlib/array-base-arraylike2object": "^0.2.0",
|
|
41
|
+
"@stdlib/types": "^0.3.1",
|
|
42
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@stdlib/array-base-filled-by": "^0.0
|
|
46
|
-
"@stdlib/array-complex128": "^0.0
|
|
47
|
-
"@stdlib/array-float64": "^0.0
|
|
48
|
-
"@stdlib/
|
|
49
|
-
"@stdlib/
|
|
50
|
-
"@stdlib/math-base-
|
|
51
|
-
"@stdlib/math-base-special-
|
|
52
|
-
"@stdlib/
|
|
53
|
-
"@stdlib/random-base-
|
|
54
|
-
"@stdlib/
|
|
55
|
-
"@stdlib/strided-base-reinterpret-complex128": "^0.0.x",
|
|
45
|
+
"@stdlib/array-base-filled-by": "^0.1.0",
|
|
46
|
+
"@stdlib/array-complex128": "^0.1.0",
|
|
47
|
+
"@stdlib/array-float64": "^0.2.0",
|
|
48
|
+
"@stdlib/complex-float64": "^0.2.0",
|
|
49
|
+
"@stdlib/math-base-assert-is-nan": "^0.2.0",
|
|
50
|
+
"@stdlib/math-base-special-pow": "^0.2.0",
|
|
51
|
+
"@stdlib/math-base-special-round": "^0.2.0",
|
|
52
|
+
"@stdlib/random-base-randu": "^0.1.0",
|
|
53
|
+
"@stdlib/random-base-uniform": "^0.1.0",
|
|
54
|
+
"@stdlib/strided-base-reinterpret-complex128": "^0.2.0",
|
|
56
55
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
57
56
|
"istanbul": "^0.4.1",
|
|
58
|
-
"tap-
|
|
57
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
58
|
+
"@stdlib/bench-harness": "^0.2.0",
|
|
59
|
+
"@stdlib/bench": "^0.3.1"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=0.10.0",
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
],
|
|
93
94
|
"__stdlib__": {},
|
|
94
95
|
"funding": {
|
|
95
|
-
"type": "
|
|
96
|
-
"url": "https://
|
|
96
|
+
"type": "opencollective",
|
|
97
|
+
"url": "https://opencollective.com/stdlib"
|
|
97
98
|
}
|
|
98
99
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( N, x, stride, clbk[, thisArg] )
|
|
3
|
-
Fills a strided array according to a provided callback function.
|
|
4
|
-
|
|
5
|
-
The `N` and `stride` parameters determine which elements in `x` are accessed
|
|
6
|
-
at runtime.
|
|
7
|
-
|
|
8
|
-
Indexing is relative to the first index. To introduce an offset, use typed
|
|
9
|
-
array views.
|
|
10
|
-
|
|
11
|
-
If `N <= 0`, the function returns `x` unchanged.
|
|
12
|
-
|
|
13
|
-
The callback function is provided four arguments:
|
|
14
|
-
|
|
15
|
-
- value: array element
|
|
16
|
-
- aidx: array index
|
|
17
|
-
- sidx: strided index (offset + aidx*stride)
|
|
18
|
-
- array: the input array
|
|
19
|
-
|
|
20
|
-
The callback return value is used as the fill value for the current array
|
|
21
|
-
index.
|
|
22
|
-
|
|
23
|
-
Parameters
|
|
24
|
-
----------
|
|
25
|
-
N: integer
|
|
26
|
-
Number of indexed elements.
|
|
27
|
-
|
|
28
|
-
x: ArrayLikeObject
|
|
29
|
-
Input array.
|
|
30
|
-
|
|
31
|
-
stride: integer
|
|
32
|
-
Index increment for `x`.
|
|
33
|
-
|
|
34
|
-
clbk: Function
|
|
35
|
-
Callback function.
|
|
36
|
-
|
|
37
|
-
thisArg: any (optional)
|
|
38
|
-
Execution context.
|
|
39
|
-
|
|
40
|
-
Returns
|
|
41
|
-
-------
|
|
42
|
-
x: ArrayLikeObject
|
|
43
|
-
Input array `x`.
|
|
44
|
-
|
|
45
|
-
Examples
|
|
46
|
-
--------
|
|
47
|
-
// Standard Usage:
|
|
48
|
-
> function fill() { return 5.0; };
|
|
49
|
-
> var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
|
|
50
|
-
> {{alias}}( x.length, x, 1, fill )
|
|
51
|
-
[ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]
|
|
52
|
-
|
|
53
|
-
// Using `N` and `stride` parameters:
|
|
54
|
-
> x = [ -2.0, 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
|
|
55
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
56
|
-
> {{alias}}( N, x, 2, fill )
|
|
57
|
-
[ 5.0, 1.0, 5.0, -5.0, 5.0, -1.0, -3.0 ]
|
|
58
|
-
|
|
59
|
-
// Using view offsets:
|
|
60
|
-
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
|
|
61
|
-
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
|
62
|
-
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
|
|
63
|
-
> {{alias}}( N, x1, 2, fill )
|
|
64
|
-
<Float64Array>[ 5.0, 3.0, 5.0, 5.0, 5.0 ]
|
|
65
|
-
> x0
|
|
66
|
-
<Float64Array>[ 1.0, 5.0, 3.0, 5.0, 5.0, 5.0 ]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{{alias}}.ndarray( N, x, stride, offset, clbk[, thisArg] )
|
|
70
|
-
Fills a strided array according to a provided callback function and using
|
|
71
|
-
alternative indexing semantics.
|
|
72
|
-
|
|
73
|
-
While typed array views mandate a view offset based on the underlying
|
|
74
|
-
buffer, the `offset` parameter supports indexing semantics based on a
|
|
75
|
-
starting index.
|
|
76
|
-
|
|
77
|
-
Parameters
|
|
78
|
-
----------
|
|
79
|
-
N: integer
|
|
80
|
-
Number of indexed elements.
|
|
81
|
-
|
|
82
|
-
x: ArrayLikeObject
|
|
83
|
-
Input array.
|
|
84
|
-
|
|
85
|
-
stride: integer
|
|
86
|
-
Index increment for `x`.
|
|
87
|
-
|
|
88
|
-
offset: integer
|
|
89
|
-
Starting index of `x`.
|
|
90
|
-
|
|
91
|
-
clbk: Function
|
|
92
|
-
Callback function.
|
|
93
|
-
|
|
94
|
-
thisArg: any (optional)
|
|
95
|
-
Execution context.
|
|
96
|
-
|
|
97
|
-
Returns
|
|
98
|
-
-------
|
|
99
|
-
x: ArrayLikeObject
|
|
100
|
-
Input array `x`.
|
|
101
|
-
|
|
102
|
-
Examples
|
|
103
|
-
--------
|
|
104
|
-
// Standard Usage:
|
|
105
|
-
> function fill() { return 5.0; };
|
|
106
|
-
> var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
|
|
107
|
-
> {{alias}}.ndarray( x.length, x, 1, 0, fill )
|
|
108
|
-
[ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]
|
|
109
|
-
|
|
110
|
-
// Using an index offset:
|
|
111
|
-
> x = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ];
|
|
112
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
113
|
-
> {{alias}}.ndarray( N, x, 2, 1, fill )
|
|
114
|
-
[ 1.0, 5.0, 3.0, 5.0, 5.0, 5.0 ]
|
|
115
|
-
|
|
116
|
-
See Also
|
|
117
|
-
--------
|
|
118
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,185 +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 gfillBy = require( './index' );
|
|
20
|
-
|
|
21
|
-
const fill = (): number => {
|
|
22
|
-
return 5.0;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// TESTS //
|
|
27
|
-
|
|
28
|
-
// The function returns a collection...
|
|
29
|
-
{
|
|
30
|
-
const x = new Float64Array( 10 );
|
|
31
|
-
|
|
32
|
-
gfillBy( x.length, x, 1, fill ); // $ExpectType Collection
|
|
33
|
-
gfillBy( x.length, x, 1, fill, {} ); // $ExpectType Collection
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// The compiler throws an error if the function is provided a first argument which is not a number...
|
|
37
|
-
{
|
|
38
|
-
const x = new Float64Array( 10 );
|
|
39
|
-
|
|
40
|
-
gfillBy( '10', x, 1, fill ); // $ExpectError
|
|
41
|
-
gfillBy( true, x, 1, fill ); // $ExpectError
|
|
42
|
-
gfillBy( false, x, 1, fill ); // $ExpectError
|
|
43
|
-
gfillBy( null, x, 1, fill ); // $ExpectError
|
|
44
|
-
gfillBy( undefined, x, 1, fill ); // $ExpectError
|
|
45
|
-
gfillBy( [], x, 1, fill ); // $ExpectError
|
|
46
|
-
gfillBy( {}, x, 1, fill ); // $ExpectError
|
|
47
|
-
gfillBy( ( x: number ): number => x, x, 1, fill ); // $ExpectError
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// The compiler throws an error if the function is provided a second argument which is not a collection...
|
|
51
|
-
{
|
|
52
|
-
const x = new Float64Array( 10 );
|
|
53
|
-
|
|
54
|
-
gfillBy( x.length, 10, 1, fill ); // $ExpectError
|
|
55
|
-
gfillBy( x.length, true, 1, fill ); // $ExpectError
|
|
56
|
-
gfillBy( x.length, false, 1, fill ); // $ExpectError
|
|
57
|
-
gfillBy( x.length, null, 1, fill ); // $ExpectError
|
|
58
|
-
gfillBy( x.length, undefined, 1, fill ); // $ExpectError
|
|
59
|
-
gfillBy( x.length, {}, 1, fill ); // $ExpectError
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// The compiler throws an error if the function is provided a third argument which is not a number...
|
|
63
|
-
{
|
|
64
|
-
const x = new Float64Array( 10 );
|
|
65
|
-
|
|
66
|
-
gfillBy( x.length, x, '10', fill ); // $ExpectError
|
|
67
|
-
gfillBy( x.length, x, true, fill ); // $ExpectError
|
|
68
|
-
gfillBy( x.length, x, false, fill ); // $ExpectError
|
|
69
|
-
gfillBy( x.length, x, null, fill ); // $ExpectError
|
|
70
|
-
gfillBy( x.length, x, undefined, fill ); // $ExpectError
|
|
71
|
-
gfillBy( x.length, x, [], fill ); // $ExpectError
|
|
72
|
-
gfillBy( x.length, x, {}, fill ); // $ExpectError
|
|
73
|
-
gfillBy( x.length, x, ( x: number, fill ): number => x, fill ); // $ExpectError
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// The compiler throws an error if the function is provided a fourth argument which is not a function...
|
|
77
|
-
{
|
|
78
|
-
const x = new Float64Array( 10 );
|
|
79
|
-
|
|
80
|
-
gfillBy( x.length, x, 1, '10' ); // $ExpectError
|
|
81
|
-
gfillBy( x.length, x, 1, true ); // $ExpectError
|
|
82
|
-
gfillBy( x.length, x, 1, false ); // $ExpectError
|
|
83
|
-
gfillBy( x.length, x, 1, null ); // $ExpectError
|
|
84
|
-
gfillBy( x.length, x, 1, undefined ); // $ExpectError
|
|
85
|
-
gfillBy( x.length, x, 1, [] ); // $ExpectError
|
|
86
|
-
gfillBy( x.length, x, 1, {} ); // $ExpectError
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
90
|
-
{
|
|
91
|
-
const x = new Float64Array( 10 );
|
|
92
|
-
|
|
93
|
-
gfillBy(); // $ExpectError
|
|
94
|
-
gfillBy( x.length ); // $ExpectError
|
|
95
|
-
gfillBy( x.length, x ); // $ExpectError
|
|
96
|
-
gfillBy( x.length, x, 1 ); // $ExpectError
|
|
97
|
-
gfillBy( x.length, x, 1, fill, {}, 10 ); // $ExpectError
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Attached to main export is an `ndarray` method which returns a collection...
|
|
101
|
-
{
|
|
102
|
-
const x = new Float64Array( 10 );
|
|
103
|
-
|
|
104
|
-
gfillBy.ndarray( x.length, x, 1, 0, fill ); // $ExpectType Collection
|
|
105
|
-
gfillBy.ndarray( x.length, x, 1, 0, fill, {} ); // $ExpectType Collection
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
|
|
109
|
-
{
|
|
110
|
-
const x = new Float64Array( 10 );
|
|
111
|
-
|
|
112
|
-
gfillBy.ndarray( '10', x, 1, 0, fill ); // $ExpectError
|
|
113
|
-
gfillBy.ndarray( true, x, 1, 0, fill ); // $ExpectError
|
|
114
|
-
gfillBy.ndarray( false, x, 1, 0, fill ); // $ExpectError
|
|
115
|
-
gfillBy.ndarray( null, x, 1, 0, fill ); // $ExpectError
|
|
116
|
-
gfillBy.ndarray( undefined, x, 1, 0, fill ); // $ExpectError
|
|
117
|
-
gfillBy.ndarray( [], x, 1, 0, fill ); // $ExpectError
|
|
118
|
-
gfillBy.ndarray( {}, x, 1, 0, fill ); // $ExpectError
|
|
119
|
-
gfillBy.ndarray( ( x: number ): number => x, x, 1, 0, fill ); // $ExpectError
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// The compiler throws an error if the `ndarray` method is provided a second argument which is not a collection...
|
|
123
|
-
{
|
|
124
|
-
const x = new Float64Array( 10 );
|
|
125
|
-
|
|
126
|
-
gfillBy.ndarray( x.length, 10, 1, 0, fill ); // $ExpectError
|
|
127
|
-
gfillBy.ndarray( x.length, true, 1, 0, fill ); // $ExpectError
|
|
128
|
-
gfillBy.ndarray( x.length, false, 1, 0, fill ); // $ExpectError
|
|
129
|
-
gfillBy.ndarray( x.length, null, 1, 0, fill ); // $ExpectError
|
|
130
|
-
gfillBy.ndarray( x.length, undefined, 1, 0, fill ); // $ExpectError
|
|
131
|
-
gfillBy.ndarray( x.length, {}, 1, 0, fill ); // $ExpectError
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
|
|
135
|
-
{
|
|
136
|
-
const x = new Float64Array( 10 );
|
|
137
|
-
|
|
138
|
-
gfillBy.ndarray( x.length, x, '10', 0, fill ); // $ExpectError
|
|
139
|
-
gfillBy.ndarray( x.length, x, true, 0, fill ); // $ExpectError
|
|
140
|
-
gfillBy.ndarray( x.length, x, false, 0, fill ); // $ExpectError
|
|
141
|
-
gfillBy.ndarray( x.length, x, null, 0, fill ); // $ExpectError
|
|
142
|
-
gfillBy.ndarray( x.length, x, undefined, 0, fill ); // $ExpectError
|
|
143
|
-
gfillBy.ndarray( x.length, x, [], 0, fill ); // $ExpectError
|
|
144
|
-
gfillBy.ndarray( x.length, x, {}, 0, fill ); // $ExpectError
|
|
145
|
-
gfillBy.ndarray( x.length, x, ( x: number ): number => x, 0, fill ); // $ExpectError
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
|
|
149
|
-
{
|
|
150
|
-
const x = new Float64Array( 10 );
|
|
151
|
-
|
|
152
|
-
gfillBy.ndarray( x.length, x, 1, '10', fill ); // $ExpectError
|
|
153
|
-
gfillBy.ndarray( x.length, x, 1, true, fill ); // $ExpectError
|
|
154
|
-
gfillBy.ndarray( x.length, x, 1, false, fill ); // $ExpectError
|
|
155
|
-
gfillBy.ndarray( x.length, x, 1, null, fill ); // $ExpectError
|
|
156
|
-
gfillBy.ndarray( x.length, x, 1, undefined, fill ); // $ExpectError
|
|
157
|
-
gfillBy.ndarray( x.length, x, 1, [], fill ); // $ExpectError
|
|
158
|
-
gfillBy.ndarray( x.length, x, 1, {}, fill ); // $ExpectError
|
|
159
|
-
gfillBy.ndarray( x.length, x, 1, ( x: number ): number => x, fill ); // $ExpectError
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a function...
|
|
163
|
-
{
|
|
164
|
-
const x = new Float64Array( 10 );
|
|
165
|
-
|
|
166
|
-
gfillBy.ndarray( x.length, x, 1, 0, '10' ); // $ExpectError
|
|
167
|
-
gfillBy.ndarray( x.length, x, 1, 0, true ); // $ExpectError
|
|
168
|
-
gfillBy.ndarray( x.length, x, 1, 0, false ); // $ExpectError
|
|
169
|
-
gfillBy.ndarray( x.length, x, 1, 0, null ); // $ExpectError
|
|
170
|
-
gfillBy.ndarray( x.length, x, 1, 0, undefined ); // $ExpectError
|
|
171
|
-
gfillBy.ndarray( x.length, x, 1, 0, [] ); // $ExpectError
|
|
172
|
-
gfillBy.ndarray( x.length, x, 1, 0, {} ); // $ExpectError
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
|
|
176
|
-
{
|
|
177
|
-
const x = new Float64Array( 10 );
|
|
178
|
-
|
|
179
|
-
gfillBy.ndarray(); // $ExpectError
|
|
180
|
-
gfillBy.ndarray( x.length ); // $ExpectError
|
|
181
|
-
gfillBy.ndarray( x.length, x ); // $ExpectError
|
|
182
|
-
gfillBy.ndarray( x.length, x, 1 ); // $ExpectError
|
|
183
|
-
gfillBy.ndarray( x.length, x, 1, 0 ); // $ExpectError
|
|
184
|
-
gfillBy.ndarray( x.length, x, 1, 0, fill, {}, 10 ); // $ExpectError
|
|
185
|
-
}
|