Permute the dimensions of an array.
SciPhp\NdArray
NumPhp::transpose(
array|NdArray
$m
,
array
$axes
)
$m
$axes
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
$x = np::transpose([1, 2, 3]);
print $x;
The above example will output:
[1 2 3]
use SciPhp\NumPhp as np;
$x = np::linspace(1, 6, 6)->reshape(2, 3);
$xT = np::transpose($x);
echo "x\n$x", "xT\n$xT";
The above example will output:
x [[1 2 3] [4 5 6]] xT [[1 4] [2 5] [3 6]]