@stdlib/math-tools 0.2.2 → 0.3.1
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 +6 -6
- package/docs/types/index.d.ts +36 -28
- package/package.json +3 -3
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ The namespace exposes the following functions:
|
|
|
68
68
|
|
|
69
69
|
<div class="namespace-toc">
|
|
70
70
|
|
|
71
|
-
- <span class="signature">[`unary(
|
|
71
|
+
- <span class="signature">[`unary( fcn, idtypes, odtypes, policies )`][@stdlib/math/tools/unary]</span><span class="delimiter">: </span><span class="description">create a function which performs element-wise computation by applying a unary function to each element in an input ndarray.</span>
|
|
72
72
|
|
|
73
73
|
</div>
|
|
74
74
|
|
|
@@ -131,7 +131,7 @@ See [LICENSE][stdlib-license].
|
|
|
131
131
|
|
|
132
132
|
## Copyright
|
|
133
133
|
|
|
134
|
-
Copyright © 2016-
|
|
134
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
135
135
|
|
|
136
136
|
</section>
|
|
137
137
|
|
|
@@ -144,8 +144,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
144
144
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-tools.svg
|
|
145
145
|
[npm-url]: https://npmjs.org/package/@stdlib/math-tools
|
|
146
146
|
|
|
147
|
-
[test-image]: https://github.com/stdlib-js/math-tools/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
148
|
-
[test-url]: https://github.com/stdlib-js/math-tools/actions/workflows/test.yml?query=branch:v0.
|
|
147
|
+
[test-image]: https://github.com/stdlib-js/math-tools/actions/workflows/test.yml/badge.svg?branch=v0.3.1
|
|
148
|
+
[test-url]: https://github.com/stdlib-js/math-tools/actions/workflows/test.yml?query=branch:v0.3.1
|
|
149
149
|
|
|
150
150
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-tools/main.svg
|
|
151
151
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-tools?branch=main
|
|
@@ -157,8 +157,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
157
157
|
|
|
158
158
|
-->
|
|
159
159
|
|
|
160
|
-
[chat-image]: https://img.shields.io/
|
|
161
|
-
[chat-url]: https://
|
|
160
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
161
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
162
162
|
|
|
163
163
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
164
164
|
|
package/docs/types/index.d.ts
CHANGED
|
@@ -27,42 +27,50 @@ import unary = require( '@stdlib/math-tools-unary' );
|
|
|
27
27
|
*/
|
|
28
28
|
interface Namespace {
|
|
29
29
|
/**
|
|
30
|
-
* Returns a function which
|
|
30
|
+
* Returns a function which performs element-wise computation.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
35
|
-
* @
|
|
36
|
-
* @returns
|
|
32
|
+
* @param fcn - function applies a unary function to each element in an ndarray
|
|
33
|
+
* @param idtypes - list containing lists of supported input data types for each ndarray argument
|
|
34
|
+
* @param odtypes - list of supported output data types
|
|
35
|
+
* @param policies - dispatch policies
|
|
36
|
+
* @returns function which performs element-wise computation
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
|
-
* var
|
|
40
|
-
* var
|
|
41
|
-
* var
|
|
42
|
-
* var
|
|
43
|
-
* var
|
|
39
|
+
* var base = require( '@stdlib/math-base-special-abs' );
|
|
40
|
+
* var dispatch = require( '@stdlib/ndarray-dispatch' );
|
|
41
|
+
* var ndarrayUnary = require( '@stdlib/ndarray-base-unary' );
|
|
42
|
+
* var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
43
|
+
* var array = require( '@stdlib/ndarray-array' );
|
|
44
44
|
*
|
|
45
|
-
* var
|
|
46
|
-
* '
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
45
|
+
* var types = [
|
|
46
|
+
* 'float64', 'float64',
|
|
47
|
+
* 'float32', 'float32',
|
|
48
|
+
* 'generic', 'generic'
|
|
49
|
+
* ];
|
|
50
|
+
* var data = [
|
|
51
|
+
* base,
|
|
52
|
+
* base,
|
|
53
|
+
* base
|
|
54
|
+
* ];
|
|
55
|
+
* var dispatcher = dispatch( ndarrayUnary, types, data, 2, 1, 1 );
|
|
56
|
+
*
|
|
57
|
+
* var idt = [ 'float64', 'float32', 'generic' ];
|
|
58
|
+
* var odt = idt;
|
|
59
|
+
*
|
|
60
|
+
* var policies = {
|
|
61
|
+
* 'output': 'real_and_generic',
|
|
62
|
+
* 'casting': 'none'
|
|
59
63
|
* };
|
|
64
|
+
* var abs = ns.unary( dispatcher, [ idt ], odt, policies );
|
|
60
65
|
*
|
|
61
|
-
* var
|
|
66
|
+
* var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
67
|
+
* // returns <ndarray>
|
|
62
68
|
*
|
|
63
|
-
* var x = new Float64Array( [ -1.0, -2.0, -3.0 ] );
|
|
64
69
|
* var y = abs( x );
|
|
65
|
-
* // returns <
|
|
70
|
+
* // returns <ndarray>
|
|
71
|
+
*
|
|
72
|
+
* var arr = ndarray2array( y );
|
|
73
|
+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
66
74
|
*/
|
|
67
75
|
unary: typeof unary;
|
|
68
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Math tools.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/math-tools-unary": "^0.
|
|
34
|
-
"@stdlib/utils-define-read-only-property": "^0.2.
|
|
33
|
+
"@stdlib/math-tools-unary": "^0.3.0",
|
|
34
|
+
"@stdlib/utils-define-read-only-property": "^0.2.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {},
|
|
37
37
|
"engines": {
|