NumPHP\Core\NumArray::min PHP Method

min() public method

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

Usage Example

コード例 #1
0
ファイル: MinTest.php プロジェクト: raslin/NumPHP
 /**
  * Tests NumArray::min with a matrix and argument 1
  */
 public function testMinMatrixAxis1()
 {
     $numArray = new NumArray([[34, 346, -12], [56, -78, 12], [345, -6, 99]]);
     $expectedNumArray = new NumArray([-12, -78, -6]);
     $this->assertNumArrayEquals($expectedNumArray, $numArray->min(1));
 }