Multiply two matrices, element-wise.
SciPhp\NdArray
NdArray::multiply(
array|NdArray
$n
)
$n
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
$m = np::vander([1, 2, 3]);
$r = $m->multiply(2);
echo "m\n$m", "r=m*2\n$r";
The above example will output:
m [[1 1 1] [4 2 1] [9 3 1]] d=m*2 [[2 2 2 ] [8 4 2 ] [18 6 2 ]]
use SciPhp\NumPhp as np;
$m = np::arange(0, 18, 2)->reshape(3, 3);
$n = np::vander([1, 2, 4]);
$r = $m->multiply($n);
echo "m\n$m", "n\n$n", "r=m*n\n$r";
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 ]] r=m*n [[0 2 4 ] [24 16 10 ] [192 56 16 ]]