A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
where
ArrayFire Functions | ArrayFire Functions by Category » Vector Algorithms » Inclusive scan operations

## Functions
AFAPI array | where (const array &in)
| C++ Interface to locate the indices of the non-zero values in an array.
AFAPI af_err | af_where (af_array *idx, const af_array in)
| C Interface to locate the indices of the non-zero values in an array.

## Detailed Description

Locate the indices of the non-zero values in an array.

Output type is `u32`.

The locations are provided by flattening the input into a linear array.

## Function Documentation

## ◆ af_where()

AFAPI af_err af_where | ( | af_array * | idx,
|  | const af_array | in )

C Interface to locate the indices of the non-zero values in an array.

Parameters

  [out] | idx | linear indices where `in` is non-zero
  [in] | in | input array

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

## ◆ where()

AFAPI array where | ( | const array & | in | ) |

C++ Interface to locate the indices of the non-zero values in an array.

Parameters

  [in] | in | input array

Returns
  linear indices where `in` is non-zero