@@ -25,6 +25,7 @@ import array = require( './../../array' );
2525import base = require( './../../base' ) ;
2626import ndarrayCastingModes = require( './../../casting-modes' ) ;
2727import ndarray = require( './../../ctor' ) ;
28+ import dispatch = require( './../../dispatch' ) ;
2829import ndarrayDataTypes = require( './../../dtypes' ) ;
2930import scalar2ndarray = require( './../../from-scalar' ) ;
3031import ind2sub = require( './../../ind2sub' ) ;
@@ -162,6 +163,56 @@ interface Namespace {
162163 */
163164 ndarray : typeof ndarray ;
164165
166+ /**
167+ * Returns an ndarray function interface which performs multiple dispatch.
168+ *
169+ * @param fcns - list of ndarray functions
170+ * @param types - one-dimensional list of ndarray argument data types
171+ * @param data - ndarray function data (e.g., callbacks)
172+ * @param nargs - total number of ndarray function interface arguments
173+ * @param nin - number of input ndarrays
174+ * @param nout - number of output ndarrays
175+ * @throws first argument must be either a function or an array of functions
176+ * @throws second argument must be an array-like object
177+ * @throws third argument must be an array-like object or `null`
178+ * @throws third and first arguments must have the same number of elements
179+ * @throws fourth argument must be a positive integer
180+ * @throws fifth argument must be a nonnegative integer
181+ * @throws sixth argument must be a nonnegative integer
182+ * @throws fourth argument must equal the specified number of input and output arrays
183+ * @throws number of types must match the number of functions times the total number of array arguments for each function
184+ * @throws interface must accept at least one input and/or output ndarray
185+ * @returns ndarray function interface
186+ *
187+ * @example
188+ * var unary = require( `@stdlib/ndarray/base/unary` );
189+ * var abs = require( `@stdlib/math/base/special/abs` );
190+ * var Float64Array = require( `@stdlib/array/float64` );
191+ * var ndarray = require( `@stdlib/ndarray/ctor` );
192+ *
193+ * var types = [
194+ * 'float64', 'float64'
195+ * ];
196+ *
197+ * var data = [
198+ * abs
199+ * ];
200+ *
201+ * var fcn = ns.dispatch( unary, types, data, 2, 1, 1 );
202+ *
203+ * // ...
204+ *
205+ * var xbuf = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0 ] );
206+ * var ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
207+ *
208+ * var x = ndarray( 'float64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
209+ * var y = ndarray( 'float64', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
210+ *
211+ * fcn( x, y );
212+ * // ybuf => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
213+ */
214+ dispatch : typeof dispatch ;
215+
165216 /**
166217 * Returns a list of ndarray data types.
167218 *
0 commit comments