Array elements raised to powers, element-wise.
SciPhp\NdArray
NdArray::power(
float|int
$exponent
)
$exponent
use SciPhp\NumPhp as np;
$m = np::linspace(1, 9, 9)->reshape(3, 3);
$p = $m->power(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]]