The C++ interface for reorder. More...

array reorder (const array &in, int dim0=-1, int dim1=-1, int dim2=-1, int dim3=-1)
 Reorder dimensions of array. More...
 

Detailed Description

The C++ interface for reorder.

array a(seq(3));
a = tile(a,1,3); //a = [0 0 0]
// [1 1 1]
// [2 2 2]
a = reorder(a, 1, 0); //Switch first and second dimension
//a = [0 1 2]
// [0 1 2]
// [0 1 2]

Function Documentation

array af::reorder ( const array &  in,
int  dim0 = -1,
int  dim1 = -1,
int  dim2 = -1,
int  dim3 = -1 
)

Reorder dimensions of array.

array a(seq(3));
a = tile(a,1,3); //a = [0 0 0]
// [1 1 1]
// [2 2 2]
a = reorder(a, 1, 0); //Switch first and second dimension
//a = [0 1 2]
// [0 1 2]
// [0 1 2]
Parameters
[in]in
[in]dim0first reordering dimension (-1 indicates leave in place, default)
[in]dim1second reordering dimension (-1 indicates leave in place, default)
[in]dim2third reordering dimension (-1 indicates leave in place, default)
[in]dim3fourth reordering dimension (-1 indicates leave in place, default)
Returns
reordered array