Skip to content

Latest commit

 

History

History
120 lines (75 loc) · 2.91 KB

File metadata and controls

120 lines (75 loc) · 2.91 KB

Tools

Math array function tools.

Usage

var ns = require( '@stdlib/math/array/tools' );

ns

Namespace containing tools for applying mathematical functions to arrays.

var o = ns;
// returns {...}

The namespace contains the following:

Examples

var abs = require( '@stdlib/math/base/special/abs' );
var ns = require( '@stdlib/math/array/tools' );

// Define a list of supported input dtypes:
var idtypes = [
    'float64',
    'float32',
    'generic'
];

// Define a list of supported output dtypes:
var odtypes = [
    'float64',
    'float32',
    'generic'
];

// Create a function for applying a unary function to each element of an array:
var f = new ns.unary( abs, idtypes, odtypes, 'same' );

// Create an input array:
var x = [ -1.0, 2.0, -3.0, 4.0 ];

// Perform element-wise computation:
var out = f.apply( x );
// returns [ 1.0, 2.0, 3.0, 4.0 ]