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

Function af_arith_real

src/api/c/binary.cpp:183–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182template<af_op_t op>
183static af_err af_arith_real(af_array *out, const af_array lhs,
184 const af_array rhs, const bool batchMode) {
185 try {
186 const ArrayInfo &linfo = getInfo(lhs);
187 const ArrayInfo &rinfo = getInfo(rhs);
188
189 dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode);
190 const af_dtype otype = implicit(linfo.getType(), rinfo.getType());
191 if (odims.ndims() == 0) {
192 return af_create_handle(out, 0, nullptr, otype);
193 }
194
195 af_array res;
196 switch (otype) {
197 case f32: res = arithOp<float, op>(lhs, rhs, odims); break;
198 case f64: res = arithOp<double, op>(lhs, rhs, odims); break;
199 case s32: res = arithOp<int, op>(lhs, rhs, odims); break;
200 case u32: res = arithOp<uint, op>(lhs, rhs, odims); break;
201 case s8: res = arithOp<schar, op>(lhs, rhs, odims); break;
202 case u8: res = arithOp<uchar, op>(lhs, rhs, odims); break;
203 case b8: res = arithOp<char, op>(lhs, rhs, odims); break;
204 case s64: res = arithOp<intl, op>(lhs, rhs, odims); break;
205 case u64: res = arithOp<uintl, op>(lhs, rhs, odims); break;
206 case s16: res = arithOp<short, op>(lhs, rhs, odims); break;
207 case u16: res = arithOp<ushort, op>(lhs, rhs, odims); break;
208 case f16: res = arithOp<half, op>(lhs, rhs, odims); break;
209 default: TYPE_ERROR(0, otype);
210 }
211 std::swap(*out, res);
212 }
213 CATCHALL;
214 return AF_SUCCESS;
215}
216
217template<af_op_t op>
218static af_err af_arith_sparse(af_array *out, const af_array lhs,

Callers

nothing calls this directly

Calls 7

getOutDimsFunction · 0.85
implicitFunction · 0.85
swapFunction · 0.85
af_create_handleFunction · 0.70
dimsMethod · 0.45
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected