NdArray::T

Permute the dimensions of an array.

Description

SciPhp\NdArray NdArray::T

Return Values

The new SciPhp\NdArray

Examples

Example #1: Get transposition of a square matrix

use SciPhp\NumPhp as np;

$m np::linspace(199)->reshape(33);

$t $m->T;

echo 
"m\n$m""a=m->T\n$t";

The above example will output:

m
[[1  2  3]
 [4  5  6]
 [7  8  9]]
a=m->T
[[1  4  7]
 [2  5  8]
 [3  6  9]]

See Also