| 30 | namespace arrayfire { |
| 31 | |
| 32 | af_array retain(const af_array in) { |
| 33 | const ArrayInfo &info = getInfo(in, false); |
| 34 | af_dtype ty = info.getType(); |
| 35 | |
| 36 | if (info.isSparse()) { |
| 37 | switch (ty) { |
| 38 | case f32: return retainSparseHandle<float>(in); |
| 39 | case f64: return retainSparseHandle<double>(in); |
| 40 | case c32: return retainSparseHandle<detail::cfloat>(in); |
| 41 | case c64: return retainSparseHandle<detail::cdouble>(in); |
| 42 | default: TYPE_ERROR(1, ty); |
| 43 | } |
| 44 | } else { |
| 45 | switch (ty) { |
| 46 | case f32: return retainHandle<float>(in); |
| 47 | case f64: return retainHandle<double>(in); |
| 48 | case s32: return retainHandle<int>(in); |
| 49 | case u32: return retainHandle<uint>(in); |
| 50 | case s8: return retainHandle<schar>(in); |
| 51 | case u8: return retainHandle<uchar>(in); |
| 52 | case c32: return retainHandle<detail::cfloat>(in); |
| 53 | case c64: return retainHandle<detail::cdouble>(in); |
| 54 | case b8: return retainHandle<char>(in); |
| 55 | case s64: return retainHandle<intl>(in); |
| 56 | case u64: return retainHandle<uintl>(in); |
| 57 | case s16: return retainHandle<short>(in); |
| 58 | case u16: return retainHandle<ushort>(in); |
| 59 | case f16: return retainHandle<half>(in); |
| 60 | default: TYPE_ERROR(1, ty); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | af_array createHandle(const dim4 &d, af_dtype dtype) { |
| 66 | // clang-format off |
no test coverage detected