Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "ndarray/dispatch/docs/types/index.d"

Index

Interfaces

Type aliases

Functions

Type aliases

ndarrayFcn

ndarrayFcn: (arrays: Array<ndarray>, data?: any) => void

ndarray function.

param

array containing input and output ndarrays

param

ndarray function data (e.g., a callback)

Type declaration

    • (arrays: Array<ndarray>, data?: any): void
    • Parameters

      • arrays: Array<ndarray>
      • Optional data: any

      Returns void

Functions

dispatch

  • dispatch(fcns: ndarrayFcn | ArrayLike<ndarrayFcn>, types: ArrayLike<any>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number): Dispatcher
  • Returns an ndarray function interface which performs multiple dispatch.

    throws

    first argument must be either a function or an array of functions

    throws

    second argument must be an array-like object

    throws

    third argument must be an array-like object or null

    throws

    third and first arguments must have the same number of elements

    throws

    fourth argument must be a positive integer

    throws

    fifth argument must be a nonnegative integer

    throws

    sixth argument must be a nonnegative integer

    throws

    fourth argument must equal the specified number of input and output arrays

    throws

    number of types must match the number of functions times the total number of array arguments for each function

    throws

    interface must accept at least one input and/or output ndarray

    Parameters

    • fcns: ndarrayFcn | ArrayLike<ndarrayFcn>

      list of ndarray functions

    • types: ArrayLike<any>

      one-dimensional list of ndarray argument data types

    • data: ArrayLike<any> | null

      ndarray function data (e.g., callbacks)

    • nargs: number

      total number of ndarray function interface arguments

    • nin: number

      number of input ndarrays

    • nout: number

      number of output ndarrays

    Returns Dispatcher

    ndarray function interface

    Example

    var unary = require( `@stdlib/ndarray/base/unary` );
    var abs = require( `@stdlib/math/base/special/abs` );
    var Float64Array = require( `@stdlib/array/float64` );
    var ndarray = require( `@stdlib/ndarray/ctor` );
    
    var types = [
        'float64', 'float64'
    ];
    
    var data = [
        abs
    ];
    
    var fcn = dispatch( unary, types, data, 2, 1, 1 );
    
    // ...
    
    var xbuf = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0 ] );
    var ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
    
    var x = ndarray( 'float64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
    var y = ndarray( 'float64', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
    
    fcn( x, y );
    // ybuf => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]