Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

max

Compute the maximum value of a one-dimensional ndarray.

Usage

var max = require( '@stdlib/stats/base/ndarray/max' );

max( arrays )

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.0

The function has the following parameters:

  • arrays: array-like object containing a one-dimensional input ndarray.

Notes

  • If provided an empty one-dimensional ndarray, the function returns NaN.

Examples

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 );