Skip to content

Commit d358245

Browse files
committed
docs: fix require paths in README
1 parent f4024f0 commit d358245

File tree

1 file changed

+9
-92
lines changed
  • lib/node_modules/@stdlib/ndarray/dispatch-by

1 file changed

+9
-92
lines changed

lib/node_modules/@stdlib/ndarray/dispatch-by/README.md

Lines changed: 9 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
1919
-->
2020

21-
# Dispatch
21+
# dispatchBy
2222

2323
> Create an [ndarray][@stdlib/ndarray/ctor] function interface which performs multiple dispatch.
2424
@@ -33,78 +33,17 @@ limitations under the License.
3333
## Usage
3434

3535
```javascript
36-
var dispatch = require( '@stdlib/ndarray/dispatch' );
36+
var dispatchBy = require( '@stdlib/ndarray/dispatch-by' );
3737
```
3838

39-
#### dispatch( fcns, types, data, nargs, nin, nout )
39+
#### dispatchBy( fcns, types, data, nargs, nin, nout )
4040

4141
Returns an [ndarray][@stdlib/ndarray/ctor] function interface which performs multiple dispatch.
4242

4343
<!-- eslint-disable array-element-newline -->
4444

4545
```javascript
46-
var unary = require( '@stdlib/ndarray/base/unary' );
47-
var Float64Array = require( '@stdlib/array/float64' );
48-
var Float32Array = require( '@stdlib/array/float32' );
49-
var ndarray = require( '@stdlib/ndarray/ctor' );
50-
51-
function foo( x ) {
52-
return x * 10.0;
53-
}
54-
55-
function bar( x ) {
56-
return x * 5.0;
57-
}
58-
59-
// Define a list of ndarray functions for applying a unary callback:
60-
var fcns = [
61-
unary,
62-
unary
63-
];
64-
65-
// Define a one-dimensional list of input and output array types:
66-
var types = [
67-
'float64', 'float64', // input, output
68-
'float32', 'float32' // input, output
69-
];
70-
71-
// Define a list of callbacks which should be applied based on the provided array types:
72-
var data = [
73-
foo,
74-
bar
75-
];
76-
77-
// Define the total number of input arguments:
78-
var nargs = 2; // input_array + output_array
79-
80-
// Define the number of input ndarrays:
81-
var nin = 1;
82-
83-
// Define the number of output ndarrays:
84-
var nout = 1;
85-
86-
// Create an ndarray function interface:
87-
var fcn = dispatch( fcns, types, data, nargs, nin, nout );
88-
89-
// ...
90-
91-
var xbuf = new Float64Array( [ 1.0, 2.0, 3.0 ] );
92-
var ybuf = new Float64Array( xbuf.length );
93-
94-
var x = ndarray( 'float64', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
95-
var y = ndarray( 'float64', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
96-
97-
fcn( x, y );
98-
// ybuf => <Float64Array>[ 10.0, 20.0, 30.0 ]
99-
100-
xbuf = new Float32Array( [ 1.0, 2.0, 3.0 ] );
101-
ybuf = new Float32Array( xbuf.length );
102-
103-
x = ndarray( 'float32', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
104-
y = ndarray( 'float32', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
105-
106-
fcn( x, y );
107-
// ybuf => <Float32Array>[ 5.0, 10.0, 15.0 ]
46+
console.log( 'TODO' );
10847
```
10948

11049
The function accepts the following arguments:
@@ -154,7 +93,7 @@ The function accepts the following arguments:
15493
<!-- eslint-disable array-element-newline -->
15594
15695
```javascript
157-
var unary = require( '@stdlib/ndarray/base/unary' );
96+
var unary = require( '@stdlib/ndarray/base/unary-by' );
15897
15998
function foo( x ) {
16099
return x * 10.0;
@@ -177,15 +116,15 @@ The function accepts the following arguments:
177116
bar
178117
];
179118
180-
var fcn = dispatch( fcns, types, data, 2, 1, 1 );
119+
var fcn = dispatchBy( fcns, types, data, 2, 1, 1 );
181120
```
182121
183122
is equivalent to
184123
185124
<!-- eslint-disable array-element-newline -->
186125
187126
```javascript
188-
var unary = require( '@stdlib/ndarray/base/unary' );
127+
var unary = require( '@stdlib/ndarray/base/unary-by' );
189128
190129
function foo( x ) {
191130
return x * 10.0;
@@ -204,7 +143,7 @@ The function accepts the following arguments:
204143
bar
205144
];
206145
207-
var fcn = dispatch( unary, types, data, 2, 1, 1 );
146+
var fcn = dispatchBy( unary, types, data, 2, 1, 1 );
208147
```
209148
210149
</section>
@@ -218,29 +157,7 @@ The function accepts the following arguments:
218157
<!-- eslint no-undef: "error" -->
219158
220159
```javascript
221-
var unary = require( '@stdlib/ndarray/base/unary' );
222-
var ndarray = require( '@stdlib/ndarray/ctor' );
223-
var abs = require( '@stdlib/math/base/special/abs' );
224-
var Float64Array = require( '@stdlib/array/float64' );
225-
var dispatch = require( '@stdlib/ndarray/dispatch' );
226-
227-
var types = [ 'float64', 'float64' ];
228-
229-
var data = [
230-
abs
231-
];
232-
233-
var absolute = dispatch( unary, types, data, 2, 1, 1 );
234-
235-
var xbuf = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0 ] );
236-
var ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
237-
238-
var x = ndarray( 'float64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
239-
var y = ndarray( 'float64', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
240-
241-
absolute( x, y );
242-
console.log( ybuf );
243-
// => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
160+
console.log( 'TODO' );
244161
```
245162

246163
</section>

0 commit comments

Comments
 (0)