A high-performance general-purpose compute library

Reorder an array. More...

Functions

AFAPI array reorder (const array &in, const unsigned x, const unsigned y=1, const unsigned z=2, const unsigned w=3)
 C++ Interface to reorder an array. More...
 
AFAPI af_err af_reorder (af_array *out, const af_array in, const unsigned x, const unsigned y, const unsigned z, const unsigned w)
 C Interface to reorder an array. More...
 

Detailed Description

Reorder an array.

Exchanges data of an array such that the requested change in dimension is satisfied. The linear ordering of data within the array is preserved.

a [2 2 3 1]
1.0000 3.0000
2.0000 4.0000
1.0000 3.0000
2.0000 4.0000
1.0000 3.0000
2.0000 4.0000
reorder(a, 1, 0, 2) [2 2 3 1] // equivalent to a transpose
1.0000 2.0000
3.0000 4.0000
1.0000 2.0000
3.0000 4.0000
1.0000 2.0000
3.0000 4.0000
reorder(a, 2, 0, 1) [3 2 2 1]
1.0000 2.0000
1.0000 2.0000
1.0000 2.0000
3.0000 4.0000
3.0000 4.0000
3.0000 4.0000

Function Documentation

◆ af_reorder()

AFAPI af_err af_reorder ( af_array out,
const af_array  in,
const unsigned  x,
const unsigned  y,
const unsigned  z,
const unsigned  w 
)

C Interface to reorder an array.

Parameters
[out]outreordered array
[in]ininput array
[in]xspecifies which dimension should be first
[in]yspecifies which dimension should be second
[in]zspecifies which dimension should be third
[in]wspecifies which dimension should be fourth
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ reorder()

AFAPI array reorder ( const array in,
const unsigned  x,
const unsigned  y = 1,
const unsigned  z = 2,
const unsigned  w = 3 
)

C++ Interface to reorder an array.

Parameters
[in]ininput array
[in]xspecifies which dimension should be first
[in]yspecifies which dimension should be second
[in]zspecifies which dimension should be third
[in]wspecifies which dimension should be fourth
Returns
reordered array