Compute the maximum value of a one-dimensional ndarray.
var max = require( '@stdlib/stats/base/ndarray/max' );Computes the maximum value of a one-dimensional ndarray.
var vector = require( '@stdlib/ndarray/vector/ctor' );
var x = vector( [ 1.0, 3.0, 4.0, 2.0 ], 'generic' );
var v = max( [ x ] );
// returns 4.0The function has the following parameters:
- arrays: array-like object containing a one-dimensional input ndarray.
- If provided an empty one-dimensional ndarray, the function returns
NaN.
var discreteUniform = require( '@stdlib/random/discrete-uniform' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var max = require( '@stdlib/stats/base/ndarray/max' );
var opts = {
'dtype': 'generic'
};
var x = discreteUniform( [ 10 ], -50, 50, opts );
console.log( ndarray2array( x ) );
var v = max( [ x ] );
console.log( v );