| 38 | } |
| 39 | |
| 40 | af_err af_cplx2(af_array *out, const af_array lhs, const af_array rhs, |
| 41 | bool batchMode) { |
| 42 | try { |
| 43 | af_dtype type = implicit(lhs, rhs); |
| 44 | |
| 45 | if (type == c32 || type == c64) { |
| 46 | AF_ERROR("Inputs to cplx2 can not be of complex type", AF_ERR_ARG); |
| 47 | } |
| 48 | |
| 49 | if (type != f64) { type = f32; } |
| 50 | dim4 odims = |
| 51 | getOutDims(getInfo(lhs).dims(), getInfo(rhs).dims(), batchMode); |
| 52 | if (odims.ndims() == 0) { |
| 53 | return af_create_handle(out, 0, nullptr, type); |
| 54 | } |
| 55 | |
| 56 | af_array res; |
| 57 | switch (type) { |
| 58 | case f32: res = cplx<cfloat, float>(lhs, rhs, odims); break; |
| 59 | case f64: res = cplx<cdouble, double>(lhs, rhs, odims); break; |
| 60 | default: TYPE_ERROR(0, type); |
| 61 | } |
| 62 | |
| 63 | std::swap(*out, res); |
| 64 | } |
| 65 | CATCHALL; |
| 66 | return AF_SUCCESS; |
| 67 | } |
| 68 | |
| 69 | af_err af_cplx(af_array *out, const af_array in) { |
| 70 | try { |
no test coverage detected