public function sum($axis = null) { return Reduce::reduceArray($this, function ($data1, $data2) { return $data1 + $data2; }, $axis); }
/** * Tests if InvalidArgumentException will be thrown by using NumArray::sum and a * wrong axis on a scalar value * * @expectedException \NumPHP\Core\Exception\InvalidArgumentException * @expectedExceptionMessage Axis 1 out of bounds */ public function testSumSingleAxis1() { $numArray = new NumArray(6); $numArray->sum(1); }