- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

Functions
reorder
Complete List of ArrayFire Functions ArrayFire Functions by Category » Functions to create and modify Arrays » | Move and Reorder array content

Reorder the input by in the specified order. More...

## Functions
AFAPI array | reorder (const array &in, const unsigned x, const unsigned y=1, const unsigned z=2, const unsigned w=3)
AFAPI af_err | af_reorder (af_array *out, const af_array in, const unsigned x, const unsigned y, const unsigned z, const unsigned w)

## Detailed Description

Reorder the input by in the specified order.

Exchanges dimensions within an array. The order of the data along each dimension does not change.

array a = randu(5, 4, 3);
// a [5 4 3 1]
// 0.0000 0.2190 0.3835 0.5297
// 0.1315 0.0470 0.5194 0.6711
// 0.7556 0.6789 0.8310 0.0077
// 0.4587 0.6793 0.0346 0.3834
// 0.5328 0.9347 0.0535 0.0668
// 0.4175 0.5269 0.9103 0.3282
// 0.6868 0.0920 0.7622 0.6326
// 0.5890 0.6539 0.2625 0.7564
// 0.9304 0.4160 0.0475 0.9910
// 0.8462 0.7012 0.7361 0.3653
// 0.2470 0.0727 0.7665 0.1665
// 0.9826 0.6316 0.4777 0.4865
// 0.7227 0.8847 0.2378 0.8977
// 0.7534 0.2727 0.2749 0.9092
// 0.6515 0.4364 0.3593 0.0606
array b = reorder(a, 2, 0, 1)
// b [3 5 4 1]
// 0.0000 0.1315 0.7556 0.4587 0.5328
// 0.4175 0.6868 0.5890 0.9304 0.8462
// 0.2470 0.9826 0.7227 0.7534 0.6515
// 0.2190 0.0470 0.6789 0.6793 0.9347
// 0.5269 0.0920 0.6539 0.4160 0.7012
// 0.0727 0.6316 0.8847 0.2727 0.4364
// 0.3835 0.5194 0.8310 0.0346 0.0535
// 0.9103 0.7622 0.2625 0.0475 0.7361
// 0.7665 0.4777 0.2378 0.2749 0.3593
// 0.5297 0.6711 0.0077 0.3834 0.0668
// 0.3282 0.6326 0.7564 0.9910 0.3653
// 0.1665 0.4865 0.8977 0.9092 0.0606

## Function Documentation

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

Parameters

  [out] | out | is the reordered array
  [in] | in | is the input matrix
  [in] | x | specifies which dimension should be first
  [in] | y | specifies which dimension should be second
  [in] | z | specifies which dimension should be third
  [in] | w | specifies which dimension should be fourth

AFAPI array af::reorder | ( | const array & | in,
|  | const unsigned | x,
|  | const unsigned | y = `1`,
|  | const unsigned | z = `2`,
|  | const unsigned | w = `3`
| ) |  |

Parameters

  [in] | in | is the input array
  [in] | x | specifies which dimension should be first
  [in] | y | specifies which dimension should be second
  [in] | z | specifies which dimension should be third
  [in] | w | specifies which dimension should be fourth

Returns
  the reordered output