MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_real

Function af_real

src/api/c/complex.cpp:98–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98af_err af_real(af_array *out, const af_array in) {
99 try {
100 const ArrayInfo &info = getInfo(in);
101 af_dtype type = info.getType();
102
103 if (type != c32 && type != c64) { return af_retain_array(out, in); }
104 if (info.ndims() == 0) { return af_retain_array(out, in); }
105
106 af_array res;
107 switch (type) {
108 case c32:
109 res = getHandle(real<float, cfloat>(getArray<cfloat>(in)));
110 break;
111 case c64:
112 res = getHandle(real<double, cdouble>(getArray<cdouble>(in)));
113 break;
114
115 default: TYPE_ERROR(0, type);
116 }
117
118 std::swap(*out, res);
119 }
120 CATCHALL;
121 return AF_SUCCESS;
122}
123
124af_err af_imag(af_array *out, const af_array in) {
125 try {

Callers 1

af_argFunction · 0.85

Calls 5

swapFunction · 0.85
af_retain_arrayFunction · 0.70
getHandleFunction · 0.70
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected