| 122 | } |
| 123 | |
| 124 | af_err af_imag(af_array *out, const af_array in) { |
| 125 | try { |
| 126 | const ArrayInfo &info = getInfo(in); |
| 127 | af_dtype type = info.getType(); |
| 128 | |
| 129 | if (type != c32 && type != c64) { |
| 130 | return af_constant(out, 0, info.ndims(), info.dims().get(), type); |
| 131 | } |
| 132 | if (info.ndims() == 0) { return af_retain_array(out, in); } |
| 133 | |
| 134 | af_array res; |
| 135 | switch (type) { |
| 136 | case c32: |
| 137 | res = getHandle(imag<float, cfloat>(getArray<cfloat>(in))); |
| 138 | break; |
| 139 | case c64: |
| 140 | res = getHandle(imag<double, cdouble>(getArray<cdouble>(in))); |
| 141 | break; |
| 142 | |
| 143 | default: TYPE_ERROR(0, type); |
| 144 | } |
| 145 | |
| 146 | std::swap(*out, res); |
| 147 | } |
| 148 | CATCHALL; |
| 149 | return AF_SUCCESS; |
| 150 | } |
| 151 | |
| 152 | af_err af_conjg(af_array *out, const af_array in) { |
| 153 | try { |
no test coverage detected