@stdlib/math-special-abs 0.0.2 → 0.0.6
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 +35 -7
- package/lib/main.js +5 -2
- package/lib/native.js +5 -2
- package/lib/table.native.js +7 -4
- package/lib/types.js +103 -0
- package/lib/types.json +1 -65
- package/package.json +6 -8
- package/src/addon.c +43 -7
- package/CHANGELOG.md +0 -5
- package/binding.gyp +0 -170
- package/lib/props.js +0 -68
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2022 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
# abs
|
|
22
22
|
|
|
23
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
|
|
23
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
24
24
|
|
|
25
25
|
> Compute the [absolute value][absolute-value].
|
|
26
26
|
|
|
@@ -33,7 +33,7 @@ The [absolute value][absolute-value] is defined as
|
|
|
33
33
|
<!-- <equation class="equation" label="eq:absolute_value" align="center" raw="|x| = \begin{cases} x & \textrm{if}\ x \geq 0 \\ -x & \textrm{if}\ x < 0\end{cases}" alt="Absolute value"> -->
|
|
34
34
|
|
|
35
35
|
<div class="equation" align="center" data-raw-text="|x| = \begin{cases} x & \textrm{if}\ x \geq 0 \\ -x & \textrm{if}\ x < 0\end{cases}" data-equation="eq:absolute_value">
|
|
36
|
-
<img src="https://cdn.
|
|
36
|
+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@61c5f878886bd5b3b98976501c974bf69f575238/lib/node_modules/@stdlib/math/special/abs/docs/img/equation_absolute_value.svg" alt="Absolute value">
|
|
37
37
|
<br>
|
|
38
38
|
</div>
|
|
39
39
|
|
|
@@ -146,6 +146,8 @@ var v = y.get( 0, 1 );
|
|
|
146
146
|
|
|
147
147
|
The output array must be the same data "kind" (i.e., [`ndarray`][@stdlib/ndarray/ctor] or array-like object) as the input array. For example, if `x` is an [`ndarray`][@stdlib/ndarray/ctor], `y` must also be an [`ndarray`][@stdlib/ndarray/ctor]. Similarly, if `x` is an array-like object, `y` must also be an array-like object.
|
|
148
148
|
|
|
149
|
+
TODO: broadcasting discussion and example(s).
|
|
150
|
+
|
|
149
151
|
</section>
|
|
150
152
|
|
|
151
153
|
<!-- /.usage -->
|
|
@@ -209,6 +211,14 @@ for ( i = 0; i < x.length; i++ ) {
|
|
|
209
211
|
|
|
210
212
|
<!-- /.references -->
|
|
211
213
|
|
|
214
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
215
|
+
|
|
216
|
+
<section class="related">
|
|
217
|
+
|
|
218
|
+
</section>
|
|
219
|
+
|
|
220
|
+
<!-- /.related -->
|
|
221
|
+
|
|
212
222
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
213
223
|
|
|
214
224
|
|
|
@@ -222,6 +232,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
|
|
|
222
232
|
|
|
223
233
|
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
224
234
|
|
|
235
|
+
#### Community
|
|
236
|
+
|
|
237
|
+
[![Chat][chat-image]][chat-url]
|
|
238
|
+
|
|
225
239
|
---
|
|
226
240
|
|
|
227
241
|
## License
|
|
@@ -231,7 +245,7 @@ See [LICENSE][stdlib-license].
|
|
|
231
245
|
|
|
232
246
|
## Copyright
|
|
233
247
|
|
|
234
|
-
Copyright © 2016-
|
|
248
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
235
249
|
|
|
236
250
|
</section>
|
|
237
251
|
|
|
@@ -250,9 +264,23 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
250
264
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-special-abs/main.svg
|
|
251
265
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-special-abs?branch=main
|
|
252
266
|
|
|
253
|
-
|
|
267
|
+
<!--
|
|
268
|
+
|
|
269
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/math-special-abs.svg
|
|
254
270
|
[dependencies-url]: https://david-dm.org/stdlib-js/math-special-abs/main
|
|
255
271
|
|
|
272
|
+
-->
|
|
273
|
+
|
|
274
|
+
[umd]: https://github.com/umdjs/umd
|
|
275
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
276
|
+
|
|
277
|
+
[deno-url]: https://github.com/stdlib-js/math-special-abs/tree/deno
|
|
278
|
+
[umd-url]: https://github.com/stdlib-js/math-special-abs/tree/umd
|
|
279
|
+
[esm-url]: https://github.com/stdlib-js/math-special-abs/tree/esm
|
|
280
|
+
|
|
281
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
282
|
+
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
283
|
+
|
|
256
284
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
257
285
|
|
|
258
286
|
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
@@ -261,11 +289,11 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
261
289
|
|
|
262
290
|
[absolute-value]: https://en.wikipedia.org/wiki/Absolute_value
|
|
263
291
|
|
|
264
|
-
[@stdlib/ndarray/ctor]: https://
|
|
292
|
+
[@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
|
|
265
293
|
|
|
266
|
-
[@stdlib/ndarray/orders]: https://
|
|
294
|
+
[@stdlib/ndarray/orders]: https://www.npmjs.com/package/@stdlib/ndarray-orders
|
|
267
295
|
|
|
268
|
-
[@stdlib/ndarray/dtypes]: https://
|
|
296
|
+
[@stdlib/ndarray/dtypes]: https://www.npmjs.com/package/@stdlib/ndarray-dtypes
|
|
269
297
|
|
|
270
298
|
</section>
|
|
271
299
|
|
package/lib/main.js
CHANGED
|
@@ -20,13 +20,16 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
+
var setProps = require( '@stdlib/ndarray-base-meta-data-props' );
|
|
24
|
+
var meta = require( './meta.json' );
|
|
25
|
+
var types = require( './types.json' );
|
|
23
26
|
var abs = require( './abs.js' );
|
|
24
|
-
var setProps = require( './props.js' );
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
// MAIN //
|
|
28
30
|
|
|
29
|
-
setProps( abs );
|
|
31
|
+
setProps( meta, types, abs );
|
|
32
|
+
setProps( meta, types, abs.assign );
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
// EXPORTS //
|
package/lib/native.js
CHANGED
|
@@ -20,13 +20,16 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
+
var setProps = require( '@stdlib/ndarray-base-meta-data-props' );
|
|
24
|
+
var meta = require( './meta.json' );
|
|
25
|
+
var types = require( './types.json' );
|
|
23
26
|
var abs = require( './abs.native.js' );
|
|
24
|
-
var setProps = require( './props.js' );
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
// MAIN //
|
|
28
30
|
|
|
29
|
-
setProps( abs );
|
|
31
|
+
setProps( meta, types, abs );
|
|
32
|
+
setProps( meta, types, abs.assign );
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
// EXPORTS //
|
package/lib/table.native.js
CHANGED
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
|
|
23
23
|
var isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );
|
|
24
24
|
var serialize = require( '@stdlib/ndarray-base-serialize-meta-data' );
|
|
25
|
-
var copy = require( '@stdlib/utils-copy' );
|
|
26
25
|
var addon = require( './../src/addon.node' );
|
|
27
26
|
var TABLE = require( './table.js' );
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
// VARIABLES //
|
|
31
30
|
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
31
|
+
var js = TABLE.ndarray;
|
|
32
|
+
var table = {
|
|
33
|
+
'number': TABLE.number,
|
|
34
|
+
'complex': TABLE.complex,
|
|
35
|
+
'array': TABLE.array,
|
|
36
|
+
'ndarray': unary
|
|
37
|
+
};
|
|
35
38
|
|
|
36
39
|
|
|
37
40
|
// FUNCTIONS //
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
/*
|
|
20
|
+
* NOTE: this file is only for developer convenience. Upon updating this file, run the `scripts/types.js` file to regenerate the compact types representation.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/* eslint-disable array-element-newline */
|
|
24
|
+
|
|
25
|
+
'use strict';
|
|
26
|
+
|
|
27
|
+
// MODULES //
|
|
28
|
+
|
|
29
|
+
var dtypes = require( '@stdlib/ndarray-dtypes' );
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// MAIN //
|
|
33
|
+
|
|
34
|
+
var types = [
|
|
35
|
+
dtypes.float64, dtypes.float64,
|
|
36
|
+
dtypes.float64, dtypes.generic,
|
|
37
|
+
|
|
38
|
+
dtypes.float32, dtypes.float32,
|
|
39
|
+
dtypes.float32, dtypes.float64,
|
|
40
|
+
dtypes.float32, dtypes.generic,
|
|
41
|
+
|
|
42
|
+
dtypes.generic, dtypes.generic,
|
|
43
|
+
|
|
44
|
+
dtypes.int32, dtypes.int32,
|
|
45
|
+
dtypes.int32, dtypes.uint32,
|
|
46
|
+
dtypes.int32, dtypes.float64,
|
|
47
|
+
dtypes.int32, dtypes.generic,
|
|
48
|
+
|
|
49
|
+
dtypes.int16, dtypes.int16,
|
|
50
|
+
dtypes.int16, dtypes.int32,
|
|
51
|
+
dtypes.int16, dtypes.uint16,
|
|
52
|
+
dtypes.int16, dtypes.uint32,
|
|
53
|
+
dtypes.int16, dtypes.float32,
|
|
54
|
+
dtypes.int16, dtypes.float64,
|
|
55
|
+
dtypes.int16, dtypes.generic,
|
|
56
|
+
|
|
57
|
+
dtypes.int8, dtypes.int8,
|
|
58
|
+
dtypes.int8, dtypes.int16,
|
|
59
|
+
dtypes.int8, dtypes.int32,
|
|
60
|
+
dtypes.int8, dtypes.uint8,
|
|
61
|
+
dtypes.int8, dtypes.uint8c,
|
|
62
|
+
dtypes.int8, dtypes.uint16,
|
|
63
|
+
dtypes.int8, dtypes.uint32,
|
|
64
|
+
dtypes.int8, dtypes.float32,
|
|
65
|
+
dtypes.int8, dtypes.float64,
|
|
66
|
+
dtypes.int8, dtypes.generic,
|
|
67
|
+
|
|
68
|
+
dtypes.uint32, dtypes.uint32,
|
|
69
|
+
dtypes.uint32, dtypes.float64,
|
|
70
|
+
dtypes.uint32, dtypes.generic,
|
|
71
|
+
|
|
72
|
+
dtypes.uint16, dtypes.int32,
|
|
73
|
+
dtypes.uint16, dtypes.uint16,
|
|
74
|
+
dtypes.uint16, dtypes.uint32,
|
|
75
|
+
dtypes.uint16, dtypes.float32,
|
|
76
|
+
dtypes.uint16, dtypes.float64,
|
|
77
|
+
dtypes.uint16, dtypes.generic,
|
|
78
|
+
|
|
79
|
+
dtypes.uint8, dtypes.int16,
|
|
80
|
+
dtypes.uint8, dtypes.int32,
|
|
81
|
+
dtypes.uint8, dtypes.uint8,
|
|
82
|
+
dtypes.uint8, dtypes.uint8c,
|
|
83
|
+
dtypes.uint8, dtypes.uint16,
|
|
84
|
+
dtypes.uint8, dtypes.uint32,
|
|
85
|
+
dtypes.uint8, dtypes.float32,
|
|
86
|
+
dtypes.uint8, dtypes.float64,
|
|
87
|
+
dtypes.uint8, dtypes.generic,
|
|
88
|
+
|
|
89
|
+
dtypes.uint8c, dtypes.int16,
|
|
90
|
+
dtypes.uint8c, dtypes.int32,
|
|
91
|
+
dtypes.uint8c, dtypes.uint8,
|
|
92
|
+
dtypes.uint8c, dtypes.uint8c,
|
|
93
|
+
dtypes.uint8c, dtypes.uint16,
|
|
94
|
+
dtypes.uint8c, dtypes.uint32,
|
|
95
|
+
dtypes.uint8c, dtypes.float32,
|
|
96
|
+
dtypes.uint8c, dtypes.float64,
|
|
97
|
+
dtypes.uint8c, dtypes.generic
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
// EXPORTS //
|
|
102
|
+
|
|
103
|
+
module.exports = types;
|
package/lib/types.json
CHANGED
|
@@ -1,65 +1 @@
|
|
|
1
|
-
[
|
|
2
|
-
"float64", "float64",
|
|
3
|
-
"float64", "generic",
|
|
4
|
-
|
|
5
|
-
"float32", "float32",
|
|
6
|
-
"float32", "float64",
|
|
7
|
-
"float32", "generic",
|
|
8
|
-
|
|
9
|
-
"generic", "generic",
|
|
10
|
-
|
|
11
|
-
"int32", "int32",
|
|
12
|
-
"int32", "uint32",
|
|
13
|
-
"int32", "float64",
|
|
14
|
-
"int32", "generic",
|
|
15
|
-
|
|
16
|
-
"int16", "int16",
|
|
17
|
-
"int16", "int32",
|
|
18
|
-
"int16", "uint16",
|
|
19
|
-
"int16", "uint32",
|
|
20
|
-
"int16", "float32",
|
|
21
|
-
"int16", "float64",
|
|
22
|
-
"int16", "generic",
|
|
23
|
-
|
|
24
|
-
"int8", "int8",
|
|
25
|
-
"int8", "int16",
|
|
26
|
-
"int8", "int32",
|
|
27
|
-
"int8", "uint8",
|
|
28
|
-
"int8", "uint8c",
|
|
29
|
-
"int8", "uint16",
|
|
30
|
-
"int8", "uint32",
|
|
31
|
-
"int8", "float32",
|
|
32
|
-
"int8", "float64",
|
|
33
|
-
"int8", "generic",
|
|
34
|
-
|
|
35
|
-
"uint32", "uint32",
|
|
36
|
-
"uint32", "float64",
|
|
37
|
-
"uint32", "generic",
|
|
38
|
-
|
|
39
|
-
"uint16", "int32",
|
|
40
|
-
"uint16", "uint16",
|
|
41
|
-
"uint16", "uint32",
|
|
42
|
-
"uint16", "float32",
|
|
43
|
-
"uint16", "float64",
|
|
44
|
-
"uint16", "generic",
|
|
45
|
-
|
|
46
|
-
"uint8", "int16",
|
|
47
|
-
"uint8", "int32",
|
|
48
|
-
"uint8", "uint8",
|
|
49
|
-
"uint8", "uint8c",
|
|
50
|
-
"uint8", "uint16",
|
|
51
|
-
"uint8", "uint32",
|
|
52
|
-
"uint8", "float32",
|
|
53
|
-
"uint8", "float64",
|
|
54
|
-
"uint8", "generic",
|
|
55
|
-
|
|
56
|
-
"uint8c", "int16",
|
|
57
|
-
"uint8c", "int32",
|
|
58
|
-
"uint8c", "uint8",
|
|
59
|
-
"uint8c", "uint8c",
|
|
60
|
-
"uint8c", "uint16",
|
|
61
|
-
"uint8c", "uint32",
|
|
62
|
-
"uint8c", "float32",
|
|
63
|
-
"uint8c", "float64",
|
|
64
|
-
"uint8c", "generic"
|
|
65
|
-
]
|
|
1
|
+
[11,11,11,15,10,10,10,11,10,15,15,15,6,6,6,7,6,11,6,15,4,4,4,6,4,5,4,7,4,10,4,11,4,15,1,1,1,4,1,6,1,2,1,3,1,5,1,7,1,10,1,11,1,15,7,7,7,11,7,15,5,6,5,5,5,7,5,10,5,11,5,15,2,4,2,6,2,2,2,3,2,5,2,7,2,10,2,11,2,15,3,4,3,6,3,2,3,3,3,5,3,7,3,10,3,11,3,15]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-special-abs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Compute the absolute value.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -15,12 +15,11 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
17
|
"browser": "./lib/main.js",
|
|
18
|
-
"gypfile":
|
|
18
|
+
"gypfile": false,
|
|
19
19
|
"directories": {
|
|
20
20
|
"benchmark": "./benchmark",
|
|
21
21
|
"doc": "./docs",
|
|
22
22
|
"example": "./examples",
|
|
23
|
-
"include": "./include",
|
|
24
23
|
"lib": "./lib",
|
|
25
24
|
"src": "./src",
|
|
26
25
|
"test": "./test"
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"examples": "make examples",
|
|
33
32
|
"benchmark": "make benchmark"
|
|
34
33
|
},
|
|
35
|
-
"homepage": "https://
|
|
34
|
+
"homepage": "https://stdlib.io",
|
|
36
35
|
"repository": {
|
|
37
36
|
"type": "git",
|
|
38
37
|
"url": "git://github.com/stdlib-js/math-special-abs.git"
|
|
@@ -47,15 +46,13 @@
|
|
|
47
46
|
"@stdlib/math-base-special-labs": "^0.0.x",
|
|
48
47
|
"@stdlib/math-strided-special-abs": "^0.0.x",
|
|
49
48
|
"@stdlib/math-tools-unary": "^0.0.x",
|
|
50
|
-
"@stdlib/ndarray-base-dtypes2signatures": "^0.0.x",
|
|
51
49
|
"@stdlib/ndarray-base-function-object": "^0.0.x",
|
|
50
|
+
"@stdlib/ndarray-base-meta-data-props": "^0.0.x",
|
|
52
51
|
"@stdlib/ndarray-base-napi-unary": "^0.0.x",
|
|
53
52
|
"@stdlib/ndarray-base-unary": "^0.0.x",
|
|
54
53
|
"@stdlib/ndarray-dispatch": "^0.0.x",
|
|
55
54
|
"@stdlib/ndarray-dtypes": "^0.0.x",
|
|
56
55
|
"@stdlib/types": "^0.0.x",
|
|
57
|
-
"@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.0.x",
|
|
58
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
|
|
59
56
|
"@stdlib/utils-library-manifest": "^0.0.x",
|
|
60
57
|
"@stdlib/utils-try-require": "^0.0.x"
|
|
61
58
|
},
|
|
@@ -66,16 +63,17 @@
|
|
|
66
63
|
"@stdlib/assert-is-browser": "^0.0.x",
|
|
67
64
|
"@stdlib/assert-is-typed-array-like": "^0.0.x",
|
|
68
65
|
"@stdlib/bench": "^0.0.x",
|
|
66
|
+
"@stdlib/fs-write-file": "^0.0.x",
|
|
69
67
|
"@stdlib/math-base-assert-is-nan": "^0.0.x",
|
|
70
68
|
"@stdlib/math-base-special-pow": "^0.0.x",
|
|
71
69
|
"@stdlib/ndarray-array": "^0.0.x",
|
|
72
70
|
"@stdlib/ndarray-base-ctor": "^0.0.x",
|
|
71
|
+
"@stdlib/ndarray-base-dtypes2signatures": "^0.0.x",
|
|
73
72
|
"@stdlib/ndarray-base-serialize-meta-data": "^0.0.x",
|
|
74
73
|
"@stdlib/ndarray-base-shape2strides": "^0.0.x",
|
|
75
74
|
"@stdlib/ndarray-ctor": "^0.0.x",
|
|
76
75
|
"@stdlib/ndarray-ind2sub": "^0.0.x",
|
|
77
76
|
"@stdlib/random-base-uniform": "^0.0.x",
|
|
78
|
-
"@stdlib/utils-copy": "^0.0.x",
|
|
79
77
|
"proxyquire": "^2.0.0",
|
|
80
78
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
81
79
|
"istanbul": "^0.4.1",
|
package/src/addon.c
CHANGED
|
@@ -108,11 +108,12 @@ static ndarrayFcn functions[] = {
|
|
|
108
108
|
stdlib_ndarray_k_f,
|
|
109
109
|
stdlib_ndarray_k_d,
|
|
110
110
|
|
|
111
|
-
// int8 (
|
|
111
|
+
// int8 (9)
|
|
112
112
|
stdlib_ndarray_s_s,
|
|
113
113
|
stdlib_ndarray_s_k,
|
|
114
114
|
stdlib_ndarray_s_i,
|
|
115
115
|
stdlib_ndarray_s_b,
|
|
116
|
+
stdlib_ndarray_s_b,
|
|
116
117
|
stdlib_ndarray_s_t,
|
|
117
118
|
stdlib_ndarray_s_u,
|
|
118
119
|
stdlib_ndarray_s_f,
|
|
@@ -133,6 +134,17 @@ static ndarrayFcn functions[] = {
|
|
|
133
134
|
stdlib_ndarray_b_k,
|
|
134
135
|
stdlib_ndarray_b_i,
|
|
135
136
|
stdlib_ndarray_b_b,
|
|
137
|
+
stdlib_ndarray_b_b,
|
|
138
|
+
stdlib_ndarray_b_t,
|
|
139
|
+
stdlib_ndarray_b_u,
|
|
140
|
+
stdlib_ndarray_b_f,
|
|
141
|
+
stdlib_ndarray_b_d,
|
|
142
|
+
|
|
143
|
+
// uint8c (7)
|
|
144
|
+
stdlib_ndarray_b_k,
|
|
145
|
+
stdlib_ndarray_b_i,
|
|
146
|
+
stdlib_ndarray_b_b,
|
|
147
|
+
stdlib_ndarray_b_b,
|
|
136
148
|
stdlib_ndarray_b_t,
|
|
137
149
|
stdlib_ndarray_b_u,
|
|
138
150
|
stdlib_ndarray_b_f,
|
|
@@ -161,11 +173,12 @@ static int32_t types[] = {
|
|
|
161
173
|
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_FLOAT32,
|
|
162
174
|
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_FLOAT64,
|
|
163
175
|
|
|
164
|
-
// int8 (
|
|
176
|
+
// int8 (9)
|
|
165
177
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT8,
|
|
166
178
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT16,
|
|
167
179
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT32,
|
|
168
180
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_UINT8,
|
|
181
|
+
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_UINT8C,
|
|
169
182
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_UINT16,
|
|
170
183
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_UINT32,
|
|
171
184
|
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_FLOAT32,
|
|
@@ -182,14 +195,25 @@ static int32_t types[] = {
|
|
|
182
195
|
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_FLOAT32,
|
|
183
196
|
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_FLOAT64,
|
|
184
197
|
|
|
185
|
-
// uint8 (
|
|
198
|
+
// uint8 (8)
|
|
186
199
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_INT16,
|
|
187
200
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_INT32,
|
|
188
201
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT8,
|
|
202
|
+
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT8C,
|
|
189
203
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT16,
|
|
190
204
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT32,
|
|
191
205
|
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_FLOAT32,
|
|
192
|
-
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_FLOAT64
|
|
206
|
+
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_FLOAT64,
|
|
207
|
+
|
|
208
|
+
// uint8c (8)
|
|
209
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_INT16,
|
|
210
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_INT32,
|
|
211
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_UINT8,
|
|
212
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_UINT8C,
|
|
213
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_UINT16,
|
|
214
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_UINT32,
|
|
215
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_FLOAT32,
|
|
216
|
+
STDLIB_NDARRAY_UINT8C, STDLIB_NDARRAY_FLOAT64
|
|
193
217
|
};
|
|
194
218
|
|
|
195
219
|
// Define a list of ndarray function "data" (in this case, callbacks):
|
|
@@ -214,7 +238,8 @@ static void *data[] = {
|
|
|
214
238
|
(void *)abs_k,
|
|
215
239
|
(void *)abs_k,
|
|
216
240
|
|
|
217
|
-
// int8 (
|
|
241
|
+
// int8 (9)
|
|
242
|
+
(void *)abs_s,
|
|
218
243
|
(void *)abs_s,
|
|
219
244
|
(void *)abs_s,
|
|
220
245
|
(void *)abs_s,
|
|
@@ -235,7 +260,18 @@ static void *data[] = {
|
|
|
235
260
|
(void *)identity_t,
|
|
236
261
|
(void *)identity_t,
|
|
237
262
|
|
|
238
|
-
// uint8 (
|
|
263
|
+
// uint8 (8)
|
|
264
|
+
(void *)identity_b,
|
|
265
|
+
(void *)identity_b,
|
|
266
|
+
(void *)identity_b,
|
|
267
|
+
(void *)identity_b,
|
|
268
|
+
(void *)identity_b,
|
|
269
|
+
(void *)identity_b,
|
|
270
|
+
(void *)identity_b,
|
|
271
|
+
(void *)identity_b,
|
|
272
|
+
|
|
273
|
+
// uint8c (8)
|
|
274
|
+
(void *)identity_b,
|
|
239
275
|
(void *)identity_b,
|
|
240
276
|
(void *)identity_b,
|
|
241
277
|
(void *)identity_b,
|
|
@@ -263,7 +299,7 @@ static const struct ndarrayFunctionObject obj = {
|
|
|
263
299
|
functions,
|
|
264
300
|
|
|
265
301
|
// Number of ndarray functions:
|
|
266
|
-
|
|
302
|
+
44,
|
|
267
303
|
|
|
268
304
|
// Array of type "numbers" (as enumerated elsewhere), where the total number of types equals `narrays * nfunctions` and where each set of `narrays` consecutive types (non-overlapping) corresponds to the set of ndarray argument types for a corresponding ndarray function:
|
|
269
305
|
types,
|
package/CHANGELOG.md
DELETED
package/binding.gyp
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2021 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A `.gyp` file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
20
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
21
|
-
{
|
|
22
|
-
# List of files to include in this file:
|
|
23
|
-
'includes': [
|
|
24
|
-
'./include.gypi',
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
28
|
-
'variables': {
|
|
29
|
-
# Target name should match the add-on export name:
|
|
30
|
-
'addon_target_name%': 'addon',
|
|
31
|
-
|
|
32
|
-
# Set variables based on the host OS:
|
|
33
|
-
'conditions': [
|
|
34
|
-
[
|
|
35
|
-
'OS=="win"',
|
|
36
|
-
{
|
|
37
|
-
# Define the object file suffix:
|
|
38
|
-
'obj': 'obj',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
# Define the object file suffix:
|
|
42
|
-
'obj': 'o',
|
|
43
|
-
}
|
|
44
|
-
], # end condition (OS=="win")
|
|
45
|
-
], # end conditions
|
|
46
|
-
}, # end variables
|
|
47
|
-
|
|
48
|
-
# Define compile targets:
|
|
49
|
-
'targets': [
|
|
50
|
-
|
|
51
|
-
# Target to generate an add-on:
|
|
52
|
-
{
|
|
53
|
-
# The target name should match the add-on export name:
|
|
54
|
-
'target_name': '<(addon_target_name)',
|
|
55
|
-
|
|
56
|
-
# Define dependencies:
|
|
57
|
-
'dependencies': [],
|
|
58
|
-
|
|
59
|
-
# Define directories which contain relevant include headers:
|
|
60
|
-
'include_dirs': [
|
|
61
|
-
# Local include directory:
|
|
62
|
-
'<@(include_dirs)',
|
|
63
|
-
],
|
|
64
|
-
|
|
65
|
-
# List of source files:
|
|
66
|
-
'sources': [
|
|
67
|
-
'<@(src_files)',
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
# Settings which should be applied when a target's object files are used as linker input:
|
|
71
|
-
'link_settings': {
|
|
72
|
-
# Define libraries:
|
|
73
|
-
'libraries': [
|
|
74
|
-
'<@(libraries)',
|
|
75
|
-
],
|
|
76
|
-
|
|
77
|
-
# Define library directories:
|
|
78
|
-
'library_dirs': [
|
|
79
|
-
'<@(library_dirs)',
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
# C/C++ compiler flags:
|
|
84
|
-
'cflags': [
|
|
85
|
-
# Enable commonly used warning options:
|
|
86
|
-
'-Wall',
|
|
87
|
-
|
|
88
|
-
# Aggressive optimization:
|
|
89
|
-
'-O3',
|
|
90
|
-
],
|
|
91
|
-
|
|
92
|
-
# C specific compiler flags:
|
|
93
|
-
'cflags_c': [
|
|
94
|
-
# Specify the C standard to which a program is expected to conform:
|
|
95
|
-
'-std=c99'
|
|
96
|
-
],
|
|
97
|
-
|
|
98
|
-
# C++ specific compiler flags:
|
|
99
|
-
'cflags_cpp': [
|
|
100
|
-
# Specify the C++ standard to which a program is expected to conform:
|
|
101
|
-
'-std=c++11'
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
# Linker flags:
|
|
105
|
-
'ldflags': [],
|
|
106
|
-
|
|
107
|
-
# Apply conditions based on the host OS:
|
|
108
|
-
'conditions': [
|
|
109
|
-
[
|
|
110
|
-
'OS=="mac"',
|
|
111
|
-
{
|
|
112
|
-
# Linker flags:
|
|
113
|
-
'ldflags': [
|
|
114
|
-
'-undefined dynamic_lookup',
|
|
115
|
-
'-Wl,-no-pie',
|
|
116
|
-
'-Wl,-search_paths_first',
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
], # end condition (OS=="mac")
|
|
120
|
-
[
|
|
121
|
-
'OS!="win"',
|
|
122
|
-
{
|
|
123
|
-
# C/C++ flags:
|
|
124
|
-
'cflags': [
|
|
125
|
-
# Generate platform-independent code:
|
|
126
|
-
'-fPIC',
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
], # end condition (OS!="win")
|
|
130
|
-
], # end conditions
|
|
131
|
-
}, # end target <(addon_target_name)
|
|
132
|
-
|
|
133
|
-
# Target to copy a generated add-on to a standard location:
|
|
134
|
-
{
|
|
135
|
-
'target_name': 'copy_addon',
|
|
136
|
-
|
|
137
|
-
# Declare that the output of this target is not linked:
|
|
138
|
-
'type': 'none',
|
|
139
|
-
|
|
140
|
-
# Define dependencies:
|
|
141
|
-
'dependencies': [
|
|
142
|
-
# Require that the add-on be generated before building this target:
|
|
143
|
-
'<(addon_target_name)',
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
-
# Define a list of actions:
|
|
147
|
-
'actions': [
|
|
148
|
-
{
|
|
149
|
-
'action_name': 'copy_addon',
|
|
150
|
-
'message': 'Copying addon...',
|
|
151
|
-
|
|
152
|
-
# Explicitly list the inputs in the command-line invocation below:
|
|
153
|
-
'inputs': [],
|
|
154
|
-
|
|
155
|
-
# Declare the expected outputs:
|
|
156
|
-
'outputs': [
|
|
157
|
-
'<(addon_output_dir)/<(addon_target_name).node',
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
# Define the command-line invocation:
|
|
161
|
-
'action': [
|
|
162
|
-
'cp',
|
|
163
|
-
'<(PRODUCT_DIR)/<(addon_target_name).node',
|
|
164
|
-
'<(addon_output_dir)/<(addon_target_name).node',
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
], # end actions
|
|
168
|
-
}, # end target copy_addon
|
|
169
|
-
], # end targets
|
|
170
|
-
}
|
package/lib/props.js
DELETED
|
@@ -1,68 +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
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
// MODULES //
|
|
22
|
-
|
|
23
|
-
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
24
|
-
var setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );
|
|
25
|
-
var dtypes2signatures = require( '@stdlib/ndarray-base-dtypes2signatures' );
|
|
26
|
-
var dtypes = require( './types.json' );
|
|
27
|
-
var meta = require( './meta.json' );
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// FUNCTIONS //
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Returns a list of array interface type signatures.
|
|
34
|
-
*
|
|
35
|
-
* @private
|
|
36
|
-
* @returns {StringArray} list of signatures
|
|
37
|
-
*/
|
|
38
|
-
function types() {
|
|
39
|
-
return dtypes2signatures( dtypes, meta.nin, meta.nout );
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// MAIN //
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Defines properties which expose function meta data.
|
|
47
|
-
*
|
|
48
|
-
* @private
|
|
49
|
-
* @param {Function} fcn - function on which to define properties
|
|
50
|
-
*/
|
|
51
|
-
function setProps( fcn ) {
|
|
52
|
-
// Define the number of input arguments:
|
|
53
|
-
setReadOnly( fcn, 'nargs', meta.nargs );
|
|
54
|
-
|
|
55
|
-
// Define the number of input arrays:
|
|
56
|
-
setReadOnly( fcn, 'nin', meta.nin );
|
|
57
|
-
|
|
58
|
-
// Define the number of output arrays:
|
|
59
|
-
setReadOnly( fcn, 'nout', meta.nout );
|
|
60
|
-
|
|
61
|
-
// Define a read-only accessor for listing a function's supported array data types:
|
|
62
|
-
setReadOnlyAccessor( fcn, 'types', types );
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// EXPORTS //
|
|
67
|
-
|
|
68
|
-
module.exports = setProps;
|