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

Function af_cplx

src/api/c/complex.cpp:69–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69af_err af_cplx(af_array *out, const af_array in) {
70 try {
71 const ArrayInfo &info = getInfo(in);
72 af_dtype type = info.getType();
73
74 if (type == c32 || type == c64) {
75 AF_ERROR("Inputs to cplx2 can not be of complex type", AF_ERR_ARG);
76 }
77 if (info.ndims() == 0) { return af_retain_array(out, in); }
78
79 af_array tmp;
80 AF_CHECK(af_constant(&tmp, 0, info.ndims(), info.dims().get(), type));
81
82 af_array res;
83 switch (type) {
84 case f32: res = cplx<cfloat, float>(in, tmp, info.dims()); break;
85 case f64: res = cplx<cdouble, double>(in, tmp, info.dims()); break;
86
87 default: TYPE_ERROR(0, type);
88 }
89
90 AF_CHECK(af_release_array(tmp));
91
92 std::swap(*out, res);
93 }
94 CATCHALL;
95 return AF_SUCCESS;
96}
97
98af_err af_real(af_array *out, const af_array in) {
99 try {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected