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

Function af_imag

src/api/c/complex.cpp:124–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124af_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
152af_err af_conjg(af_array *out, const af_array in) {
153 try {

Callers 1

af_argFunction · 0.85

Calls 8

swapFunction · 0.85
af_constantFunction · 0.70
af_retain_arrayFunction · 0.70
getHandleFunction · 0.70
getTypeMethod · 0.45
ndimsMethod · 0.45
getMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected