@stdlib/math-special-abs 0.2.1 → 0.3.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 +92 -87
- package/dist/index.js +8 -9
- package/dist/index.js.map +4 -4
- package/docs/types/index.d.ts +39 -114
- package/lib/{table.js → config.js} +27 -14
- package/lib/data.js +60 -47
- package/lib/index.js +3 -25
- package/lib/main.js +38 -5
- package/lib/native.js +38 -5
- package/lib/types.js +71 -63
- package/lib/types.json +1 -1
- package/manifest.json +45 -42
- package/package.json +22 -20
- package/src/addon.c +26 -53
- package/docs/img/equation_absolute_value.svg +0 -50
- package/include.gypi +0 -53
- package/lib/abs.js +0 -79
- package/lib/abs.native.js +0 -79
- package/lib/config.json +0 -3
- package/lib/meta.json +0 -5
- package/lib/table.native.js +0 -65
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -33,23 +33,12 @@ limitations under the License.
|
|
|
33
33
|
|
|
34
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
35
|
|
|
36
|
-
> Compute the [absolute value][
|
|
36
|
+
> Compute the [absolute value][@stdlib/math/base/special/abs] for each element in an [ndarray][@stdlib/ndarray/ctor].
|
|
37
37
|
|
|
38
38
|
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
39
39
|
|
|
40
40
|
<section class="intro">
|
|
41
41
|
|
|
42
|
-
The [absolute value][absolute-value] is defined as
|
|
43
|
-
|
|
44
|
-
<!-- <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"> -->
|
|
45
|
-
|
|
46
|
-
<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">
|
|
47
|
-
<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">
|
|
48
|
-
<br>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<!-- </equation> -->
|
|
52
|
-
|
|
53
42
|
</section>
|
|
54
43
|
|
|
55
44
|
<!-- /.intro -->
|
|
@@ -76,88 +65,115 @@ var abs = require( '@stdlib/math-special-abs' );
|
|
|
76
65
|
|
|
77
66
|
#### abs( x\[, options] )
|
|
78
67
|
|
|
79
|
-
Computes the [absolute value][
|
|
68
|
+
Computes the [absolute value][@stdlib/math/base/special/abs] for each element in an [ndarray][@stdlib/ndarray/ctor].
|
|
80
69
|
|
|
81
70
|
```javascript
|
|
82
|
-
var
|
|
83
|
-
|
|
71
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
72
|
+
var array = require( '@stdlib/ndarray-array' );
|
|
73
|
+
|
|
74
|
+
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
75
|
+
var y = abs( x );
|
|
76
|
+
// returns <ndarray>
|
|
77
|
+
|
|
78
|
+
var arr = ndarray2array( y );
|
|
79
|
+
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
84
80
|
```
|
|
85
81
|
|
|
86
82
|
The function accepts the following arguments:
|
|
87
83
|
|
|
88
|
-
- **x**: input [
|
|
89
|
-
- **options**: function options.
|
|
84
|
+
- **x**: input [ndarray][@stdlib/ndarray/ctor].
|
|
85
|
+
- **options**: function options (_optional_).
|
|
90
86
|
|
|
91
|
-
|
|
87
|
+
The function accepts the following options:
|
|
88
|
+
|
|
89
|
+
- **dtype**: output ndarray [data type][@stdlib/ndarray/dtypes]. Must be a real-valued or generic [data type][@stdlib/ndarray/dtypes].
|
|
90
|
+
- **order**: output ndarray [order][@stdlib/ndarray/orders] (i.e., memory layout).
|
|
91
|
+
|
|
92
|
+
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
|
|
92
93
|
|
|
93
94
|
```javascript
|
|
95
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
94
96
|
var array = require( '@stdlib/ndarray-array' );
|
|
97
|
+
var getDType = require( '@stdlib/ndarray-dtype' );
|
|
95
98
|
|
|
96
|
-
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
97
|
-
var y = abs( x
|
|
99
|
+
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
100
|
+
var y = abs( x, {
|
|
101
|
+
'dtype': 'generic'
|
|
102
|
+
});
|
|
98
103
|
// returns <ndarray>
|
|
99
104
|
|
|
100
|
-
var
|
|
101
|
-
// returns
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
If provided an array-like object, the function returns an array-like object having the same length and data type as `x`.
|
|
105
|
+
var dt = getDType( y );
|
|
106
|
+
// returns 'generic'
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var x = new Float64Array( [ -1.0, -2.0 ] );
|
|
110
|
-
var y = abs( x );
|
|
111
|
-
// returns <Float64Array>[ 1.0, 2.0 ]
|
|
112
|
-
|
|
113
|
-
x = [ -1.0, -2.0 ];
|
|
114
|
-
y = abs( x );
|
|
115
|
-
// returns [ 1.0, 2.0 ]
|
|
108
|
+
var arr = ndarray2array( y );
|
|
109
|
+
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
116
110
|
```
|
|
117
111
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- **dtype**: output array [data type][@stdlib/ndarray/dtypes]. Only applicable when `x` is either an [`ndarray`][@stdlib/ndarray/ctor] or array-like object. By default, the output array data type is inferred from the input array.
|
|
121
|
-
- **order**: output array [order][@stdlib/ndarray/orders]. Only applicable when `x` is an [`ndarray`][@stdlib/ndarray/ctor]. By default, the output array order is inferred from the input array.
|
|
122
|
-
|
|
123
|
-
By default, when provided either an [`ndarray`][@stdlib/ndarray/ctor] or an array-like object, the function returns an object of the same "kind" (either an [`ndarray`][@stdlib/ndarray/ctor] or array-like object, respectively) having the same underlying [data type][@stdlib/ndarray/dtypes]. To specify a different output array [data type][@stdlib/ndarray/dtypes], set the `dtype` option.
|
|
112
|
+
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having the same [order][@stdlib/ndarray/orders] as the input [ndarray][@stdlib/ndarray/ctor]. To return an [ndarray][@stdlib/ndarray/ctor] having a specific memory layout irrespective of the memory layout of the input [ndarray][@stdlib/ndarray/ctor], set the `order` option.
|
|
124
113
|
|
|
125
114
|
```javascript
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
var y = abs( x );
|
|
130
|
-
// returns <Float32Array>[ 1.0, 2.0 ]
|
|
115
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
116
|
+
var array = require( '@stdlib/ndarray-array' );
|
|
117
|
+
var getOrder = require( '@stdlib/ndarray-order' );
|
|
131
118
|
|
|
132
|
-
x =
|
|
133
|
-
y = abs( x, {
|
|
134
|
-
'
|
|
119
|
+
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
120
|
+
var y = abs( x, {
|
|
121
|
+
'order': 'column-major'
|
|
135
122
|
});
|
|
136
|
-
// returns <
|
|
123
|
+
// returns <ndarray>
|
|
124
|
+
|
|
125
|
+
var ord = getOrder( y );
|
|
126
|
+
// returns 'column-major'
|
|
127
|
+
|
|
128
|
+
var arr = ndarray2array( y );
|
|
129
|
+
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
137
130
|
```
|
|
138
131
|
|
|
139
132
|
#### abs.assign( x, y )
|
|
140
133
|
|
|
141
|
-
Computes the [absolute value][
|
|
134
|
+
Computes the [absolute value][@stdlib/math/base/special/abs] for each element in an [ndarray][@stdlib/ndarray/ctor] and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
|
|
142
135
|
|
|
143
136
|
```javascript
|
|
137
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
144
138
|
var array = require( '@stdlib/ndarray-array' );
|
|
145
139
|
|
|
146
|
-
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
147
|
-
var y = array( [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] );
|
|
140
|
+
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
141
|
+
var y = array( [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] );
|
|
142
|
+
|
|
148
143
|
var out = abs.assign( x, y );
|
|
149
144
|
// returns <ndarray>
|
|
150
145
|
|
|
151
146
|
var bool = ( out === y );
|
|
152
147
|
// returns true
|
|
153
148
|
|
|
154
|
-
var
|
|
155
|
-
// returns 2.0
|
|
149
|
+
var arr = ndarray2array( out );
|
|
150
|
+
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
156
151
|
```
|
|
157
152
|
|
|
158
|
-
The
|
|
153
|
+
The function accepts the following arguments:
|
|
154
|
+
|
|
155
|
+
- **x**: input [ndarray][@stdlib/ndarray/ctor]. Must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape of the output [ndarray][@stdlib/ndarray/ctor].
|
|
156
|
+
- **y**: output [ndarray][@stdlib/ndarray/ctor].
|
|
157
|
+
|
|
158
|
+
The function supports broadcasting an input [ndarray][@stdlib/ndarray/ctor] to the shape of the output [ndarray][@stdlib/ndarray/ctor] without performing a physical copy of the input [ndarray][@stdlib/ndarray/ctor]'s underlying data.
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
162
|
+
var zeros = require( '@stdlib/ndarray-zeros' );
|
|
163
|
+
var array = require( '@stdlib/ndarray-array' );
|
|
164
|
+
|
|
165
|
+
// Create a 2x2 input ndarray:
|
|
166
|
+
var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
159
167
|
|
|
160
|
-
|
|
168
|
+
// Create a 2x2x2 output ndarray:
|
|
169
|
+
var y = zeros( [ 2, 2, 2 ] );
|
|
170
|
+
|
|
171
|
+
var out = abs.assign( x, y );
|
|
172
|
+
// returns <ndarray>
|
|
173
|
+
|
|
174
|
+
var arr = ndarray2array( out );
|
|
175
|
+
// returns [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ]
|
|
176
|
+
```
|
|
161
177
|
|
|
162
178
|
</section>
|
|
163
179
|
|
|
@@ -167,6 +183,10 @@ TODO: broadcasting discussion and example(s).
|
|
|
167
183
|
|
|
168
184
|
<section class="notes">
|
|
169
185
|
|
|
186
|
+
## Notes
|
|
187
|
+
|
|
188
|
+
- The output data type [policy][@stdlib/ndarray/output-dtype-policies] only applies to the main function and specifies that, by default, the function must return an [ndarray][@stdlib/ndarray/ctor] having a real-valued or "generic" [data type][@stdlib/ndarray/dtypes]. For the `assign` method, the output [ndarray][@stdlib/ndarray/ctor] is allowed to have any supported output [data type][@stdlib/ndarray/dtypes].
|
|
189
|
+
|
|
170
190
|
</section>
|
|
171
191
|
|
|
172
192
|
<!-- /.notes -->
|
|
@@ -180,34 +200,15 @@ TODO: broadcasting discussion and example(s).
|
|
|
180
200
|
<!-- eslint no-undef: "error" -->
|
|
181
201
|
|
|
182
202
|
```javascript
|
|
183
|
-
var
|
|
184
|
-
var
|
|
185
|
-
var ind2sub = require( '@stdlib/ndarray-ind2sub' );
|
|
203
|
+
var uniform = require( '@stdlib/random-uniform' );
|
|
204
|
+
var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
186
205
|
var abs = require( '@stdlib/math-special-abs' );
|
|
187
206
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
console.log( 'x = %d => abs(x) = %d', -1.0, v );
|
|
207
|
+
var x = uniform( [ 5, 5 ], -10.0, 10.0 );
|
|
208
|
+
console.log( ndarray2array( x ) );
|
|
191
209
|
|
|
192
|
-
// Provide an array-like object...
|
|
193
|
-
var x = new Float64Array( [ -1.0, -2.0, -3.0 ] );
|
|
194
210
|
var y = abs( x );
|
|
195
|
-
|
|
196
|
-
var i;
|
|
197
|
-
for ( i = 0; i < x.length; i++ ) {
|
|
198
|
-
console.log( 'x_%d = %d => abs(x_%d) = %d', i, x[ i ], i, y[ i ] );
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Provide an ndarray...
|
|
202
|
-
x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
203
|
-
y = abs( x );
|
|
204
|
-
|
|
205
|
-
var sh = x.shape;
|
|
206
|
-
var sub;
|
|
207
|
-
for ( i = 0; i < x.length; i++ ) {
|
|
208
|
-
sub = ind2sub( sh, i );
|
|
209
|
-
console.log( 'x_%d%d = %d => abs(x_%d%d) = %d', sub[ 0 ], sub[ 1 ], x.iget( i ), sub[ 0 ], sub[ 1 ], y.iget( i ) );
|
|
210
|
-
}
|
|
211
|
+
console.log( ndarray2array( y ) );
|
|
211
212
|
```
|
|
212
213
|
|
|
213
214
|
</section>
|
|
@@ -256,7 +257,7 @@ See [LICENSE][stdlib-license].
|
|
|
256
257
|
|
|
257
258
|
## Copyright
|
|
258
259
|
|
|
259
|
-
Copyright © 2016-
|
|
260
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
260
261
|
|
|
261
262
|
</section>
|
|
262
263
|
|
|
@@ -269,8 +270,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
269
270
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-special-abs.svg
|
|
270
271
|
[npm-url]: https://npmjs.org/package/@stdlib/math-special-abs
|
|
271
272
|
|
|
272
|
-
[test-image]: https://github.com/stdlib-js/math-special-abs/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
273
|
-
[test-url]: https://github.com/stdlib-js/math-special-abs/actions/workflows/test.yml?query=branch:v0.
|
|
273
|
+
[test-image]: https://github.com/stdlib-js/math-special-abs/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
274
|
+
[test-url]: https://github.com/stdlib-js/math-special-abs/actions/workflows/test.yml?query=branch:v0.3.0
|
|
274
275
|
|
|
275
276
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-special-abs/main.svg
|
|
276
277
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-special-abs?branch=main
|
|
@@ -282,8 +283,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
282
283
|
|
|
283
284
|
-->
|
|
284
285
|
|
|
285
|
-
[chat-image]: https://img.shields.io/
|
|
286
|
-
[chat-url]: https://
|
|
286
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
287
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
287
288
|
|
|
288
289
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
289
290
|
|
|
@@ -302,7 +303,7 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
302
303
|
|
|
303
304
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-special-abs/main/LICENSE
|
|
304
305
|
|
|
305
|
-
[
|
|
306
|
+
[@stdlib/math/base/special/abs]: https://www.npmjs.com/package/@stdlib/math-base-special-abs
|
|
306
307
|
|
|
307
308
|
[@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
|
|
308
309
|
|
|
@@ -310,6 +311,10 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
310
311
|
|
|
311
312
|
[@stdlib/ndarray/dtypes]: https://www.npmjs.com/package/@stdlib/ndarray-dtypes
|
|
312
313
|
|
|
314
|
+
[@stdlib/ndarray/output-dtype-policies]: https://www.npmjs.com/package/@stdlib/ndarray-output-dtype-policies
|
|
315
|
+
|
|
316
|
+
[@stdlib/ndarray/base/broadcast-shapes]: https://www.npmjs.com/package/@stdlib/ndarray-base-broadcast-shapes
|
|
317
|
+
|
|
313
318
|
</section>
|
|
314
319
|
|
|
315
320
|
<!-- /.links -->
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
var
|
|
3
|
-
});var y=
|
|
4
|
-
var
|
|
5
|
-
});var
|
|
6
|
-
var
|
|
7
|
-
});var
|
|
8
|
-
|
|
9
|
-
});var L=require("path").join,M=require('@stdlib/utils-try-require/dist'),N=_(),o,h=M(L(__dirname,"./native.js"));h instanceof Error?o=N:o=h;module.exports=o;
|
|
1
|
+
"use strict";var n=function(x,s){return function(){return s||x((s={exports:{}}).exports,s),s.exports}};var d=n(function(G,p){
|
|
2
|
+
var t=require('@stdlib/math-base-special-abs/dist'),U=require('@stdlib/math-base-special-absf/dist'),r=require('@stdlib/math-base-special-labs/dist'),u=require('@stdlib/math-base-special-cabs/dist'),h=require('@stdlib/math-base-special-cabsf/dist'),v=require('@stdlib/number-uint32-base-identity/dist'),a=require('@stdlib/number-uint16-base-identity/dist'),e=require('@stdlib/number-uint8-base-identity/dist'),E=[t,t,U,t,t,t,u,u,h,u,u,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,v,v,v,a,a,a,a,a,a,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e];p.exports=E
|
|
3
|
+
});var y=n(function(H,P){P.exports=[12,12,12,17,11,11,11,12,11,17,17,17,15,12,15,17,14,11,14,12,14,17,6,6,6,7,6,12,6,17,4,4,4,6,4,5,4,7,4,11,4,12,4,17,1,1,1,4,1,6,1,2,1,3,1,5,1,7,1,11,1,12,1,17,7,7,7,12,7,17,5,6,5,5,5,7,5,11,5,12,5,17,2,4,2,6,2,2,2,3,2,5,2,7,2,11,2,12,2,17,3,4,3,6,3,2,3,3,3,5,3,7,3,11,3,12,3,17]});var f=n(function(I,_){
|
|
4
|
+
var g=require('@stdlib/ndarray-dtypes/dist'),R={nargs:2,nin:1,nout:1,idtypes:g("numeric_and_generic"),odtypes:g("real_and_generic"),policies:{output:"real_and_generic",casting:"none"}};_.exports=R
|
|
5
|
+
});var j=n(function(J,l){
|
|
6
|
+
var k=require('@stdlib/ndarray-dispatch/dist'),b=require('@stdlib/ndarray-base-meta-data-props/dist'),w=require('@stdlib/math-tools-unary/dist'),z=require('@stdlib/ndarray-base-unary/dist'),A=d(),q=y(),i=f(),c=w(k(z,q,A,i.nargs,i.nin,i.nout),[i.idtypes],i.odtypes,i.policies);b(i,q,c);b(i,q,c.assign);l.exports=c
|
|
7
|
+
});var B=require("path").join,C=require('@stdlib/utils-try-require/dist'),D=j(),o,m=C(B(__dirname,"./native.js"));m instanceof Error?o=D:o=m;module.exports=o;
|
|
8
|
+
/** @license Apache-2.0 */
|
|
10
9
|
/** @license Apache-2.0 */
|
|
11
10
|
/** @license Apache-2.0 */
|
|
12
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../lib/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../lib/data.js", "../lib/types.json", "../lib/config.js", "../lib/main.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/* eslint-disable stdlib/capitalized-comments */\n\n'use strict';\n\n// MODULES //\n\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar absf = require( '@stdlib/math-base-special-absf' );\nvar labs = require( '@stdlib/math-base-special-labs' );\nvar cabs = require( '@stdlib/math-base-special-cabs' );\nvar cabsf = require( '@stdlib/math-base-special-cabsf' );\nvar identityUint32 = require( '@stdlib/number-uint32-base-identity' );\nvar identityUint16 = require( '@stdlib/number-uint16-base-identity' );\nvar identityUint8 = require( '@stdlib/number-uint8-base-identity' );\n\n\n// MAIN //\n\nvar data = [\n\t// NOTE: the following **must** match the order in `./types.json`. The order should be according to likelihood of use (e.g., if `float64` arrays are more likely, then `float64` types/data should come before `uint8`).\n\n\t// float64\n\tabs,\n\tabs,\n\n\t// float32\n\tabsf,\n\tabs,\n\tabs,\n\n\t// generic\n\tabs,\n\n\t// complex128\n\tcabs,\n\tcabs,\n\n\t// complex64\n\tcabsf,\n\tcabs,\n\tcabs,\n\n\t// int32\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\n\t// int16\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\n\t// int8\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\tlabs,\n\n\t// uint32\n\tidentityUint32,\n\tidentityUint32,\n\tidentityUint32,\n\n\t// uint16\n\tidentityUint16,\n\tidentityUint16,\n\tidentityUint16,\n\tidentityUint16,\n\tidentityUint16,\n\tidentityUint16,\n\n\t// uint8\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\n\t// uint8c\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8,\n\tidentityUint8\n];\n\n\n// EXPORTS //\n\nmodule.exports = data;\n", "[12,12,12,17,11,11,11,12,11,17,17,17,15,12,15,17,14,11,14,12,14,17,6,6,6,7,6,12,6,17,4,4,4,6,4,5,4,7,4,11,4,12,4,17,1,1,1,4,1,6,1,2,1,3,1,5,1,7,1,11,1,12,1,17,7,7,7,12,7,17,5,6,5,5,5,7,5,11,5,12,5,17,2,4,2,6,2,2,2,3,2,5,2,7,2,11,2,12,2,17,3,4,3,6,3,2,3,3,3,5,3,7,3,11,3,12,3,17]\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 dtypes = require( '@stdlib/ndarray-dtypes' );\n\n\n// MAIN //\n\nvar config = {\n\t// Total number of ndarray arguments:\n\t'nargs': 2,\n\n\t// Number of input ndarray arguments:\n\t'nin': 1,\n\n\t// Number of output ndarray arguments:\n\t'nout': 1,\n\n\t// List of supported input ndarray data types:\n\t'idtypes': dtypes( 'numeric_and_generic' ),\n\n\t// List of supported output ndarray data types:\n\t'odtypes': dtypes( 'real_and_generic' ),\n\n\t// Dispatch policies:\n\t'policies': {\n\t\t// Output data type policy:\n\t\t'output': 'real_and_generic',\n\n\t\t// Input ndarray casting policy:\n\t\t'casting': 'none'\n\t}\n};\n\n\n// EXPORTS //\n\nmodule.exports = config;\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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar dispatch = require( '@stdlib/ndarray-dispatch' );\nvar setProps = require( '@stdlib/ndarray-base-meta-data-props' );\nvar ufunc = require( '@stdlib/math-tools-unary' );\nvar unary = require( '@stdlib/ndarray-base-unary' );\nvar data = require( './data.js' );\nvar types = require( './types.json' );\nvar config = require( './config.js' );\n\n\n// MAIN //\n\n/**\n* Computes the absolute value for each element in an ndarray.\n*\n* @name abs\n* @type {Function}\n* @param {ndarray} x - input ndarray\n* @param {Options} [options] - options\n* @param {string} [options.order] - output array order\n* @param {*} [options.dtype] - output array dtype\n* @throws {TypeError} first argument must be an ndarray-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ndarray} output ndarray\n*\n* @example\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var x = array( [ [ 1.0, -2.0 ], [ -3.0, 4.0 ] ] );\n* // returns <ndarray>\n*\n* var y = abs( x );\n* // returns <ndarray>\n*\n* var arr = ndarray2array( y );\n* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]\n*/\nvar abs = ufunc( dispatch( unary, types, data, config.nargs, config.nin, config.nout ), [ config.idtypes ], config.odtypes, config.policies );\nsetProps( config, types, abs );\nsetProps( config, types, abs.assign );\n\n\n// EXPORTS //\n\nmodule.exports = abs;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the absolute value.\n*\n* @module @stdlib/math-special-abs\n*\n* @example\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n* var array = require( '@stdlib/ndarray-array' );\n* var abs = require( '@stdlib/math-special-abs' );\n*\n* var x = array( [ [ 1.0, -2.0 ], [ -3.0, 4.0 ] ] );\n* // returns <ndarray>\n*\n* var y = abs( x );\n* // returns <ndarray>\n*\n* var arr = ndarray2array( y );\n* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar javascript = require( './main.js' );\n\n\n// MAIN //\n\nvar main;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( tmp instanceof Error ) {\n\tmain = javascript;\n} else {\n\tmain = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"assign\": \"main.assign\" }\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_data", "__commonJSMin", "exports", "module", "abs", "absf", "labs", "cabs", "cabsf", "identityUint32", "identityUint16", "identityUint8", "data", "require_types", "__commonJSMin", "exports", "module", "require_config", "__commonJSMin", "exports", "module", "dtypes", "config", "require_main", "__commonJSMin", "exports", "module", "dispatch", "setProps", "ufunc", "unary", "data", "types", "config", "abs", "join", "tryRequire", "javascript", "main", "tmp"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -20,28 +20,33 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
23
|
+
import { typedndarray, realcomplexndarray, realndarray, genericndarray, RealAndGenericDataType as DataType, Order } from '@stdlib/types/ndarray';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Input array.
|
|
27
|
+
*/
|
|
28
|
+
type InputArray = realcomplexndarray | genericndarray<number>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Output array.
|
|
32
|
+
*/
|
|
33
|
+
type OutputArray = realndarray | genericndarray<number>;
|
|
25
34
|
|
|
26
35
|
/**
|
|
27
36
|
* Interface describing options.
|
|
28
37
|
*/
|
|
29
38
|
interface Options {
|
|
30
39
|
/**
|
|
31
|
-
* Output array order
|
|
40
|
+
* Output array order.
|
|
32
41
|
*
|
|
33
42
|
* ## Notes
|
|
34
43
|
*
|
|
35
|
-
* - By default, the output array
|
|
44
|
+
* - By default, the order of the output array is the same as the input array.
|
|
36
45
|
*/
|
|
37
46
|
order?: Order;
|
|
38
47
|
|
|
39
48
|
/**
|
|
40
49
|
* Output array data type.
|
|
41
|
-
*
|
|
42
|
-
* ## Notes
|
|
43
|
-
*
|
|
44
|
-
* - By default, the output array data type is inferred from the input array.
|
|
45
50
|
*/
|
|
46
51
|
dtype?: DataType;
|
|
47
52
|
}
|
|
@@ -51,67 +56,36 @@ interface Options {
|
|
|
51
56
|
*/
|
|
52
57
|
interface UnaryFunction {
|
|
53
58
|
/**
|
|
54
|
-
* Computes the absolute value.
|
|
55
|
-
*
|
|
56
|
-
* @param x - input value
|
|
57
|
-
* @returns result
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* var y = abs( -1.0 );
|
|
61
|
-
* // returns 1.0
|
|
62
|
-
*/
|
|
63
|
-
( x: number ): number;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Computes the absolute value.
|
|
59
|
+
* Computes the absolute value for each element in an ndarray.
|
|
67
60
|
*
|
|
68
|
-
* @param x - input
|
|
61
|
+
* @param x - input ndarray
|
|
69
62
|
* @param options - options
|
|
70
|
-
* @returns
|
|
63
|
+
* @returns output ndarray
|
|
71
64
|
*
|
|
72
65
|
* @example
|
|
66
|
+
* var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
73
67
|
* var array = require( '@stdlib/ndarray-array' );
|
|
74
68
|
*
|
|
75
|
-
* var x = array( [ [
|
|
76
|
-
*
|
|
77
|
-
* var y = abs( x );
|
|
69
|
+
* var x = array( [ [ 1.0, -2.0 ], [ -3.0, 4.0 ] ] );
|
|
78
70
|
* // returns <ndarray>
|
|
79
71
|
*
|
|
80
|
-
* var v = y.get( 0, 1 );
|
|
81
|
-
* // returns 2.0
|
|
82
|
-
*/
|
|
83
|
-
( x: ndarray, options?: Options ): ndarray;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Computes the absolute value.
|
|
87
|
-
*
|
|
88
|
-
* @param x - input array
|
|
89
|
-
* @returns result
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* var Float64Array = require( '@stdlib/array-float64' );
|
|
93
|
-
*
|
|
94
|
-
* var x = new Float64Array( [ -1.0, -2.0 ] );
|
|
95
|
-
*
|
|
96
72
|
* var y = abs( x );
|
|
97
|
-
* // returns <
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* var x = [ -1.0, -2.0 ];
|
|
73
|
+
* // returns <ndarray>
|
|
101
74
|
*
|
|
102
|
-
* var
|
|
103
|
-
* // returns [ 1.0, 2.0 ]
|
|
75
|
+
* var arr = ndarray2array( y );
|
|
76
|
+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
104
77
|
*/
|
|
105
|
-
( x:
|
|
78
|
+
( x: InputArray, options?: Options ): typedndarray<number>; // FIXME: we lose type specificity here, as the output ndarray data type is determined according to the output data type policy in conjunction with the `dtype` option
|
|
106
79
|
|
|
107
80
|
/**
|
|
108
|
-
* Computes the absolute value and assigns results to a provided output
|
|
81
|
+
* Computes the absolute value for each element in an ndarray and assigns results to a provided output ndarray.
|
|
109
82
|
*
|
|
110
|
-
* @param x - input
|
|
111
|
-
* @param y - output
|
|
112
|
-
* @returns output
|
|
83
|
+
* @param x - input ndarray
|
|
84
|
+
* @param y - output ndarray
|
|
85
|
+
* @returns output ndarray
|
|
113
86
|
*
|
|
114
87
|
* @example
|
|
88
|
+
* var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
115
89
|
* var array = require( '@stdlib/ndarray-array' );
|
|
116
90
|
*
|
|
117
91
|
* var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
@@ -123,45 +97,21 @@ interface UnaryFunction {
|
|
|
123
97
|
* var bool = ( z === y );
|
|
124
98
|
* // returns true
|
|
125
99
|
*
|
|
126
|
-
* var
|
|
127
|
-
* // returns 2.0
|
|
100
|
+
* var arr = ndarray2array( y );
|
|
101
|
+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
128
102
|
*/
|
|
129
|
-
assign( x:
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Computes the absolute value and assigns results to a provided output array.
|
|
133
|
-
*
|
|
134
|
-
* @param x - input array
|
|
135
|
-
* @param y - output array
|
|
136
|
-
* @returns output array
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* var Float64Array = require( '@stdlib/array-float64' );
|
|
140
|
-
*
|
|
141
|
-
* var x = new Float64Array( [ -1.0, -2.0 ] );
|
|
142
|
-
* var y = new Float64Array( x.length );
|
|
143
|
-
*
|
|
144
|
-
* var z = abs.assign( x, y );
|
|
145
|
-
* // returns <Float64Array>[ 1.0, 2.0 ]
|
|
146
|
-
*
|
|
147
|
-
* var bool = ( z === y );
|
|
148
|
-
* // returns true
|
|
149
|
-
*/
|
|
150
|
-
assign( x: ArrayLike<number>, y: ArrayLike<number> ): ArrayLike<number>;
|
|
103
|
+
assign<T extends OutputArray = OutputArray>( x: InputArray, y: T ): T;
|
|
151
104
|
}
|
|
152
105
|
|
|
153
106
|
/**
|
|
154
|
-
* Computes the absolute value.
|
|
107
|
+
* Computes the absolute value for each element in an ndarray.
|
|
155
108
|
*
|
|
156
|
-
* @param x - input
|
|
109
|
+
* @param x - input ndarray
|
|
157
110
|
* @param options - options
|
|
158
|
-
* @returns
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* var y = abs( -1.0 );
|
|
162
|
-
* // returns 1.0
|
|
111
|
+
* @returns output ndarray
|
|
163
112
|
*
|
|
164
113
|
* @example
|
|
114
|
+
* var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
165
115
|
* var array = require( '@stdlib/ndarray-array' );
|
|
166
116
|
*
|
|
167
117
|
* var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
@@ -169,24 +119,11 @@ interface UnaryFunction {
|
|
|
169
119
|
* var y = abs( x );
|
|
170
120
|
* // returns <ndarray>
|
|
171
121
|
*
|
|
172
|
-
* var
|
|
173
|
-
* // returns 2.0
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* var Float64Array = require( '@stdlib/array-float64' );
|
|
177
|
-
*
|
|
178
|
-
* var x = new Float64Array( [ -1.0, -2.0 ] );
|
|
179
|
-
*
|
|
180
|
-
* var y = abs( x );
|
|
181
|
-
* // returns <Float64Array>[ 1.0, 2.0 ]
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* var x = [ -1.0, -2.0 ];
|
|
185
|
-
*
|
|
186
|
-
* var y = abs( x );
|
|
187
|
-
* // returns [ 1.0, 2.0 ]
|
|
122
|
+
* var arr = ndarray2array( y );
|
|
123
|
+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
188
124
|
*
|
|
189
125
|
* @example
|
|
126
|
+
* var ndarray2array = require( '@stdlib/ndarray-to-array' );
|
|
190
127
|
* var array = require( '@stdlib/ndarray-array' );
|
|
191
128
|
*
|
|
192
129
|
* var x = array( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
|
|
@@ -198,20 +135,8 @@ interface UnaryFunction {
|
|
|
198
135
|
* var bool = ( z === y );
|
|
199
136
|
* // returns true
|
|
200
137
|
*
|
|
201
|
-
* var
|
|
202
|
-
* // returns 2.0
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* var Float64Array = require( '@stdlib/array-float64' );
|
|
206
|
-
*
|
|
207
|
-
* var x = new Float64Array( [ -1.0, -2.0 ] );
|
|
208
|
-
* var y = new Float64Array( x.length );
|
|
209
|
-
*
|
|
210
|
-
* var z = abs.assign( x, y );
|
|
211
|
-
* // returns <Float64Array>[ 1.0, 2.0 ]
|
|
212
|
-
*
|
|
213
|
-
* var bool = ( z === y );
|
|
214
|
-
* // returns true
|
|
138
|
+
* var arr = ndarray2array( y );
|
|
139
|
+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
|
|
215
140
|
*/
|
|
216
141
|
declare var abs: UnaryFunction;
|
|
217
142
|
|