iota

Functions
iota
Complete List of ArrayFire Functions ArrayFire Functions by Category » Functions to create and modify Arrays » | Functions to create arrays.

Create an sequence [0, dims.elements() - 1] and modify to specified dimensions dims and then tile it according to tile_dims. More...

## Functions
AFAPI array | iota (const dim4 &dims, const dim4 &tile_dims=dim4(1), const dtype ty=f32)
AFAPI af_err | af_iota (af_array *out, const unsigned ndims, const dim_t *const dims, const unsigned t_ndims, const dim_t *const tdims, const af_dtype type)

## Detailed Description

Create an sequence [0, dims.elements() - 1] and modify to specified dimensions dims and then tile it according to tile_dims.

// Generate [0, 5x3 - 1] in dimensions 5, 3
array a = iota(dim4(5, 3))
// a [5 3 1 1]
// 0.0000 5.0000 10.0000
// 1.0000 6.0000 11.0000
// 2.0000 7.0000 12.0000
// 3.0000 8.0000 13.0000
// 4.0000 9.0000 14.0000
// Generate [0, 5x3 - 1] in dimensions 5, 3 and then tile once along
// dim0 and twice along dim1
array b = iota(dim4(5, 3), dim4(1, 2))
// b [5 6 1 1]
// 0.0000 5.0000 10.0000 0.0000 5.0000 10.0000
// 1.0000 6.0000 11.0000 1.0000 6.0000 11.0000
// 2.0000 7.0000 12.0000 2.0000 7.0000 12.0000
// 3.0000 8.0000 13.0000 3.0000 8.0000 13.0000
// 4.0000 9.0000 14.0000 4.0000 9.0000 14.0000

## Function Documentation

## § af_iota()

AFAPI af_err af_iota | ( | af_array * | out,
|  | const unsigned | ndims,
|  | const dim_t *const | dims,
|  | const unsigned | t_ndims,
|  | const dim_t *const | tdims,
|  | const af_dtype | type
| ) |  |

Parameters

  [out] | out | is the generated array
  [in] | ndims | is size of dimension array `dims`
  [in] | dims | is the array containing sizes of the dimension
  [in] | t_ndims | is size of tile array `tdims`
  [in] | tdims | is array containing the number of repetitions of the unit dimensions
  [in] | type | is the type of array to generate

## § iota()

AFAPI array af::iota | ( | const dim4 & | dims,
|  | const dim4 & | tile_dims = `dim4(1)`,
|  | const dtype | ty = `f32`
| ) |  |

Parameters

  [in] | dims | is dim4 for unit dimensions of the sequence to be generated
  [in] | tile_dims | is dim4 for the number of repetitions of the unit dimensions
  [in] | ty | is the type of array to generate

Returns
  an array of integral range specified dimension and type

Examples:
  graphics/fractal.cpp, and graphics/surface.cpp.