@stdlib/math-special-abs 0.0.5 → 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/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.5",
3
+ "version": "0.1.0",
4
4
  "description": "Compute the absolute value.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -21,6 +21,7 @@
21
21
  "doc": "./docs",
22
22
  "example": "./examples",
23
23
  "lib": "./lib",
24
+ "scripts": "./scripts",
24
25
  "src": "./src",
25
26
  "test": "./test"
26
27
  },
@@ -40,45 +41,44 @@
40
41
  "url": "https://github.com/stdlib-js/stdlib/issues"
41
42
  },
42
43
  "dependencies": {
43
- "@stdlib/math-base-special-abs": "^0.0.x",
44
- "@stdlib/math-base-special-absf": "^0.0.x",
45
- "@stdlib/math-base-special-identity": "^0.0.x",
46
- "@stdlib/math-base-special-labs": "^0.0.x",
47
- "@stdlib/math-strided-special-abs": "^0.0.x",
48
- "@stdlib/math-tools-unary": "^0.0.x",
49
- "@stdlib/ndarray-base-dtypes2signatures": "^0.0.x",
50
- "@stdlib/ndarray-base-function-object": "^0.0.x",
51
- "@stdlib/ndarray-base-napi-unary": "^0.0.x",
52
- "@stdlib/ndarray-base-unary": "^0.0.x",
53
- "@stdlib/ndarray-dispatch": "^0.0.x",
54
- "@stdlib/ndarray-dtypes": "^0.0.x",
55
- "@stdlib/types": "^0.0.x",
56
- "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.0.x",
57
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
58
- "@stdlib/utils-library-manifest": "^0.0.x",
59
- "@stdlib/utils-try-require": "^0.0.x"
44
+ "@stdlib/math-base-special-abs": "^0.1.0",
45
+ "@stdlib/math-base-special-absf": "^0.1.0",
46
+ "@stdlib/math-base-special-identity": "^0.1.0",
47
+ "@stdlib/math-base-special-labs": "^0.1.0",
48
+ "@stdlib/math-strided-special-abs": "^0.1.0",
49
+ "@stdlib/math-tools-unary": "^0.1.0",
50
+ "@stdlib/ndarray-base-function-object": "^0.1.0",
51
+ "@stdlib/ndarray-base-meta-data-props": "^0.1.0",
52
+ "@stdlib/ndarray-base-napi-unary": "^0.1.0",
53
+ "@stdlib/ndarray-base-unary": "^0.1.0",
54
+ "@stdlib/ndarray-dispatch": "^0.1.0",
55
+ "@stdlib/ndarray-dtypes": "^0.1.0",
56
+ "@stdlib/types": "^0.1.0",
57
+ "@stdlib/utils-library-manifest": "^0.1.0",
58
+ "@stdlib/utils-try-require": "^0.1.0"
60
59
  },
61
60
  "devDependencies": {
62
- "@stdlib/array-float32": "^0.0.x",
63
- "@stdlib/array-float64": "^0.0.x",
64
- "@stdlib/assert-has-property": "^0.0.x",
65
- "@stdlib/assert-is-browser": "^0.0.x",
66
- "@stdlib/assert-is-typed-array-like": "^0.0.x",
67
- "@stdlib/bench": "^0.0.x",
68
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
69
- "@stdlib/math-base-special-pow": "^0.0.x",
70
- "@stdlib/ndarray-array": "^0.0.x",
71
- "@stdlib/ndarray-base-ctor": "^0.0.x",
72
- "@stdlib/ndarray-base-serialize-meta-data": "^0.0.x",
73
- "@stdlib/ndarray-base-shape2strides": "^0.0.x",
74
- "@stdlib/ndarray-ctor": "^0.0.x",
75
- "@stdlib/ndarray-ind2sub": "^0.0.x",
76
- "@stdlib/random-base-uniform": "^0.0.x",
77
- "@stdlib/utils-copy": "^0.0.x",
61
+ "@stdlib/array-float32": "^0.1.0",
62
+ "@stdlib/array-float64": "^0.1.0",
63
+ "@stdlib/assert-has-property": "^0.1.0",
64
+ "@stdlib/assert-is-browser": "^0.1.0",
65
+ "@stdlib/assert-is-typed-array-like": "^0.1.0",
66
+ "@stdlib/bench": "^0.1.0",
67
+ "@stdlib/fs-write-file": "^0.1.0",
68
+ "@stdlib/math-base-assert-is-nan": "^0.1.0",
69
+ "@stdlib/math-base-special-pow": "^0.1.0",
70
+ "@stdlib/ndarray-array": "^0.0.9",
71
+ "@stdlib/ndarray-base-ctor": "^0.1.0",
72
+ "@stdlib/ndarray-base-dtypes2signatures": "^0.1.0",
73
+ "@stdlib/ndarray-base-serialize-meta-data": "^0.1.0",
74
+ "@stdlib/ndarray-base-shape2strides": "^0.1.0",
75
+ "@stdlib/ndarray-ctor": "^0.1.0",
76
+ "@stdlib/ndarray-ind2sub": "^0.1.0",
77
+ "@stdlib/random-base-uniform": "^0.0.6",
78
78
  "proxyquire": "^2.0.0",
79
79
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
80
80
  "istanbul": "^0.4.1",
81
- "tap-spec": "5.x.x"
81
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
82
82
  },
83
83
  "engines": {
84
84
  "node": ">=0.10.0",
@@ -111,7 +111,7 @@
111
111
  ],
112
112
  "__stdlib__": {},
113
113
  "funding": {
114
- "type": "patreon",
115
- "url": "https://www.patreon.com/athan"
114
+ "type": "opencollective",
115
+ "url": "https://opencollective.com/stdlib"
116
116
  }
117
117
  }
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 (8)
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 (8)
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 (7)
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 (8)
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 (7)
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
- 34,
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/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/docs/repl.txt DELETED
@@ -1,108 +0,0 @@
1
-
2
- {{alias}}( x[, options] )
3
- Computes the absolute value.
4
-
5
- If provided a number, the function returns a number.
6
-
7
- If provided an ndarray or array-like object, the function performs element-
8
- wise computation.
9
-
10
- If provided an array-like object, the function returns an array-like object
11
- having the same length and data type as `x`.
12
-
13
- If provided an ndarray, the function returns an ndarray having the same
14
- shape and data type as `x`.
15
-
16
- Parameters
17
- ----------
18
- x: ndarray|ArrayLikeObject|number
19
- Input value.
20
-
21
- options: Object (optional)
22
- Options.
23
-
24
- options.order: string (optional)
25
- Output array order (either row-major (C-style) or column-major (Fortran-
26
- style)). Only applicable when the input array is an ndarray. By default,
27
- the output array order is inferred from the input array.
28
-
29
- options.dtype: string (optional)
30
- Output array data type. Only applicable when the input array is either
31
- an ndarray or array-like object. By default, the output array data type
32
- is inferred from the input array.
33
-
34
- Returns
35
- -------
36
- y: ndarray|ArrayLikeObject|number
37
- Results.
38
-
39
- Examples
40
- --------
41
- // Provide a number:
42
- > var y = {{alias}}( -1.0 )
43
- 1.0
44
-
45
- // Provide an array-like object:
46
- > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0 ] );
47
- > y = {{alias}}( x )
48
- <Float64Array>[ 1.0, 2.0 ]
49
-
50
- > x = [ -1.0, -2.0 ];
51
- > y = {{alias}}( x )
52
- [ 1.0, 2.0 ]
53
-
54
- // Provide an ndarray:
55
- > x = {{alias:@stdlib/ndarray/array}}( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
56
- > y = {{alias}}( x )
57
- <ndarray>
58
- > y.get( 0, 1 )
59
- 2.0
60
-
61
-
62
- {{alias}}.assign( x, y )
63
- Computes the absolute value and assigns results to a provided output array.
64
-
65
- Parameters
66
- ----------
67
- x: ndarray|ArrayLikeObject
68
- Input array.
69
-
70
- y: ndarray|ArrayLikeObject
71
- Output array. Must be the same data "kind" (i.e., ndarray or array-like
72
- object) as the input array.
73
-
74
- Returns
75
- -------
76
- y: ndarray|ArrayLikeObject
77
- Output array.
78
-
79
- Examples
80
- --------
81
- // Provide an array-like object:
82
- > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0 ] );
83
- > var y = new {{alias:@stdlib/array/float64}}( x.length );
84
- > var out = {{alias}}.assign( x, y )
85
- <Float64Array>[ 1.0, 2.0 ]
86
- > var bool = ( out === y )
87
- true
88
-
89
- > x = [ -1.0, -2.0 ];
90
- > y = [ 0.0, 0.0 ];
91
- > out = {{alias}}.assign( x, y )
92
- [ 1.0, 2.0 ]
93
- > bool = ( out === y )
94
- true
95
-
96
- // Provide an ndarray:
97
- > x = {{alias:@stdlib/ndarray/array}}( [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] );
98
- > y = {{alias:@stdlib/ndarray/array}}( [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] );
99
- > out = {{alias}}.assign( x, y )
100
- <ndarray>
101
- > out.get( 0, 1 )
102
- 2.0
103
- > bool = ( out === y )
104
- true
105
-
106
- See Also
107
- --------
108
-