Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

maxsorted

Calculate the maximum value of a sorted array.

Usage

var maxsorted = require( '@stdlib/stats/array/maxsorted' );

maxsorted( x )

Computes the maximum value of a sorted array.

var x = [ 1.0, 2.0, 3.0 ];

var v = maxsorted( x );
// returns 3.0

x = [ 3.0, 2.0, 1.0 ];

v = maxsorted( x );
// returns 3.0

The function has the following parameters:

  • x: input array.

Notes

  • If provided an empty array, the function returns NaN.
  • The function supports array-like objects having getter and setter accessors for array element access (e.g., @stdlib/array/base/accessor).

Examples

var linspace = require( '@stdlib/array/base/linspace' );
var maxsorted = require( '@stdlib/stats/array/maxsorted' );

var x = linspace( -50.0, 50.0, 10 );
console.log( x );

var v = maxsorted( x );
console.log( v );