A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
tile
ArrayFire Functions | ArrayFire Functions by Category » Functions to create and modify Arrays » Move and Reorder array content

## Functions
AFAPI array | tile (const array &in, const unsigned x, const unsigned y=1, const unsigned z=1, const unsigned w=1)
| C++ Interface to generate a tiled array.
AFAPI array | tile (const array &in, const dim4 &dims)
| C++ Interface to generate a tiled array.
AFAPI af_err | af_tile (af_array *out, const af_array in, const unsigned x, const unsigned y, const unsigned z, const unsigned w)
| C Interface to generate a tiled array.

## Detailed Description

Generate a tiled array by repeating an array's contents along a specified dimension.

Creates copies of the input array and concatenates them with each other, such that the output array will have as many copies of the input array as the user specifies along each dimension. In this sense, the output array is a set of "tiles" where each copy of the input array, including the original, is a "tile".

Given below are some examples. The input array looks like this:

float hA[] = {0, 1, 2, 3, 4, 5};
array A(3, 2, hA);
// 0. 3.
// 1. 4.
// 2. 5.

Here, the input array is tiled along the first dimenson, 2 times:

array B = tile(A, 2, 1);
// 0. 3.
// 1. 4.
// 2. 5.
// 0. 3.
// 1. 4.
// 2. 5.

Here, the input is tiled along the second dimension, 3 times:

array C = tile(A, 1, 3);
// 0. 3. 0. 3. 0. 3.
// 1. 4. 1. 4. 1. 4.
// 2. 5. 2. 5. 2. 5.

Lastly, one can also tile along multiple dimensions simultaneously. Here, the input is tiled 2 times in the first dimension and 3 times in the second dimension:

array D = tile(A, 2, 3);
// 0. 3. 0. 3. 0. 3.
// 1. 4. 1. 4. 1. 4.
// 2. 5. 2. 5. 2. 5.
// 0. 3. 0. 3. 0. 3.
// 1. 4. 1. 4. 1. 4.
// 2. 5. 2. 5. 2. 5.

## Function Documentation

## ◆ af_tile()

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

C Interface to generate a tiled array.

Note, `x`, `y`, `z`, and `w` include the original in the count.

Parameters

  [out] | out | tiled array
  [in] | in | input array
  [in] | x | number of tiles along the first dimension
  [in] | y | number of tiles along the second dimension
  [in] | z | number of tiles along the third dimension
  [in] | w | number of tiles along the fourth dimension

Returns
  AF_SUCCESS, if function returns successfully, else an af_err code is given

## ◆ tile() [1/2]

AFAPI array tile | ( | const array & | in,
|  | const dim4 & | dims )

C++ Interface to generate a tiled array.

Each component of `dims` includes the original in the count. Thus, if no duplicates are needed in a certain dimension, it is left as 1, the default value for just one copy.

Parameters

  [in] | in | input array
  [in] | dims | number of times `in` is copied along each dimension

Returns
  tiled array

## ◆ tile() [2/2]

AFAPI array tile | ( | const array & | in,
|  | const unsigned | x,
|  | const unsigned | y = 1,
|  | const unsigned | z = 1,
|  | const unsigned | w = 1 )

C++ Interface to generate a tiled array.

Note, `x`, `y`, `z`, and `w` include the original in the count.

Parameters

  [in] | in | input array
  [in] | x | number tiles along the first dimension
  [in] | y | number tiles along the second dimension
  [in] | z | number tiles along the third dimension
  [in] | w | number tiles along the fourth dimension

Returns
  tiled array