NumPHP\Core\NumPHP::arange PHP Метод

arange() публичный статический Метод

Creates a vector (NumArray) from $low to $high with $step steps
С версии: 1.0.0
public static arange ( float $low, float $high, float $step = 1 ) : NumArray
$low float beginning of the vector
$high float end of the vector
$step float steps, if not given `$step` = `1.0`
Результат NumArray
    public static function arange($low, $high, $step = 1.0)
    {
        if ($step < 0) {
            throw new InvalidArgumentException('Step has to be a positive value');
        }
        return new NumArray(range($low, $high, $step));
    }

Usage Example

Пример #1
0
 public function testSetMatrixSlice()
 {
     $matrix = NumPHP::arange(-20, -1)->reshape(4, 5);
     $subMatrix = NumPHP::arange(1, 6)->reshape(2, 3);
     $expectedNumArray = new NumArray([[-20, -19, -18, -17, -16], [-15, -14, 1, 2, 3], [-10, -9, 4, 5, 6], [-5, -4, -3, -2, -1]]);
     $this->assertNumArrayEquals($expectedNumArray, $matrix->set('1:3', '2:5', $subMatrix));
 }
All Usage Examples Of NumPHP\Core\NumPHP::arange