sortByKey

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

Functions
sortByKey
Complete List of ArrayFire Functions ArrayFire Functions by Category » Vector Algorithms » | Sort operations

Sort input arrays based on keys. More...

## Functions
AFAPI void | sort (array &out_keys, array &out_values, const array &keys, const array &values, const unsigned dim=0, const bool isAscending=true)
| C++ Interface for sorting an array based on keys. More...
AFAPI af_err | af_sort_by_key (af_array *out_keys, af_array *out_values, const af_array keys, const af_array values, const unsigned dim, const bool isAscending)
| C Interface for sorting an array based on keys. More...

## Detailed Description

Sort input arrays based on keys.

Sort a multi dimensional array based on keys

## Function Documentation

AFAPI af_err af_sort_by_key | ( | af_array * | out_keys,
|  | af_array * | out_values,
|  | const af_array | keys,
|  | const af_array | values,
|  | const unsigned | dim,
|  | const bool | isAscending
| ) |  |

C Interface for sorting an array based on keys.

Parameters

  [out] | out_keys | will contain the keys based on sorted values
  [out] | out_values | will contain the sorted values
  [in] | keys | is the input array
  [in] | values | The dimension along which numerical difference is performed
  [in] | dim | The dimension along which numerical difference is performed
  [in] | isAscending | specifies the sorting order

Returns
  AF_SUCCESS if the execution completes properly

Note
  `dim` is currently restricted to 0.

AFAPI void af::sort | ( | array & | out_keys,
|  | array & | out_values,
|  | const array & | keys,
|  | const array & | values,
|  | const unsigned | dim = `0`,
|  | const bool | isAscending = `true`
| ) |  |

C++ Interface for sorting an array based on keys.

Parameters

  [out] | out_keys | will contain the keys based on sorted values
  [out] | out_values | will contain the sorted values
  [in] | keys | is the input array
  [in] | values | The dimension along which numerical difference is performed
  [in] | dim | The dimension along which numerical difference is performed
  [in] | isAscending | specifies the sorting order

Note
  `dim` is currently restricted to 0.