Change the sign of m-element to that of n-element, element-wise.
SciPhp\NdArray
NumPhp::copysign(
array|NdArray
$m
,
array|NdArray
$n
)
$m
$n
use SciPhp\NumPhp as np;
$m = np::ar([-5, 5, 5]);
$n = np::ar([1, 0, -1]);
$r = np::copysign($m, $n);
echo "m\n$m", "n\n$n", "r\n$r";
The above example will output:
m [-5 5 5 ] n [1 0 -1] r [5 5 -5]