A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
sign
ArrayFire Functions | ArrayFire Functions by Category » Mathematical functions » Numeric functions

## Functions
array | sign (const array &in)
| C++ Interface to return the sign of elements in an array.
af_err | af_sign (af_array *out, const af_array in)
| C Interface to calculate the sign of elements in an array.

## Detailed Description

Return the sign of elements in an array.

Note
  This function only supports real inputs; complex inputs are not yet supported.

## Function Documentation

## ◆ af_sign()

af_err af_sign | ( | af_array * | out,
|  | const af_array | in )

C Interface to calculate the sign of elements in an array.

Parameters

  [out] | out | array containing 1's for negative values; 0's otherwise
  [in] | in | input array

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

## ◆ sign()

array sign | ( | const array & | in | ) |

C++ Interface to return the sign of elements in an array.

Parameters

  [in] | in | input array

Returns
  array containing 1's for negative values; 0's otherwise