You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [`d4f8189`](https://github.com/stdlib-js/stdlib/commit/d4f8189e03d81f54c5483ffb016ca967a3888565) - **refactor:** modify dispatch table to support type signatures _(by Athan Reines)_
1756
+
- [`d287f8e`](https://github.com/stdlib-js/stdlib/commit/d287f8e4a80211270e9fa96e05a17d6d1a9d2655) - **refactor:** modify dispatch table to support type signatures _(by Athan Reines)_
Copy file name to clipboardExpand all lines: base/unary-strided1d-dispatch-factory/README.md
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,19 @@ var policy = 'same';
51
51
var unary =unaryStrided1dDispatchFactory( table, [ dtypes ], dtypes, policy );
52
52
```
53
53
54
-
-**table**: strided function dispatch table. Must have a `'default'` property and a corresponding strided function. May have additional properties corresponding to specific data types and associated specialized strided functions.
54
+
- strided function dispatch table. Must have the following properties:
55
+
56
+
-**default**: default strided function which should be invoked when provided ndarrays have data types which do not have a corresponding specialized implementation.
57
+
58
+
A dispatch table may have the following additional properties:
59
+
60
+
-**types**: one-dimensional list of ndarray data types describing specialized input and output ndarray argument signatures. Only the input and output ndarray argument data types should be specified. Additional ndarray argument data types should be omitted and are not considered during dispatch. The length of `types` must equal the number of strided functions specified by `fcns` multiplied by two (i.e., for every pair of input-output ndarray data types, there must be a corresponding strided function in `fcns`).
61
+
-**fcns**: list of strided functions which are specific to specialized input and output ndarray argument signatures.
62
+
55
63
-**idtypes**: list containing lists of supported input data types for each input ndarray argument.
56
-
-**odtypes**: list of supported input data types.
64
+
65
+
-**odtypes**: list of supported output data types.
66
+
57
67
-**policy**: output data type policy.
58
68
59
69
#### unary( x\[, ...args]\[, options] )
@@ -184,6 +194,16 @@ The function accepts the following options:
184
194
185
195
## Notes
186
196
197
+
- A strided function should have the following signature:
198
+
199
+
```text
200
+
f( arrays )
201
+
```
202
+
203
+
where
204
+
205
+
- **arrays**: array containing input and output ndarrays, along with any additional ndarray arguments.
206
+
187
207
- The output data type policy only applies to the function returned by `factory`. For the `assign` method, the output ndarray is allowed to have any data type.
188
208
189
209
</section>
@@ -194,11 +214,13 @@ The function accepts the following options:
* @param {Function} table.default - default strided function
34
+
* @param {StringArray} [table.types] - one-dimensional list of ndarray data types describing specialized input and output ndarray argument signatures
35
+
* @param {ArrayLikeObject<Function>} [table.fcns] - list of strided functions which are specific to specialized input and output ndarray argument signatures
33
36
* @param {ArrayLikeObject<StringArray>} idtypes - list containing lists of supported input data types for each ndarray argument
34
37
* @param {StringArray} odtypes - list of supported output data types
35
38
* @param {string} policy - output data type policy
36
-
* @throws {TypeError} first argument must be an object
39
+
* @throws {TypeError} first argument must be an object having valid properties
37
40
* @throws {TypeError} second argument must be an array containing arrays of supported data types
38
41
* @throws {TypeError} third argument must be an array of supported data types
39
42
* @throws {TypeError} fourth argument must be a supported output data type policy
43
+
* @throws {Error} first argument must be an object having valid properties
40
44
* @returns {Function} function for applying a strided function an ndarray
Constructor for applying a strided function to an input ndarray.
35
+
Returns an interface for applying a strided function to an input ndarray.
36
36
37
37
```javascript
38
38
var base =require( '@stdlib/stats/base/ndarray/cumax' );
@@ -49,9 +49,19 @@ var unary = new UnaryStrided1dDispatch( table, [ dtypes ], dtypes, policy );
49
49
50
50
The constructor has the following parameters:
51
51
52
-
-**table**: strided function dispatch table. Must have a `'default'` property and a corresponding strided function. May have additional properties corresponding to specific data types and associated specialized strided functions.
52
+
-**table**: strided function dispatch table. Must have the following properties:
53
+
54
+
-**default**: default strided function which should be invoked when provided ndarrays have data types which do not have a corresponding specialized implementation.
55
+
56
+
A dispatch table may have the following additional properties:
57
+
58
+
-**types**: one-dimensional list of ndarray data types describing specialized input and output ndarray argument signatures. Only the input and output ndarray argument data types should be specified. Additional ndarray argument data types should be omitted and are not considered during dispatch. The length of `types` must equal the number of strided functions specified by `fcns` multiplied by two (i.e., for every pair of input-output ndarray data types, there must be a corresponding strided function in `fcns`).
59
+
-**fcns**: list of strided functions which are specific to specialized input and output ndarray argument signatures.
60
+
53
61
-**idtypes**: list containing lists of supported input data types for each input ndarray argument.
54
-
-**odtypes**: list of supported input data types.
62
+
63
+
-**odtypes**: list of supported output data types.
0 commit comments