@stdlib/math-strided-special-abs-by 0.0.7 → 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 +30 -0
- package/NOTICE +1 -1
- package/README.md +22 -14
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +12 -15
- package/package.json +16 -16
- package/docs/repl.txt +0 -142
- package/docs/types/test.ts +0 -279
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-
|
|
1
|
+
Copyright (c) 2016-2023 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,6 +20,17 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
<!-- lint disable maximum-heading-length -->
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
<details>
|
|
25
|
+
<summary>
|
|
26
|
+
About stdlib...
|
|
27
|
+
</summary>
|
|
28
|
+
<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>
|
|
29
|
+
<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>
|
|
30
|
+
<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>
|
|
31
|
+
<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>
|
|
32
|
+
</details>
|
|
33
|
+
|
|
23
34
|
# absBy
|
|
24
35
|
|
|
25
36
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -210,8 +221,9 @@ absBy.ndarray( 3, x, 2, 1, y, -1, y.length-1, accessor );
|
|
|
210
221
|
<!-- eslint no-undef: "error" -->
|
|
211
222
|
|
|
212
223
|
```javascript
|
|
213
|
-
var
|
|
224
|
+
var uniform = require( '@stdlib/random-base-uniform' ).factory;
|
|
214
225
|
var filledarray = require( '@stdlib/array-filled' );
|
|
226
|
+
var filledarrayBy = require( '@stdlib/array-filled-by' );
|
|
215
227
|
var absBy = require( '@stdlib/math-strided-special-abs-by' );
|
|
216
228
|
|
|
217
229
|
function accessor( v, i ) {
|
|
@@ -222,14 +234,10 @@ function accessor( v, i ) {
|
|
|
222
234
|
return v;
|
|
223
235
|
}
|
|
224
236
|
|
|
225
|
-
var x =
|
|
226
|
-
var y = filledarray( null, 10, 'generic' );
|
|
227
|
-
|
|
228
|
-
var i;
|
|
229
|
-
for ( i = 0; i < x.length; i++ ) {
|
|
230
|
-
x[ i ] = discreteUniform( -100, 100 );
|
|
231
|
-
}
|
|
237
|
+
var x = filledarrayBy( 10, 'generic', uniform( -100.0, 100.0 ) );
|
|
232
238
|
console.log( x );
|
|
239
|
+
|
|
240
|
+
var y = filledarray( null, 10, 'generic' );
|
|
233
241
|
console.log( y );
|
|
234
242
|
|
|
235
243
|
absBy.ndarray( x.length, x, 1, 0, y, -1, y.length-1, accessor );
|
|
@@ -248,8 +256,8 @@ console.log( y );
|
|
|
248
256
|
|
|
249
257
|
## See Also
|
|
250
258
|
|
|
251
|
-
- <span class="package-name">[`@stdlib/math
|
|
252
|
-
- <span class="package-name">[`@stdlib/math
|
|
259
|
+
- <span class="package-name">[`@stdlib/math-strided/special/abs`][@stdlib/math/strided/special/abs]</span><span class="delimiter">: </span><span class="description">compute the absolute value for each element in a strided array.</span>
|
|
260
|
+
- <span class="package-name">[`@stdlib/math-strided/special/abs2-by`][@stdlib/math/strided/special/abs2-by]</span><span class="delimiter">: </span><span class="description">compute the squared absolute value of each element retrieved from an input strided array via a callback function.</span>
|
|
253
261
|
|
|
254
262
|
</section>
|
|
255
263
|
|
|
@@ -281,7 +289,7 @@ See [LICENSE][stdlib-license].
|
|
|
281
289
|
|
|
282
290
|
## Copyright
|
|
283
291
|
|
|
284
|
-
Copyright © 2016-
|
|
292
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
285
293
|
|
|
286
294
|
</section>
|
|
287
295
|
|
|
@@ -294,8 +302,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
294
302
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-strided-special-abs-by.svg
|
|
295
303
|
[npm-url]: https://npmjs.org/package/@stdlib/math-strided-special-abs-by
|
|
296
304
|
|
|
297
|
-
[test-image]: https://github.com/stdlib-js/math-strided-special-abs-by/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
298
|
-
[test-url]: https://github.com/stdlib-js/math-strided-special-abs-by/actions/workflows/test.yml?query=branch:v0.0
|
|
305
|
+
[test-image]: https://github.com/stdlib-js/math-strided-special-abs-by/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
306
|
+
[test-url]: https://github.com/stdlib-js/math-strided-special-abs-by/actions/workflows/test.yml?query=branch:v0.1.0
|
|
299
307
|
|
|
300
308
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-strided-special-abs-by/main.svg
|
|
301
309
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-strided-special-abs-by?branch=main
|
|
@@ -308,7 +316,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
308
316
|
-->
|
|
309
317
|
|
|
310
318
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
311
|
-
[chat-url]: https://gitter.im
|
|
319
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
312
320
|
|
|
313
321
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
314
322
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var q=n(function(h,y){
|
|
2
|
+
var d=require('@stdlib/strided-base-map-by/dist'),B=require('@stdlib/math-base-special-abs/dist');function m(e,r,a,s,t,u,i){return d(e,r,a,s,t,B,u,i)}y.exports=m
|
|
3
|
+
});var c=n(function(j,v){
|
|
4
|
+
var x=require('@stdlib/strided-base-map-by/dist').ndarray,f=require('@stdlib/math-base-special-abs/dist');function l(e,r,a,s,t,u,i,p,b){return x(e,r,a,s,t,u,i,f,p,b)}v.exports=l
|
|
5
|
+
});var O=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),o=q(),R=c();O(o,"ndarray",R);module.exports=o;
|
|
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) 2021 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 mapBy = require( '@stdlib/strided-base-map-by' );\nvar abs = require( '@stdlib/math-base-special-abs' );\n\n\n// MAIN //\n\n/**\n* Computes the absolute value of each element retrieved from a strided input array `x` via a callback function and assigns each result to an element in a strided output array `y`.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Collection} x - input array/collection\n* @param {integer} strideX - `x` stride length\n* @param {Collection} y - destination array/collection\n* @param {integer} strideY - `y` stride length\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} `y`\n*\n* @example\n* function accessor( v ) {\n* return v * 2.0;\n* }\n*\n* var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* absBy( x.length, x, 1, y, 1, accessor );\n*\n* console.log( y );\n* // => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]\n*/\nfunction absBy( N, x, strideX, y, strideY, clbk, thisArg ) {\n\treturn mapBy( N, x, strideX, y, strideY, abs, clbk, thisArg );\n}\n\n\n// EXPORTS //\n\nmodule.exports = absBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 mapBy = require( '@stdlib/strided-base-map-by' ).ndarray;\nvar abs = require( '@stdlib/math-base-special-abs' );\n\n\n// MAIN //\n\n/**\n* Computes the absolute value of each element retrieved from a strided input array `x` via a callback function and assigns each result to an element in a strided output array `y`.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Collection} x - input array/collection\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Collection} y - destination array/collection\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} `y`\n*\n* @example\n* function accessor( v ) {\n* return v * 2.0;\n* }\n*\n* var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* absBy( x.length, x, 1, 0, y, 1, 0, accessor );\n*\n* console.log( y );\n* // => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]\n*/\nfunction absBy( N, x, strideX, offsetX, y, strideY, offsetY, clbk, thisArg ) {\n\treturn mapBy( N, x, strideX, offsetX, y, strideY, offsetY, abs, clbk, thisArg ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = absBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 absolute value of each element retrieved from a strided input array `x` via a callback function and assign each result to an element in a strided output array `y`.\n*\n* @module @stdlib/math-strided-special-abs-by\n*\n* @example\n* var absBy = require( '@stdlib/math-strided-special-abs-by' );\n*\n* function accessor( v ) {\n* return v * 2.0;\n* }\n*\n* var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* absBy( x.length, x, 1, y, 1, accessor );\n*\n* console.log( y );\n* // => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]\n*\n* @example\n* var absBy = require( '@stdlib/math-strided-special-abs-by' );\n*\n* function accessor( v ) {\n* return v * 2.0;\n* }\n*\n* var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* absBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor );\n*\n* console.log( y );\n* // => [ 2.0, 4.0, 6.0, 8.0, 10.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,cAsBA,IAAIC,EAAQ,QAAS,6BAA8B,EAC/CC,EAAM,QAAS,+BAAgC,EA8BnD,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAAGC,EAASC,EAAMC,EAAU,CAC1D,OAAOT,EAAOG,EAAGC,EAAGC,EAASC,EAAGC,EAASN,EAAKO,EAAMC,CAAQ,CAC7D,CAKAV,EAAO,QAAUG,IC5DjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,6BAA8B,EAAE,QACjDC,EAAM,QAAS,+BAAgC,EAgCnD,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASC,EAAMC,EAAU,CAC5E,OAAOX,EAAOG,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASR,EAAKS,EAAMC,CAAQ,CAC/E,CAKAZ,EAAO,QAAUG,ICJjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "mapBy", "abs", "absBy", "N", "x", "strideX", "y", "strideY", "clbk", "thisArg", "require_ndarray", "__commonJSMin", "exports", "module", "mapBy", "abs", "absBy", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "clbk", "thisArg", "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 an accessed value.
|
|
27
27
|
*
|
|
28
28
|
* @returns accessed value
|
|
29
29
|
*/
|
|
30
|
-
type Nullary = () => number | void;
|
|
30
|
+
type Nullary<V> = ( this: V ) => number | void;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Returns an accessed value.
|
|
@@ -35,7 +35,7 @@ type Nullary = () => number | void;
|
|
|
35
35
|
* @param value - array element
|
|
36
36
|
* @returns accessed value
|
|
37
37
|
*/
|
|
38
|
-
type Unary = ( value:
|
|
38
|
+
type Unary<T, V> = ( this: V, value: T ) => number | void;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Returns an accessed value.
|
|
@@ -44,7 +44,7 @@ type Unary = ( value: any ) => number | void;
|
|
|
44
44
|
* @param idx - iteration index
|
|
45
45
|
* @returns accessed value
|
|
46
46
|
*/
|
|
47
|
-
type Binary = ( value:
|
|
47
|
+
type Binary<T, V> = ( this: V, value: T, idx: number ) => number | void;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Returns an accessed value.
|
|
@@ -54,7 +54,7 @@ type Binary = ( value: any, idx: number ) => number | void;
|
|
|
54
54
|
* @param xi - strided index (offsetX + idx*strideX)
|
|
55
55
|
* @returns accessed value
|
|
56
56
|
*/
|
|
57
|
-
type Ternary = ( value:
|
|
57
|
+
type Ternary<T, V> = ( this: V, value: T, idx: number, xi: number ) => number | void;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Returns an accessed value.
|
|
@@ -65,8 +65,7 @@ type Ternary = ( value: any, idx: number, xi: number ) => number | void;
|
|
|
65
65
|
* @param yi - strided index (offsetY + idx*strideY)
|
|
66
66
|
* @returns accessed value
|
|
67
67
|
*/
|
|
68
|
-
type Quaternary = ( value:
|
|
69
|
-
|
|
68
|
+
type Quaternary<T, V> = ( this: V, value: T, idx: number, xi: number, yi: number ) => number | void;
|
|
70
69
|
/**
|
|
71
70
|
* Returns an accessed value.
|
|
72
71
|
*
|
|
@@ -77,8 +76,7 @@ type Quaternary = ( value: any, idx: number, xi: number, yi: number ) => number
|
|
|
77
76
|
* @param x - input array
|
|
78
77
|
* @returns accessed value
|
|
79
78
|
*/
|
|
80
|
-
type Quinary = ( value:
|
|
81
|
-
|
|
79
|
+
type Quinary<T, V> = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection<T> ) => number | void;
|
|
82
80
|
/**
|
|
83
81
|
* Returns an accessed value.
|
|
84
82
|
*
|
|
@@ -90,8 +88,7 @@ type Quinary = ( value: any, idx: number, xi: number, yi: number, x: Collection
|
|
|
90
88
|
* @param y - output array
|
|
91
89
|
* @returns accessed value
|
|
92
90
|
*/
|
|
93
|
-
type Senary = ( value:
|
|
94
|
-
|
|
91
|
+
type Senary<T, U, V> = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection<T>, y: Collection<U> ) => number | void;
|
|
95
92
|
/**
|
|
96
93
|
* Returns an accessed value.
|
|
97
94
|
*
|
|
@@ -103,7 +100,7 @@ type Senary = ( value: any, idx: number, xi: number, yi: number, x: Collection,
|
|
|
103
100
|
* @param y - output array
|
|
104
101
|
* @returns accessed value
|
|
105
102
|
*/
|
|
106
|
-
type Callback = Nullary | Unary | Binary | Ternary | Quaternary | Quinary | Senary
|
|
103
|
+
type Callback<T, U, V> = Nullary<V> | Unary<T, V> | Binary<T, V> | Ternary<T, V> | Quaternary<T, V> | Quinary<T, V> | Senary<T, U, V>;
|
|
107
104
|
|
|
108
105
|
/**
|
|
109
106
|
* Interface describing `absBy`.
|
|
@@ -132,7 +129,7 @@ interface Routine {
|
|
|
132
129
|
* absBy( x.length, x, 1, y, 1, accessor );
|
|
133
130
|
* // y => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]
|
|
134
131
|
*/
|
|
135
|
-
( N: number, x: Collection
|
|
132
|
+
<T = unknown, U = unknown, V = unknown>( N: number, x: Collection<T>, strideX: number, y: Collection<U>, strideY: number, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Collection<U | number>;
|
|
136
133
|
|
|
137
134
|
/**
|
|
138
135
|
* Computes the absolute value of each element retrieved from a strided input array `x` via a callback function and assigns each result to an element in a strided output array `y` using alternative indexing semantics.
|
|
@@ -159,7 +156,7 @@ interface Routine {
|
|
|
159
156
|
* absBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor );
|
|
160
157
|
* // y => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]
|
|
161
158
|
*/
|
|
162
|
-
ndarray( N: number, x: Collection
|
|
159
|
+
ndarray<T = unknown, U = unknown, V = unknown>( N: number, x: Collection<T>, strideX: number, offsetX: number, y: Collection<U>, strideY: number, offsetY: number, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Collection<U | number>;
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-strided-special-abs-by",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Compute the absolute value of each element retrieved from a strided input array via a callback function and assign each result to an element in a strided output array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/math-base-special-abs": "^0.0
|
|
41
|
-
"@stdlib/strided-base-map-by": "^0.0
|
|
42
|
-
"@stdlib/types": "^0.0
|
|
43
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0
|
|
40
|
+
"@stdlib/math-base-special-abs": "^0.1.0",
|
|
41
|
+
"@stdlib/strided-base-map-by": "^0.1.0",
|
|
42
|
+
"@stdlib/types": "^0.1.0",
|
|
43
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@stdlib/array-filled": "^0.0.
|
|
47
|
-
"@stdlib/array-
|
|
48
|
-
"@stdlib/
|
|
49
|
-
"@stdlib/
|
|
50
|
-
"@stdlib/math-base-
|
|
51
|
-
"@stdlib/math-
|
|
52
|
-
"@stdlib/
|
|
53
|
-
"@stdlib/random-base-
|
|
46
|
+
"@stdlib/array-filled": "^0.0.6",
|
|
47
|
+
"@stdlib/array-filled-by": "^0.0.2",
|
|
48
|
+
"@stdlib/array-float64": "^0.1.0",
|
|
49
|
+
"@stdlib/bench": "^0.1.0",
|
|
50
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.0",
|
|
51
|
+
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
52
|
+
"@stdlib/math-strided-special-dabs": "^0.1.0",
|
|
53
|
+
"@stdlib/random-base-uniform": "^0.0.6",
|
|
54
54
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
55
55
|
"istanbul": "^0.4.1",
|
|
56
|
-
"tap-
|
|
56
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=0.10.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
],
|
|
93
93
|
"__stdlib__": {},
|
|
94
94
|
"funding": {
|
|
95
|
-
"type": "
|
|
96
|
-
"url": "https://
|
|
95
|
+
"type": "opencollective",
|
|
96
|
+
"url": "https://opencollective.com/stdlib"
|
|
97
97
|
}
|
|
98
98
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( N, x, sx, y, sy, clbk[, thisArg] )
|
|
3
|
-
Computes the absolute value of each element retrieved from a strided input
|
|
4
|
-
array `x` via a callback function and assigns each result to an element in a
|
|
5
|
-
strided output array `y`.
|
|
6
|
-
|
|
7
|
-
The `N` and stride parameters determine which elements in `x` and `y` are
|
|
8
|
-
accessed at runtime.
|
|
9
|
-
|
|
10
|
-
Indexing is relative to the first index. To introduce an offset, use typed
|
|
11
|
-
array views.
|
|
12
|
-
|
|
13
|
-
The callback function is provided six arguments:
|
|
14
|
-
|
|
15
|
-
- value: array element
|
|
16
|
-
- idx: iteration index
|
|
17
|
-
- xi: strided index (offsetX + idx*sx)
|
|
18
|
-
- yi: strided index (offsetY + idx*sy)
|
|
19
|
-
- x: the input array
|
|
20
|
-
- y: the destination array
|
|
21
|
-
|
|
22
|
-
If the callback function does not return any value (or equivalently,
|
|
23
|
-
explicitly returns `undefined`), the value is ignored.
|
|
24
|
-
|
|
25
|
-
Parameters
|
|
26
|
-
----------
|
|
27
|
-
N: integer
|
|
28
|
-
Number of indexed elements.
|
|
29
|
-
|
|
30
|
-
x: Array|TypedArray|Object
|
|
31
|
-
Input array/collection. If provided an object, the object must be array-
|
|
32
|
-
like (excluding strings and functions).
|
|
33
|
-
|
|
34
|
-
sx: integer
|
|
35
|
-
Index increment for `x`.
|
|
36
|
-
|
|
37
|
-
y: Array|TypedArray|Object
|
|
38
|
-
Destination array/collection. If provided an object, the object must be
|
|
39
|
-
array-like (excluding strings and functions).
|
|
40
|
-
|
|
41
|
-
sy: integer
|
|
42
|
-
Index increment for `y`.
|
|
43
|
-
|
|
44
|
-
clbk: Function
|
|
45
|
-
Callback function.
|
|
46
|
-
|
|
47
|
-
thisArg: any (optional)
|
|
48
|
-
Callback execution context.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
y: Array|TypedArray|Object
|
|
53
|
-
Destination array/collection.
|
|
54
|
-
|
|
55
|
-
Examples
|
|
56
|
-
--------
|
|
57
|
-
// Standard usage:
|
|
58
|
-
> var x = [ 1.0, -2.0, 3.0, -4.0 ];
|
|
59
|
-
> var y = [ 0.0, 0.0, 0.0, 0.0 ];
|
|
60
|
-
> function clbk( v ) { return v * 2.0; };
|
|
61
|
-
> {{alias}}( x.length, x, 1, y, 1, clbk )
|
|
62
|
-
[ 2.0, 4.0, 6.0, 8.0 ]
|
|
63
|
-
|
|
64
|
-
// Using `N` and stride parameters:
|
|
65
|
-
> y = [ 0.0, 0.0, 0.0, 0.0 ];
|
|
66
|
-
> {{alias}}( 2, x, 2, y, -1, clbk )
|
|
67
|
-
[ 6.0, 2.0, 0.0, 0.0 ]
|
|
68
|
-
|
|
69
|
-
// Using view offsets:
|
|
70
|
-
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
71
|
-
> var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
|
72
|
-
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
|
73
|
-
> var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
|
|
74
|
-
> {{alias}}( 2, x1, -2, y1, 1, clbk )
|
|
75
|
-
<Float64Array>[ 8.0, 4.0 ]
|
|
76
|
-
> y0
|
|
77
|
-
<Float64Array>[ 0.0, 0.0, 8.0, 4.0 ]
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{{alias}}.ndarray( N, x, sx, ox, y, sy, oy, clbk[, thisArg] )
|
|
81
|
-
Computes the absolute value of each element retrieved from a strided input
|
|
82
|
-
array `x` via a callback function and assigns each result to an element in a
|
|
83
|
-
strided output array `y` using alternative indexing semantics.
|
|
84
|
-
|
|
85
|
-
While typed array views mandate a view offset based on the underlying
|
|
86
|
-
buffer, the offset parameters support indexing semantics based on starting
|
|
87
|
-
indices.
|
|
88
|
-
|
|
89
|
-
Parameters
|
|
90
|
-
----------
|
|
91
|
-
N: integer
|
|
92
|
-
Number of indexed elements.
|
|
93
|
-
|
|
94
|
-
x: Array|TypedArray|Object
|
|
95
|
-
Input array/collection. If provided an object, the object must be array-
|
|
96
|
-
like (excluding strings and functions).
|
|
97
|
-
|
|
98
|
-
sx: integer
|
|
99
|
-
Index increment for `x`.
|
|
100
|
-
|
|
101
|
-
ox: integer
|
|
102
|
-
Starting index for `x`.
|
|
103
|
-
|
|
104
|
-
y: Array|TypedArray|Object
|
|
105
|
-
Destination array/collection. If provided an object, the object must be
|
|
106
|
-
array-like (excluding strings and functions).
|
|
107
|
-
|
|
108
|
-
sy: integer
|
|
109
|
-
Index increment for `y`.
|
|
110
|
-
|
|
111
|
-
oy: integer
|
|
112
|
-
Starting index for `y`.
|
|
113
|
-
|
|
114
|
-
clbk: Function
|
|
115
|
-
Callback function.
|
|
116
|
-
|
|
117
|
-
thisArg: any (optional)
|
|
118
|
-
Callback execution context.
|
|
119
|
-
|
|
120
|
-
Returns
|
|
121
|
-
-------
|
|
122
|
-
y: Array|TypedArray|Object
|
|
123
|
-
Destination array/collection.
|
|
124
|
-
|
|
125
|
-
Examples
|
|
126
|
-
--------
|
|
127
|
-
// Standard usage:
|
|
128
|
-
> var x = [ 1.0, -2.0, 3.0, -4.0 ];
|
|
129
|
-
> var y = [ 0.0, 0.0, 0.0, 0.0 ];
|
|
130
|
-
> function clbk( v ) { return v * 2.0; };
|
|
131
|
-
> {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, clbk )
|
|
132
|
-
[ 2.0, 4.0, 6.0, 8.0 ]
|
|
133
|
-
|
|
134
|
-
// Advanced indexing:
|
|
135
|
-
> x = [ 1.0, -2.0, 3.0, -4.0 ];
|
|
136
|
-
> y = [ 0.0, 0.0, 0.0, 0.0 ];
|
|
137
|
-
> {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, clbk )
|
|
138
|
-
[ 0.0, 0.0, 8.0, 4.0 ]
|
|
139
|
-
|
|
140
|
-
See Also
|
|
141
|
-
--------
|
|
142
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 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 absBy = require( './index' );
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Accessor callback.
|
|
23
|
-
*
|
|
24
|
-
* @returns accessed value
|
|
25
|
-
*/
|
|
26
|
-
function accessor(): number {
|
|
27
|
-
return 5.0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// TESTS //
|
|
32
|
-
|
|
33
|
-
// The function returns a collection...
|
|
34
|
-
{
|
|
35
|
-
const x = new Float64Array( 10 );
|
|
36
|
-
const y = new Float64Array( 10 );
|
|
37
|
-
|
|
38
|
-
absBy( x.length, x, 1, y, 1, accessor ); // $ExpectType Collection
|
|
39
|
-
absBy( x.length, x, 1, y, 1, accessor, {} ); // $ExpectType Collection
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// The compiler throws an error if the function is provided a first argument which is not a number...
|
|
43
|
-
{
|
|
44
|
-
const x = new Float64Array( 10 );
|
|
45
|
-
const y = new Float64Array( 10 );
|
|
46
|
-
|
|
47
|
-
absBy( '10', x, 1, y, 1, accessor ); // $ExpectError
|
|
48
|
-
absBy( true, x, 1, y, 1, accessor ); // $ExpectError
|
|
49
|
-
absBy( false, x, 1, y, 1, accessor ); // $ExpectError
|
|
50
|
-
absBy( null, x, 1, y, 1, accessor ); // $ExpectError
|
|
51
|
-
absBy( undefined, x, 1, y, 1, accessor ); // $ExpectError
|
|
52
|
-
absBy( [], x, 1, y, 1, accessor ); // $ExpectError
|
|
53
|
-
absBy( {}, x, 1, y, 1, accessor ); // $ExpectError
|
|
54
|
-
absBy( ( x: number ): number => x, x, 1, y, 1, accessor ); // $ExpectError
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// The compiler throws an error if the function is provided a second argument which is not a collection...
|
|
58
|
-
{
|
|
59
|
-
const x = new Float64Array( 10 );
|
|
60
|
-
const y = new Float64Array( 10 );
|
|
61
|
-
|
|
62
|
-
absBy( x.length, 10, 1, y, 1, accessor ); // $ExpectError
|
|
63
|
-
absBy( x.length, true, 1, y, 1, accessor ); // $ExpectError
|
|
64
|
-
absBy( x.length, false, 1, y, 1, accessor ); // $ExpectError
|
|
65
|
-
absBy( x.length, null, 1, y, 1, accessor ); // $ExpectError
|
|
66
|
-
absBy( x.length, undefined, 1, y, 1, accessor ); // $ExpectError
|
|
67
|
-
absBy( x.length, {}, 1, y, 1, accessor ); // $ExpectError
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// The compiler throws an error if the function is provided a third argument which is not a number...
|
|
71
|
-
{
|
|
72
|
-
const x = new Float64Array( 10 );
|
|
73
|
-
const y = new Float64Array( 10 );
|
|
74
|
-
|
|
75
|
-
absBy( x.length, x, '10', y, 1, accessor ); // $ExpectError
|
|
76
|
-
absBy( x.length, x, true, y, 1, accessor ); // $ExpectError
|
|
77
|
-
absBy( x.length, x, false, y, 1, accessor ); // $ExpectError
|
|
78
|
-
absBy( x.length, x, null, y, 1, accessor ); // $ExpectError
|
|
79
|
-
absBy( x.length, x, undefined, y, 1, accessor ); // $ExpectError
|
|
80
|
-
absBy( x.length, x, [], y, 1, accessor ); // $ExpectError
|
|
81
|
-
absBy( x.length, x, {}, y, 1, accessor ); // $ExpectError
|
|
82
|
-
absBy( x.length, x, ( x: number ): number => x, y, 1, accessor ); // $ExpectError
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// The compiler throws an error if the function is provided a fourth argument which is not a collection...
|
|
86
|
-
{
|
|
87
|
-
const x = new Float64Array( 10 );
|
|
88
|
-
|
|
89
|
-
absBy( x.length, x, 1, 10, 1, accessor ); // $ExpectError
|
|
90
|
-
absBy( x.length, x, 1, true, 1, accessor ); // $ExpectError
|
|
91
|
-
absBy( x.length, x, 1, false, 1, accessor ); // $ExpectError
|
|
92
|
-
absBy( x.length, x, 1, null, 1, accessor ); // $ExpectError
|
|
93
|
-
absBy( x.length, x, 1, undefined, 1, accessor ); // $ExpectError
|
|
94
|
-
absBy( x.length, x, 1, {}, 1, accessor ); // $ExpectError
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// The compiler throws an error if the function is provided a fifth argument which is not a number...
|
|
98
|
-
{
|
|
99
|
-
const x = new Float64Array( 10 );
|
|
100
|
-
const y = new Float64Array( 10 );
|
|
101
|
-
|
|
102
|
-
absBy( x.length, x, 1, y, '10', accessor ); // $ExpectError
|
|
103
|
-
absBy( x.length, x, 1, y, true, accessor ); // $ExpectError
|
|
104
|
-
absBy( x.length, x, 1, y, false, accessor ); // $ExpectError
|
|
105
|
-
absBy( x.length, x, 1, y, null, accessor ); // $ExpectError
|
|
106
|
-
absBy( x.length, x, 1, y, undefined, accessor ); // $ExpectError
|
|
107
|
-
absBy( x.length, x, 1, y, [], accessor ); // $ExpectError
|
|
108
|
-
absBy( x.length, x, 1, y, {}, accessor ); // $ExpectError
|
|
109
|
-
absBy( x.length, x, 1, y, ( x: number ): number => x, accessor ); // $ExpectError
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// The compiler throws an error if the function is provided a sixth argument which is not a function...
|
|
113
|
-
{
|
|
114
|
-
const x = new Float64Array( 10 );
|
|
115
|
-
const y = new Float64Array( 10 );
|
|
116
|
-
|
|
117
|
-
absBy( x.length, x, 1, y, 1, '10' ); // $ExpectError
|
|
118
|
-
absBy( x.length, x, 1, y, 1, 0 ); // $ExpectError
|
|
119
|
-
absBy( x.length, x, 1, y, 1, true ); // $ExpectError
|
|
120
|
-
absBy( x.length, x, 1, y, 1, false ); // $ExpectError
|
|
121
|
-
absBy( x.length, x, 1, y, 1, null ); // $ExpectError
|
|
122
|
-
absBy( x.length, x, 1, y, 1, undefined ); // $ExpectError
|
|
123
|
-
absBy( x.length, x, 1, y, 1, [] ); // $ExpectError
|
|
124
|
-
absBy( x.length, x, 1, y, 1, {} ); // $ExpectError
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
128
|
-
{
|
|
129
|
-
const x = new Float64Array( 10 );
|
|
130
|
-
const y = new Float64Array( 10 );
|
|
131
|
-
|
|
132
|
-
absBy(); // $ExpectError
|
|
133
|
-
absBy( x.length ); // $ExpectError
|
|
134
|
-
absBy( x.length, x ); // $ExpectError
|
|
135
|
-
absBy( x.length, x, 1 ); // $ExpectError
|
|
136
|
-
absBy( x.length, x, 1, y ); // $ExpectError
|
|
137
|
-
absBy( x.length, x, 1, y, 1 ); // $ExpectError
|
|
138
|
-
absBy( x.length, x, 1, y, 1, accessor, 10, 10 ); // $ExpectError
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Attached to main export is an `ndarray` method which returns a collection...
|
|
142
|
-
{
|
|
143
|
-
const x = new Float64Array( 10 );
|
|
144
|
-
const y = new Float64Array( 10 );
|
|
145
|
-
|
|
146
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); // $ExpectType Collection
|
|
147
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor, {} ); // $ExpectType Collection
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
|
|
151
|
-
{
|
|
152
|
-
const x = new Float64Array( 10 );
|
|
153
|
-
const y = new Float64Array( 10 );
|
|
154
|
-
|
|
155
|
-
absBy.ndarray( '10', x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
156
|
-
absBy.ndarray( true, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
157
|
-
absBy.ndarray( false, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
158
|
-
absBy.ndarray( null, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
159
|
-
absBy.ndarray( undefined, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
160
|
-
absBy.ndarray( [], x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
161
|
-
absBy.ndarray( {}, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
162
|
-
absBy.ndarray( ( x: number ): number => x, x, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// The compiler throws an error if the `ndarray` method is provided a second argument which is not a collection...
|
|
166
|
-
{
|
|
167
|
-
const x = new Float64Array( 10 );
|
|
168
|
-
const y = new Float64Array( 10 );
|
|
169
|
-
|
|
170
|
-
absBy.ndarray( x.length, 10, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
171
|
-
absBy.ndarray( x.length, true, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
172
|
-
absBy.ndarray( x.length, false, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
173
|
-
absBy.ndarray( x.length, null, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
174
|
-
absBy.ndarray( x.length, undefined, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
175
|
-
absBy.ndarray( x.length, {}, 1, 0, y, 1, 0, accessor ); // $ExpectError
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
|
|
179
|
-
{
|
|
180
|
-
const x = new Float64Array( 10 );
|
|
181
|
-
const y = new Float64Array( 10 );
|
|
182
|
-
|
|
183
|
-
absBy.ndarray( x.length, x, '10', 0, y, 1, 0, accessor ); // $ExpectError
|
|
184
|
-
absBy.ndarray( x.length, x, true, 0, y, 1, 0, accessor ); // $ExpectError
|
|
185
|
-
absBy.ndarray( x.length, x, false, 0, y, 1, 0, accessor ); // $ExpectError
|
|
186
|
-
absBy.ndarray( x.length, x, null, 0, y, 1, 0, accessor ); // $ExpectError
|
|
187
|
-
absBy.ndarray( x.length, x, undefined, 0, y, 1, 0, accessor ); // $ExpectError
|
|
188
|
-
absBy.ndarray( x.length, x, [], 0, y, 1, 0, accessor ); // $ExpectError
|
|
189
|
-
absBy.ndarray( x.length, x, {}, 0, y, 1, 0, accessor ); // $ExpectError
|
|
190
|
-
absBy.ndarray( x.length, x, ( x: number ): number => x, 0, y, 1, 0, accessor ); // $ExpectError
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
|
|
194
|
-
{
|
|
195
|
-
const x = new Float64Array( 10 );
|
|
196
|
-
const y = new Float64Array( 10 );
|
|
197
|
-
|
|
198
|
-
absBy.ndarray( x.length, x, 1, '10', y, 1, 0, accessor ); // $ExpectError
|
|
199
|
-
absBy.ndarray( x.length, x, 1, true, y, 1, 0, accessor ); // $ExpectError
|
|
200
|
-
absBy.ndarray( x.length, x, 1, false, y, 1, 0, accessor ); // $ExpectError
|
|
201
|
-
absBy.ndarray( x.length, x, 1, null, y, 1, 0, accessor ); // $ExpectError
|
|
202
|
-
absBy.ndarray( x.length, x, 1, undefined, y, 1, 0, accessor ); // $ExpectError
|
|
203
|
-
absBy.ndarray( x.length, x, 1, [], y, 1, 0, accessor ); // $ExpectError
|
|
204
|
-
absBy.ndarray( x.length, x, 1, {}, y, 1, 0, accessor ); // $ExpectError
|
|
205
|
-
absBy.ndarray( x.length, x, 1, ( x: number ): number => x, y, 1, 0, accessor ); // $ExpectError
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a collection...
|
|
209
|
-
{
|
|
210
|
-
const x = new Float64Array( 10 );
|
|
211
|
-
|
|
212
|
-
absBy.ndarray( x.length, x, 1, 0, 10, 1, 0, accessor ); // $ExpectError
|
|
213
|
-
absBy.ndarray( x.length, x, 1, 0, true, 1, 0, accessor ); // $ExpectError
|
|
214
|
-
absBy.ndarray( x.length, x, 1, 0, false, 1, 0, accessor ); // $ExpectError
|
|
215
|
-
absBy.ndarray( x.length, x, 1, 0, null, 1, 0, accessor ); // $ExpectError
|
|
216
|
-
absBy.ndarray( x.length, x, 1, 0, undefined, 1, 0, accessor ); // $ExpectError
|
|
217
|
-
absBy.ndarray( x.length, x, 1, 0, {}, 1, 0, accessor ); // $ExpectError
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number...
|
|
221
|
-
{
|
|
222
|
-
const x = new Float64Array( 10 );
|
|
223
|
-
const y = new Float64Array( 10 );
|
|
224
|
-
|
|
225
|
-
absBy.ndarray( x.length, x, 1, 0, y, '10', 0, accessor ); // $ExpectError
|
|
226
|
-
absBy.ndarray( x.length, x, 1, 0, y, true, 0, accessor ); // $ExpectError
|
|
227
|
-
absBy.ndarray( x.length, x, 1, 0, y, false, 0, accessor ); // $ExpectError
|
|
228
|
-
absBy.ndarray( x.length, x, 1, 0, y, null, 0, accessor ); // $ExpectError
|
|
229
|
-
absBy.ndarray( x.length, x, 1, 0, y, undefined, 0, accessor ); // $ExpectError
|
|
230
|
-
absBy.ndarray( x.length, x, 1, 0, y, [], 0, accessor ); // $ExpectError
|
|
231
|
-
absBy.ndarray( x.length, x, 1, 0, y, {}, 0, accessor ); // $ExpectError
|
|
232
|
-
absBy.ndarray( x.length, x, 1, 0, y, ( x: number ): number => x, 0, accessor ); // $ExpectError
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
|
|
236
|
-
{
|
|
237
|
-
const x = new Float64Array( 10 );
|
|
238
|
-
const y = new Float64Array( 10 );
|
|
239
|
-
|
|
240
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, '10', accessor ); // $ExpectError
|
|
241
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, true, accessor ); // $ExpectError
|
|
242
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, false, accessor ); // $ExpectError
|
|
243
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, null, accessor ); // $ExpectError
|
|
244
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, undefined, accessor ); // $ExpectError
|
|
245
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, [], accessor ); // $ExpectError
|
|
246
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, {}, accessor ); // $ExpectError
|
|
247
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, ( x: number ): number => x, accessor ); // $ExpectError
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a function...
|
|
251
|
-
{
|
|
252
|
-
const x = new Float64Array( 10 );
|
|
253
|
-
const y = new Float64Array( 10 );
|
|
254
|
-
|
|
255
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, '10' ); // $ExpectError
|
|
256
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, 0 ); // $ExpectError
|
|
257
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, true ); // $ExpectError
|
|
258
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, false ); // $ExpectError
|
|
259
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, null ); // $ExpectError
|
|
260
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, undefined ); // $ExpectError
|
|
261
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, [] ); // $ExpectError
|
|
262
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, {} ); // $ExpectError
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
|
|
266
|
-
{
|
|
267
|
-
const x = new Float64Array( 10 );
|
|
268
|
-
const y = new Float64Array( 10 );
|
|
269
|
-
|
|
270
|
-
absBy.ndarray(); // $ExpectError
|
|
271
|
-
absBy.ndarray( x.length ); // $ExpectError
|
|
272
|
-
absBy.ndarray( x.length, x ); // $ExpectError
|
|
273
|
-
absBy.ndarray( x.length, x, 1 ); // $ExpectError
|
|
274
|
-
absBy.ndarray( x.length, x, 1, 0 ); // $ExpectError
|
|
275
|
-
absBy.ndarray( x.length, x, 1, 0, y ); // $ExpectError
|
|
276
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError
|
|
277
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
278
|
-
absBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor, 10, 10 ); // $ExpectError
|
|
279
|
-
}
|