Divide two matrices, element-wise.
SciPhp\NdArray
NumPhp::divide(
array|NdArray
$m
,
array|NdArray
$n
)
$m
$n
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
$m = np::vander([1, 2, 3]);
$d = np::divide($m, 2);
echo "m\n$m", "d=m/2\n$d";
The above example will output:
m [[1 1 1] [4 2 1] [9 3 1]] d=m/2 [[0.5 0.5 0.5] [2 1 0.5] [4.5 1.5 0.5]]
use SciPhp\NumPhp as np;
$m = np::arange(0, 18, 2)->reshape(3, 3);
$n = np::vander([1, 2, 4]);
$d = np::divide($m, $n);
echo "m\n$m", "n\n$n", "d=m/n\n$d";
The above example will output:
m [[0 2 4 ] [6 8 10] [12 14 16]] n [[1 1 1 ] [4 2 1 ] [16 4 1 ]] d=m/n [[0 2 4 ] [1.5 4 10 ] [0.75 3.5 16 ]]