NumPHP\Core\NumArray::max PHP Méthode

max() public méthode

Returns the max of the NumArray for the given axis
Since: 1.0.0
public max ( integer $axis = null ) : NumArray
$axis integer given axis of max
Résultat NumArray
    public function max($axis = null)
    {
        return Reduce::reduceArray($this, function ($data1, $data2) {
            return max($data1, $data2);
        }, $axis);
    }

Usage Example

Exemple #1
0
 /**
  * Tests NumArray::max with a matrix and argument 1
  */
 public function testMaxMatrixAxis1()
 {
     $numArray = new NumArray([[354, 56, -78], [-1, 453, 67]]);
     $expectedNumArray = new NumArray([354, 453]);
     $this->assertNumArrayEquals($expectedNumArray, $numArray->max(1));
 }