Return the base 2 logarithm, element-wise.
SciPhp\NdArray
NumPhp::log2(
array|NdArray
$m
)
$m
use SciPhp\NumPhp as np;
$m = np::log2([1, 2, 4, 8]);
echo "m\n$m";
The above example will output:
m [0 1 2 3]
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 4])->vander();
$r = np::log2($m);
echo "m\n$m", "r\n$r";
The above example will output:
m [[1 1 1 ] [4 2 1 ] [16 4 1 ]] r [[0 0 0] [2 1 0] [4 2 0]]