A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arrayfire.org/docs/group__arith__func__cast.htm below:

ArrayFire: cast

Cast an array from one type to another. More...

Cast an array from one type to another.

◆ af_cast()

C Interface to cast an array from one type to another.

This function casts an af_array object from one type to another. If the type of the original array is the same as type then the same array is returned.

Consecutive casting operations may be may be optimized out if the original type of the af_array is the same as the final type. For example if the original type is f64, which is cast to f32 and then back to f64, then the cast to f32 is skipped and that operation will NOT be performed by ArrayFire. The following table shows which casts will be optimized out. outer -> inner -> outer

inner-> f32 f64 c32 c64 s32 u32 u8 b8 s64 u64 s16 u16 f16 f32 x x x x x f64 x x x x x c32 x x x x x c64 x x x x x s32 x x x x x x x x x u32 x x x x x x x x x u8 x x x x x x x x x x x x x b8 x x x x x x x x x x x x x s64 x x x x x x x u64 x x x x x x x s16 x x x x x x x x x x x u16 x x x x x x x x x x x f16 x x x x x

If you want to avoid this behavior use, af_eval after the first cast operation. This will ensure that the cast operation is performed on the af_array.

Parameters
[out] out values in the specified type [in] in input [in] type target data type af_dtype
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4