Array elements raised to powers, element-wise.
SciPhp\NdArray
NumPhp::power(
array|NdArray
$m
,
float|int
$exponent
)
$m
$exponent
use SciPhp\NumPhp as np;
$m = np::linspace(1, 9, 9)->reshape(3, 3);
$p = np::power($m, 2);
echo "m\n$m", "s=m.\n$s";
The above example will output:
m [[1 2 3] [4 5 6] [7 8 9]] p=m ** 2 [[1 4 9 ] [16 25 36] [49 64 81]]