MathPHP\LinearAlgebra\MatrixFactory::one PHP Method

one() public static method

Example: m = 3; n = 3 [1 1 1] A = [1 1 1] [1 1 1]
public static one ( integer $m, integer $n ) : Matrix
$m integer rows
$n integer columns
return Matrix
    public static function one(int $m, int $n) : Matrix
    {
        if ($m < 1 || $n < 1) {
            throw new Exception\OutOfBoundsException("m and n must be > 0. m = {$m}, n = {$n}");
        }
        $R = [];
        for ($i = 0; $i < $m; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R[$i][$j] = 1;
            }
        }
        return self::create($R);
    }